json.course_identity @user_course_identity json.homework_type @homework_type json.course_public @course.is_public == 1 json.is_end @course.is_end json.all_count @all_count json.published_count @published_count json.unpublished_count @all_count - @published_count json.task_count @task_count json.main_category_id @main_category.try(:id) json.main_category_name @main_category.try(:module_name) json.category_id @category.try(:id) json.category_name @category.try(:name) json.homeworks @homework_commons.each do |homework| # homework_private = (@user_course_identity > Course::STUDENT) && !homework.is_public curr_status = homework_curr_status(homework, @user_course_identity, @course, @member, @member&.teacher_course_groups) json.homework_id homework.id json.name homework.name json.private_icon !homework.is_public json.status curr_status[:status] json.status_time curr_status[:time] json.time_status curr_status[:time_status] json.allow_late homework.allow_late unless curr_status[:status].include?("未发布") json.commit_count studentwork_count homework, 1, @user.id json.uncommit_count studentwork_count homework, 0, @user.id end if @user_course_identity < Course::STUDENT if homework.homework_type == "practice" json.shixun_identifier homework.shixuns.first.try(:identifier) end elsif @user_course_identity == Course::STUDENT if homework.homework_type == "practice" # json.challenge_count homework.shixuns.first.try(:challenges_count).to_i current_myshixun = homework.user_work(@user.id).try(:myshixun) # json.game_count current_myshixun ? current_myshixun.exec_count : 0 json.task_operation task_operation_url(current_myshixun, homework.shixuns.first) else work = homework.user_work(@user.id) json.work_id work.try(:id) json.work_status student_work_status(homework, @user.id, @course, work) json.un_commit_work !work.present? || work.work_status == 0 end end end