# encoding: utf-8 module ExerciseHelper #判断用户是否已经提交了问卷 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 = "" length = str.length unless str.nil? if length === 1 result += (str.to_i + 64).chr return result elsif length > 1 for i in 0...length result += (str[i].to_i + 64).chr end return result end end return result end end