From 43762561baa300a59f47c7a235527bb6eca696f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 14 Aug 2019 17:57:15 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/members/studentsList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index c3dc2c6ab..2a510789e 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -218,9 +218,9 @@ class studentsList extends Component{ }) this.fetchAll() const isAdmin = this.props.isAdmin() - if (isAdmin) { - this.fetchCourseGroups() - } + // if (isAdmin) { + this.fetchCourseGroups(); + // } isAdmin && on('addStudentSuccess', this.addStudentSuccessListener) isAdmin && on('updateNavSuccess', this.updateNavSuccess) From 744b391650514da19572567ed7f17d0d429bcd40 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 18:39:22 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_works_controller.rb | 20 +++++++++++++++++--- config/routes.rb | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 68d52bd74..93f0fc586 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -4,7 +4,7 @@ class StudentWorksController < ApplicationController before_action :require_login, :check_auth before_action :find_homework, only: [:new, :create, :search_member_list, :check_project, :relate_project, - :cancel_relate_project] + :cancel_relate_project, :delete_work] before_action :find_work, only: [:shixun_work_report, :adjust_review_score, :shixun_work, :commit_des, :update_des, :adjust_score, :show, :adjust_score, :supply_attachments, :revise_attachment, :comment_list, :add_score, :add_score_reply, :destroy_score, :appeal_anonymous_score, @@ -15,12 +15,12 @@ class StudentWorksController < ApplicationController before_action :teacher_allowed, only: [:adjust_score, :adjust_review_score, :deal_appeal_score] before_action :course_student, only: [:new, :commit_des, :update_des, :create, :edit, :update, :search_member_list, :relate_project, - :cancel_relate_project, :relate_project] + :cancel_relate_project, :relate_project, :delete_work] before_action :my_work, only: [:commit_des, :update_des, :edit, :update, :revise_attachment, :appeal_anonymous_score, :cancel_appeal] - before_action :edit_duration, only: [:edit, :update] + before_action :edit_duration, only: [:edit, :update, :delete_work] before_action :end_or_late, only: [:new, :create, :search_member_list, :commit_des, :update_des] before_action :require_score_id, only: [:destroy_score, :add_score_reply, :appeal_anonymous_score, :deal_appeal_score, :cancel_appeal] @@ -60,6 +60,20 @@ class StudentWorksController < ApplicationController @members = @members.page(page).per(limit).includes(:course_group, user: :user_extension) end + def delete_work + begin + work = @homework.student_works.find_by!(user_id: params[:user_id]) + work.update_attributes(description: nil, project_id: 0, + late_penalty: 0, work_status: 0, + commit_time: nil, update_time: nil, group_id: 0, + commit_user_id: nil, final_score: nil, work_score: nil, teacher_score: nil, teaching_asistant_score: nil) + normal_status("删除成功") + rescue Exception => e + uid_logger(e.message) + tip_exception(e.message) + end + end + def create student_work = @homework.student_works.find_or_create_by(user_id: current_user.id) diff --git a/config/routes.rb b/config/routes.rb index 45690fbad..988ebbfa2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -436,6 +436,7 @@ Rails.application.routes.draw do get :check_project get :cancel_relate_project post :relate_project + delete :delete_work end end end From aa136f38652d15fe2cc210a6b3f3c1888959b6e0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 19:10:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/export_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 5d36c465f..d38255c44 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -543,7 +543,7 @@ module ExportHelper end def format_sheet_name name - name = name.gsub(":", "-") + name = name.gsub(":", "-").gsub("/", "_") end def rename_same_file(name, index) From 3863c85ec48aaf63e9ddaa7ec269c6e8650a87cf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 19:57:23 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/export_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index d38255c44..f352b1e38 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -146,8 +146,8 @@ module ExportHelper w_6 = "--" end w_7 = w.work_status == 0 ? '--' : myshixun.try(:passed_count).to_s+"/"+shixun.challenges_count.to_s - w_8 = myshixun ? myshixun.try(:passed_time) == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间 - w_9 = myshixun ? (myshixun.try(:passed_count) > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时 + w_8 = myshixun ? myshixun.try(:passed_time).to_s == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间 + w_9 = myshixun ? (myshixun.try(:passed_count).to_i > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时 w_10 = myshixun ? myshixun.output_times : 0 #评测次数 w_11 = myshixun ? myshixun.total_score : "--" #获得经验值 w_12 = w.final_score.present? ? w.final_score : 0 From 0eb221d22ec39966b58829a639531ec21d891e4f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 14 Aug 2019 20:03:39 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/myshixun.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index a4f05f2ce..80074df6e 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -82,7 +82,7 @@ class Myshixun < ApplicationRecord # 通关时间 def passed_time - self.status == 1 ? self.games.map(&:end_time).max : "--" + self.status == 1 ? self.games.select{|game| game.status == 2}.map(&:end_time).max : "--" end # 耗时