daiao 5 years ago
parent 1cfaaa06bb
commit 5ba217ab7c

@ -19,38 +19,26 @@ class ItemBank < ApplicationRecord
end
def apply?
!public && ApplyAction.where(container_type: "ItemBank", container_id: id, status: 0).exists?
!public && ApplyAction.exists?(container_type: "ItemBank", container_id: id, status: 0)
end
def type_string
result = case item_type
when "SINGLE"
"单选题"
when "MULTIPLE"
"多选题"
when "JUDGMENT"
"判断题"
when "COMPLETION"
"填空题"
when "SUBJECTIVE"
"简答题"
when "PRACTICAL"
"实训题"
when "PROGRAM"
"编程题"
end
result
case item_type
when "SINGLE" then "单选题"
when "MULTIPLE" then "多选题"
when "JUDGMENT" then "判断题"
when "COMPLETION" then "填空题"
when "SUBJECTIVE" then "简答题"
when "PRACTICAL" then "实训题"
when "PROGRAM" then "编程题"
end
end
def difficulty_string
result = case difficulty
when 1
"简单"
when 2
"适中"
when 3
"困难"
end
result
case difficulty
when 1 then "简单"
when 2 then "适中"
when 3 then "困难"
end
end
end

Loading…
Cancel
Save