Merge branch 'dev_course' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_course
SylorHuang 5 years ago
commit 49a3aa33b2

@ -737,11 +737,11 @@ class CoursesController < ApplicationController
end end
end end
# 获取历史课堂,即用户管理的所有课堂以及课堂下的分班 # 获取历史课堂,即用户管理的所有课堂以及课堂下的分班(去除当前课堂)
def get_historical_courses 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(tea_id: user_id, is_delete: 0) # @courses = Course.includes(:course_groups).where(id: current_user.course_members, is_delete: 0)
end end
# 根据历史课堂的课堂id和分班id获取所有学生 # 根据历史课堂的课堂id和分班id获取所有学生
@ -754,6 +754,7 @@ class CoursesController < ApplicationController
@students = @students.where(course_group_id: course_group_id) @students = @students.where(course_group_id: course_group_id)
end end
@students = @students.includes(user: [user_extension: :school])
@students_count = @students.size @students_count = @students.size
end end

@ -182,7 +182,13 @@ class MyshixunsController < ApplicationController
test_set_percentage = test_set_score / 100.to_f # 测试集得分比 test_set_percentage = test_set_score / 100.to_f # 测试集得分比
score = (challenge.score * test_set_percentage * answer_deduction_percentage).to_i 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
end end
test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f

@ -1,9 +1,9 @@
json.students do json.students do
json.array! @students do |student| json.array! @students do |student|
json.course_member_id student.id json.user_id student.user_id
json.name student.user.real_name json.name student.user.real_name
json.student_id student.user.user_extension.try(:student_id) json.student_id student.user.student_id
json.school_name student.user.user_extension.school.try(:name) json.school_name student.user.school_name
end end
end end
json.students_count @students_count json.students_count @students_count

@ -1,7 +1,7 @@
'en': 'en':
shixun: shixun:
status: status:
0: editing '0': editing
1: applying '1': applying
2: published '2': published
3: closed '3': closed

@ -1,7 +1,7 @@
'zh-CN': 'zh-CN':
shixun: shixun:
status: status:
0: 编辑中 '0': 编辑中
1: 审核中 '1': 审核中
2: 已发布 '2': 已发布
3: 已关闭 '3': 已关闭

Loading…
Cancel
Save