From b58c54d6a37c551c33f6e25b05de8dab6edd55d0 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 24 Jun 2019 14:18:25 +0800 Subject: [PATCH 1/4] fix i18n issue --- config/locales/shixuns/en.yml | 8 ++++---- config/locales/shixuns/zh-CN.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/locales/shixuns/en.yml b/config/locales/shixuns/en.yml index 0f1a9f695..10de1eaef 100644 --- a/config/locales/shixuns/en.yml +++ b/config/locales/shixuns/en.yml @@ -1,7 +1,7 @@ 'en': shixun: status: - 0: editing - 1: applying - 2: published - 3: closed + '0': editing + '1': applying + '2': published + '3': closed diff --git a/config/locales/shixuns/zh-CN.yml b/config/locales/shixuns/zh-CN.yml index c5ba574d8..d7ad5f7e2 100644 --- a/config/locales/shixuns/zh-CN.yml +++ b/config/locales/shixuns/zh-CN.yml @@ -1,7 +1,7 @@ 'zh-CN': shixun: status: - 0: 编辑中 - 1: 审核中 - 2: 已发布 - 3: 已关闭 + '0': 编辑中 + '1': 审核中 + '2': 已发布 + '3': 已关闭 From bdc43fb9ce99905d97fb01eaeb50dca66cf6eb0d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 24 Jun 2019 14:29:19 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84=E5=AD=A6=E7=94=9Fapi=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 6 ++++-- .../courses/get_historical_course_students.json.jbuilder | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8de98f0cb..1bf81e87b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -737,11 +737,13 @@ class CoursesController < ApplicationController end end - # 获取历史课堂,即用户管理的所有课堂以及课堂下的分班 + # 获取历史课堂,即用户管理的所有课堂以及课堂下的分班(去除当前课堂) def get_historical_courses user_id = current_user.id - @courses = Course.includes(:course_groups).where(tea_id: user_id, is_delete: 0) + @courses = Course.where.not(id: @course.id).joins(:course_members). + where(is_delete: 0, course_members: {user_id: current_user.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR]}).includes(:course_groups) + # @courses = Course.includes(:course_groups).where(id: current_user.course_members, is_delete: 0) end # 根据历史课堂的课堂id和分班id获取所有学生 diff --git a/app/views/courses/get_historical_course_students.json.jbuilder b/app/views/courses/get_historical_course_students.json.jbuilder index a2d3a3f57..8dc4e22ce 100644 --- a/app/views/courses/get_historical_course_students.json.jbuilder +++ b/app/views/courses/get_historical_course_students.json.jbuilder @@ -1,6 +1,6 @@ json.students do json.array! @students do |student| - json.course_member_id student.id + json.user_id student.user_id json.name student.user.real_name json.student_id student.user.user_extension.try(:student_id) json.school_name student.user.user_extension.school.try(:name) From d8621fc366df1fb7141373d7bcda556ce9055185 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 24 Jun 2019 14:58:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 +-- .../courses/get_historical_course_students.json.jbuilder | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1bf81e87b..253bafa48 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -739,8 +739,6 @@ class CoursesController < ApplicationController # 获取历史课堂,即用户管理的所有课堂以及课堂下的分班(去除当前课堂) def get_historical_courses - user_id = current_user.id - @courses = Course.where.not(id: @course.id).joins(:course_members). where(is_delete: 0, course_members: {user_id: current_user.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR]}).includes(:course_groups) # @courses = Course.includes(:course_groups).where(id: current_user.course_members, is_delete: 0) @@ -756,6 +754,7 @@ class CoursesController < ApplicationController @students = @students.where(course_group_id: course_group_id) end + @students = @students.includes(user: [user_extension: :school]) @students_count = @students.size end diff --git a/app/views/courses/get_historical_course_students.json.jbuilder b/app/views/courses/get_historical_course_students.json.jbuilder index 8dc4e22ce..be58ff06a 100644 --- a/app/views/courses/get_historical_course_students.json.jbuilder +++ b/app/views/courses/get_historical_course_students.json.jbuilder @@ -2,8 +2,8 @@ json.students do json.array! @students do |student| json.user_id student.user_id json.name student.user.real_name - json.student_id student.user.user_extension.try(:student_id) - json.school_name student.user.user_extension.school.try(:name) + json.student_id student.user.student_id + json.school_name student.user.school_name end end json.students_count @students_count \ No newline at end of file From 76d29f9559071fac481ccdcc5db4d4d1482db54a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 24 Jun 2019 15:38:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E6=B2=A1=E8=BF=87?= =?UTF-8?q?=E5=85=B3=E5=88=86=E6=95=B0=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 91cff3c19..035b43955 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -182,7 +182,13 @@ class MyshixunsController < ApplicationController test_set_percentage = test_set_score / 100.to_f # 测试集得分比 score = (challenge.score * test_set_percentage * answer_deduction_percentage).to_i # 如果分数比上次多,则更新成绩 - game.update_attributes!(:status => 0, :final_score => score) if game.final_score < score + game_update = + if game.final_score < score + {final_score: score, status: 0} + else + {status: 0} + end + game.update_attributes!(game_update) end end test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f