diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6c4ec91b..5abbddaa1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2372,10 +2372,12 @@ module ApplicationHelper link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" - elsif homework.homework_type == 2 #编程作业不能修改作品 - link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 + link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' else - link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' + link_to "查看作品", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" end end end diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index dbf7291cb..fd541c643 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -6,7 +6,7 @@ <%=format_time work.created_at %> - <% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>