# encoding: utf-8
module ChallengesHelper
def difficulty_type difficulty
case difficulty
when 1
"简单"
when 2
"中等"
when 3
"复杂"
end
end
def show_challenge_file_type type
case type
when 1
"图片"
when 2
"apk/exe"
when 3
"txt"
when 4
"html"
when -1
"无"
end
end
def find_game_status challenge_id
game = Game.where(:challenge_id => challenge_id, :user_id => User.current.id).first
case game.try(:status)
when 0
"待完成 ".html_safe
when 1
"".html_safe
when 2
"已完成 ".html_safe
when 3,nil
"未开始 ".html_safe
end
end
end