dev_forum
cxt 5 years ago
parent f76fc8d7fe
commit 0800574303

@ -59,7 +59,8 @@ class GraduationTasksController < ApplicationController
# 任务发布的情况下: 是老师身份或者任务已截止的情况下公开任务了作品设置的学生也能查看其他人的作品
if @task.published? && (@user_course_identity < Course::STUDENT ||
(@user_course_identity == Course::STUDENT && @work.present? && @work.take.work_status > 0 &&
@task.status > 1 && @task.open_work))
((!@task.allow_late && @task.status > 1) || (@task.allow_late && @task.late_time && @task.late_time < Time.now)) &&
(@task.open_work || @task.open_score)))
# 如有有分班则看分班内的学生,否则看所有学生的作品
user_ids =
if @user_course_identity < Course::STUDENT
@ -117,6 +118,7 @@ class GraduationTasksController < ApplicationController
@work_list = @work_list.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}")
end
@view_work = @task.open_work || @user_course_identity < Course::STUDENT
@work_count = @work_list.count
@work_excel = @work_list
@ -150,6 +152,7 @@ class GraduationTasksController < ApplicationController
end
else
@work_list = @work
@view_work = false
@work_count = @work_list.count
@all_work_count = @work_list.count
respond_to do |format|

@ -63,7 +63,7 @@ class GraduationWork < ApplicationRecord
#用户是否有查看分数的权限
def check_score_power? current_user, course_identity
self.work_score.present? || course_identity < Course::STUDENT || self.user_id = current_user.id
self.work_score.present? && (course_identity < Course::STUDENT || self.user_id = current_user.id || graduation_task.open_score)
end
# 作品是否能够分配指导老师

@ -59,6 +59,7 @@ if @task.published? || @user_course_identity < Course::STUDENT
json.late_penalty work.late_penalty if @task.allow_late
json.final_score work_final_score work, @current_user, @user_course_identity
json.assign work.assign_power?(@user_course_identity)
json.view_work @view_work || @current_user.id == work.user_id
end
end
end
Loading…
Cancel
Save