From f5a2d6acdb4e23e4e8d21c9591303f4038ea8ba5 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 5 Aug 2016 17:33:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E5=93=81?= =?UTF-8?q?=EF=BC=9A=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E4=BD=9C=E5=93=81=E6=A0=A1=E9=AA=8C=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E9=87=8D=E8=AF=95=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E4=B8=AD=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E4=BD=9C=E5=93=81=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=B0=B1=E6=B2=A1=E6=9C=89=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 34 ++++++++++++---------- app/models/student_work.rb | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 3d87b007d..6ea8baa29 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -775,23 +775,27 @@ class StudentWorkController < ApplicationController end def retry_work - if @work.destroy - if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 - pros = @work.student_work_projects.where("is_leader = 0") - pros.each do |pro| - pro.destroy - end - project = @work.student_work_projects.where("is_leader = 1").first - project.update_attributes(:student_work_id => nil) - elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 - @work.student_work_projects.each do |pro2| - pro2.destroy + if @homework.homework_type == 3 + if @work.destroy + if @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end end end - @student_work = StudentWork.new - respond_to do |format| - format.js - end + elsif @homework.homework_type == 1 + @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0) + end + @student_work = StudentWork.new + respond_to do |format| + format.js end end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 3fcc9fb8a..3ba3ee2b2 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -1,6 +1,6 @@ #学生提交作品表 class StudentWork < ActiveRecord::Base - attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value + attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status belongs_to :homework_common belongs_to :user From 55637808fffde740143b22e39bb90595424106b1 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 5 Aug 2016 18:07:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E5=93=81?= =?UTF-8?q?=EF=BC=9A=E4=B8=A4=E7=A7=8D=E8=A7=92=E8=89=B2=E7=9A=84=E6=88=90?= =?UTF-8?q?=E5=91=98=EF=BC=8C=E5=85=88=E5=AD=A6=E7=94=9F=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=EF=BC=8C=E5=86=8D=E6=95=99?= =?UTF-8?q?=E8=BE=85=E8=BA=AB=E4=BB=BD=E8=AF=84=E9=98=85=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E5=93=81=EF=BC=8C=E8=AF=84=E9=98=85=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=8D=E8=83=BD=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 6ea8baa29..adfcd6263 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -802,7 +802,6 @@ class StudentWorkController < ApplicationController #添加评分,已评分则为修改评分 def add_score @is_last = params[:is_last] == "true" - render_403 and return if User.current == @work.user #不可以匿评自己的作品 @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2 From d3db6719ebae626be895a02484ca43db1033fc56 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 5 Aug 2016 18:41:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E2=80=9D=E4=B8=AD=E7=BC=96=E8=BE=91=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E4=B8=8D=E8=B7=B3=E8=BD=AC=E5=88=B0=E2=80=9C=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E2=80=9D=EF=BC=8C=E8=80=8C=E6=98=AF=E8=BF=94=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E4=BD=9C=E4=B8=9A=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 11 ++++++++--- app/views/homework_common/edit.html.erb | 15 ++++++++++----- app/views/users/_manage_homework_list.html.erb | 2 +- app/views/users/_my_homework_list.html.erb | 4 ++-- .../users/manage_or_receive_homeworks.html.erb | 2 +- .../users/manage_or_receive_homeworks.js.erb | 2 +- app/views/users/search_m_r_homeworks.js.erb | 2 +- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 2020915f8..2f50c8105 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -58,9 +58,10 @@ class HomeworkCommonController < ApplicationController def edit @user = User.current - @is_in_course = params[:is_in_course].to_i + @is_in_course = params[:is_in_course] + @is_manage = params[:is_manage] @course_activity = params[:course_activity].to_i - if @is_in_course == 1 || @course_activity == 1 + if @is_in_course.to_i == 1 || @course_activity == 1 @left_nav_type = 3 respond_to do |format| format.html{render :layout => 'base_courses'} @@ -144,7 +145,11 @@ class HomeworkCommonController < ApplicationController @homework_detail_programing.save if @homework_detail_programing @homework_detail_group.save if @homework_detail_group - if params[:is_in_course] == "1" + if params[:is_manage] == "1" + redirect_to manage_or_receive_homeworks_user_path(User.current.id) + elsif params[:is_manage] == "2" + redirect_to my_homeworks_user_path(User.current.id) + elsif params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => @course.id) elsif params[:is_in_course] == "0" redirect_to user_homeworks_user_path(User.current.id) diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index d4d9d7c16..1bd71e7a9 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -1,5 +1,5 @@