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

* 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder:
  获取下一个待评阅的学生
courseware
harry 5 years ago
commit f98cadd00c

@ -330,7 +330,7 @@ class ApplicationController < ActionController::Base
end end
if !User.current.logged? && Rails.env.development? if !User.current.logged? && Rails.env.development?
User.current = User.find 1 User.current = User.find 8825
end end

@ -11,7 +11,7 @@ class HomeworkCommonsController < ApplicationController
before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results, before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results,
:code_review_detail, :show_comment, :settings, :works_list, :update_settings, :code_review_detail, :show_comment, :settings, :works_list, :update_settings,
:reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation, :reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation,
:update_score, :update_student_score, :batch_comment] :update_score, :update_student_score, :batch_comment, :get_next_work]
before_action :user_course_identity before_action :user_course_identity
before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer, before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer,
:update_student_score] :update_student_score]
@ -287,6 +287,15 @@ class HomeworkCommonsController < ApplicationController
end end
end end
def get_next_work
member = @course.course_member(current_user.id)
student_works = @homework.teacher_works(member).where.not(id: @homework.student_works_scores.where(reviewer_role: [1, 2]))
if params[:work_id]
student_works = student_works.where.not(id: params[:work_id])
end
@work = student_works.where("work_status > 0").take
end
def update_score def update_score
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
@homework.update_homework_work_score @homework.update_homework_work_score

@ -0,0 +1,2 @@
json.work_id @work&.id
json.user_name @work&.user&.real_name

@ -597,6 +597,7 @@ Rails.application.routes.draw do
get :update_score get :update_score
get :update_student_score get :update_student_score
post :batch_comment post :batch_comment
get :get_next_work
end end
collection do collection do

Loading…
Cancel
Save