daiao 5 years ago
parent 1cfaaa06bb
commit 5ba217ab7c

@ -19,38 +19,26 @@ class ItemBank < ApplicationRecord
end end
def apply? 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 end
def type_string def type_string
result = case item_type case item_type
when "SINGLE" when "SINGLE" then "单选题"
"单选题" when "MULTIPLE" then "多选题"
when "MULTIPLE" when "JUDGMENT" then "判断题"
"多选题" when "COMPLETION" then "填空题"
when "JUDGMENT" when "SUBJECTIVE" then "简答题"
"判断题" when "PRACTICAL" then "实训题"
when "COMPLETION" when "PROGRAM" then "编程题"
"填空题"
when "SUBJECTIVE"
"简答题"
when "PRACTICAL"
"实训题"
when "PROGRAM"
"编程题"
end end
result
end end
def difficulty_string def difficulty_string
result = case difficulty case difficulty
when 1 when 1 then "简单"
"简单" when 2 then "适中"
when 2 when 3 then "困难"
"适中"
when 3
"困难"
end end
result
end end
end end

Loading…
Cancel
Save