学生身份访问毕设作品列表增加参数

dev_course
cxt 6 years ago
parent 2a9e521d54
commit 2c7f9f9f77

@ -131,4 +131,20 @@ module GraduationTasksHelper
end
end
end
# 阶段剩余时间
def task_left_time task
if task.publish_time && task.publish_time < Time.now
if task.end_time > Time.now
status = "剩余提交时间"
time = "#{how_much_time(task.end_time)}"
else
if task.allow_late && task.late_time && task.late_time >= Time.now
status = "剩余补交时间"
time = "#{how_much_time(task.late_time)}"
end
end
end
{status: status, time: time}
end
end

@ -168,6 +168,8 @@ class GraduationTask < ApplicationRecord
end
end
# 是否具有分组
def have_grouping?
self.task_type == 2

@ -12,10 +12,11 @@ json.tasks @tasks.each do |task|
json.name task.name
json.private_icon !task.is_public
json.task_status task.status #6.12 -hs
json.status task_curr_status(task, @course)[:status]
json.status_time task_curr_status(task, @course)[:time]
task_curr_status = task_curr_status(task, @course)
json.status task_curr_status[:status]
json.status_time task_curr_status[:time]
unless task_curr_status(task, @course)[:status].include?("未发布")
unless task_curr_status[:status].include?("未发布")
json.commit_count grduationwork_count task, 1
json.uncommit_count grduationwork_count task, 0
end

@ -26,8 +26,14 @@ if @task.published? || @user_course_identity < Course::STUDENT
# 是否具有分组
json.have_grouping @task.have_grouping?
json.work_count @work_count
json.all_work_count @all_work_count
if @user_course_identity == Course::STUDENT
json.commit_count grduationwork_count @task, 1
json.uncommit_count grduationwork_count @task, 0
json.left_time task_left_time @task
else
json.work_count @work_count
json.all_work_count @all_work_count
end
# 学生数据
json.work_lists do
json.array! @work_list do |work|

Loading…
Cancel
Save