作业截至之前不能启动匿评页面
This commit is contained in:
parent
7fa45a47bb
commit
3e6ccf3e50
|
@ -135,7 +135,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||||
def start_anonymous_comment
|
def start_anonymous_comment
|
||||||
@statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
@statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
||||||
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") > Time.now.strftime("%Y-%m-%d")
|
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||||
if @homework_detail_manual.comment_status == 1
|
if @homework_detail_manual.comment_status == 1
|
||||||
student_works = @homework.student_works
|
student_works = @homework.student_works
|
||||||
if student_works && student_works.size >=2
|
if student_works && student_works.size >=2
|
||||||
|
|
|
@ -2278,7 +2278,9 @@ module ApplicationHelper
|
||||||
#获取匿评相关连接代码
|
#获取匿评相关连接代码
|
||||||
def homework_anonymous_comment homework
|
def homework_anonymous_comment homework
|
||||||
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
||||||
if homework.student_works.count >= 2 #作业份数大于2
|
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||||
|
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
|
||||||
|
elsif homework.student_works.count >= 2 #作业份数大于2
|
||||||
case homework.homework_detail_manual.comment_status
|
case homework.homework_detail_manual.comment_status
|
||||||
when 1
|
when 1
|
||||||
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
|
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
|
||||||
|
|
Loading…
Reference in New Issue