socialforge/app/helpers/exercise_helper.rb

28 lines
528 B
Ruby

# encoding: utf-8
module ExerciseHelper
# 单选
def translate_standard_answer(params)
answer = params.ord - 64
end
#判断用户是否已经提交了问卷
def has_commit_exercise?(exercise_id, user_id)
pu = ExerciseUser.find_by_excercise_id_and_user_id(exercise_id, user_id)
if pu.nil?
false
else
true
end
end
def convert_to_char(str)
result = ""
if str.count >= 1
for i in 0 .. str.count do i
result += (str[i].to_i + 64).chr
end
end
end
end