多选顺序按小到大排序
This commit is contained in:
parent
d583ca1d70
commit
21694daa59
|
@ -14,17 +14,18 @@ module ExerciseHelper
|
|||
# 多选
|
||||
def multiselect_standard_answer(params)
|
||||
size = params.ord - 96
|
||||
answer = ""
|
||||
answer = []
|
||||
if size > 0 # 小写字母答案
|
||||
for i in 0..(params.length-1)
|
||||
answer += (params[i].ord - 96).to_s
|
||||
answer << (params[i].ord - 96).to_s
|
||||
end
|
||||
else
|
||||
for i in 0..(params.length-1)
|
||||
answer += (params[i].ord - 64).to_s
|
||||
answer << (params[i].ord - 64)
|
||||
end
|
||||
end
|
||||
answer.to_i
|
||||
answer = answer.sort
|
||||
answer.join("")
|
||||
end
|
||||
|
||||
def fill_standart_answer(params, standart_answer)
|
||||
|
|
Loading…
Reference in New Issue