module MyshixunsHelper

  # 获取tpi的identifier,
  # identity表示用户关卡的身份
  # task_pass: 实训是否允许跳关
  def get_game_identifier task_pass, game, game_identity
    # 允许跳关、 关卡已经开启、 用户是已认证老师以上的身份
    if task_pass || game.status != 3 || game_identity <=  User::EDU_CERTIFICATION_TEACHER
      game.identifier
    else
      nil
    end
  end

  def view_answer_time game
    game.game_answers.where(user_id: game.user_id).last&.view_time
  end
end
