From 7a90c0ea1090cecc7f4e92802979b11498711da9 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 21 Apr 2016 10:51:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AF=84=E5=88=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E9=A1=B9=E6=97=B6=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E5=8F=91=E5=A4=9A=E6=9D=A1=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index cd7aa39bc..0d1fb9462 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -771,8 +771,6 @@ class StudentWorkController < ApplicationController student_work.late_penalty = @homework.late_penalty student_work.save end - - @homework.save end if params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s @@ -795,7 +793,6 @@ class StudentWorkController < ApplicationController homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing @homework.teacher_priority = teacher_priority - @homework.save homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing @@ -804,6 +801,8 @@ class StudentWorkController < ApplicationController student_work.save end end + + @homework.save if params[:student_path] redirect_to student_work_index_url(:homework => @homework.id) else From 9b4c275869f0eb3809067c712ee399acf20da867 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 22 Apr 2016 11:27:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=BD=E5=8A=A0=E9=99=84=E4=BB=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + app/helpers/application_helper.rb | 8 ++++++-- app/views/organizations/_org_course_homework.html.erb | 9 +++++++-- app/views/student_work/_programing_work_show.html.erb | 5 +++++ app/views/student_work/_revise_attachment.html.erb | 4 ++-- app/views/student_work/_show.html.erb | 5 ++++- app/views/student_work/_student_work_list.html.erb | 6 +++--- app/views/users/_course_homework.html.erb | 7 ++++++- app/views/users/_user_homework_detail.html.erb | 6 ++++++ 9 files changed, 40 insertions(+), 11 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 0d1fb9462..24fbed982 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -355,6 +355,7 @@ class StudentWorkController < ApplicationController end @score = @b_sort == "desc" ? "asc" : "desc" + @is_focus = params[:is_focus] ? params[:is_focus].to_i : 0 # 消息传过来的ID @message_student_work_id = params[:student_work_id] respond_to do |format| diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 366cea06b..50b117da2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2990,8 +2990,12 @@ def homework_common_index_url_in_org(course_id) Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s end -def student_work_index_url_in_org(homework_id) - Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s +def student_work_index_url_in_org(homework_id, is_focus = '') + if is_focus != '' + Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s + else + Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + end end def course_url_in_org(course_id) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 025bb48af..4ac2ebcbf 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -66,11 +66,16 @@ <% end %> <% end %> + <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
- <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> <%= user_for_homework_common activity,is_teacher %>
- + <% work = cur_user_works_for_homework activity %> + <% if activity.end_time < Date.today && !is_teacher && !work.nil? %> +
+ <%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> +
+ <% end %> <% if activity.homework_type == 2 && is_teacher%>
<%= link_to "模拟答题", Setting.protocol + "://" + Setting.host_name + "/users/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 997d28f6d..75cd392d1 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -120,6 +120,11 @@