diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index fcc3e7a7c..58fbfa596 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -34,6 +34,7 @@ elsif @user_course_identity == Course::STUDENT if @homework.homework_type == "practice" json.(@work, :id, :update_time, :ultimate_score) + myshixun = @work.myshixun || @shixun.find_by(user_id: @work.user_id) json.calculation_time @work.calculation_time json.late_penalty @work.late_penalty if @homework.allow_late json.cost_time @work.myshixun.try(:total_spend_time) @@ -41,7 +42,7 @@ elsif @user_course_identity == Course::STUDENT json.final_score work_score_format(@work.final_score, true, @score_open) json.efficiency work_score_format(@work.efficiency, true, @score_open) json.eff_score work_score_format(@work.eff_score, true, @score_open) - json.current_complete_count @work.myshixun.try(:passed_count) if @homework.end_or_late + json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late json.complete_count @work.myshixun&.time_passed_count(@homework.homework_group_setting(@work.user_id)&.end_time) json.view_answer_count @work.myshixun.try(:view_answer_count).to_i json.work_status @work.compelete_status @@ -90,6 +91,7 @@ if @homework.homework_type == "practice" json.student_works @student_works.each do |work| json.(work, :id, :update_time, :ultimate_score, :myshixun_id) + myshixun = work.myshixun || @shixun.find_by(user_id: @work.user_id) json.late_penalty work.late_penalty if @homework.allow_late json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open) @@ -98,7 +100,7 @@ if @homework.homework_type == "practice" json.eff_score work_score_format(work.eff_score, @current_user == work.user, @score_open) json.cost_time work.myshixun.try(:total_spend_time) - json.current_complete_count work.myshixun.try(:passed_count) if @homework.end_or_late + json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late json.complete_count work.myshixun&.time_passed_count(@homework.homework_group_setting(work.user_id)&.end_time) json.view_answer_count work.myshixun.try(:view_answer_count).to_i json.user_login work.user.try(:login)