From e771aee99fb8d740a39622fe085da10c176b200b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 19:03:41 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E5=8F=91=E9=80=81=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E7=9A=84url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/send_to_course.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/subjects/send_to_course.json.jbuilder b/app/views/subjects/send_to_course.json.jbuilder index 23da82281..defe309a2 100644 --- a/app/views/subjects/send_to_course.json.jbuilder +++ b/app/views/subjects/send_to_course.json.jbuilder @@ -1,3 +1,3 @@ json.status 1 json.message "发送成功" -json.url "/homework_commons?course=#{@course.id}&homework_type=4" \ No newline at end of file +json.url module_url(@course.none_hidden_course_modules.first, @course) \ No newline at end of file From 8decd0d450a7d140e0de37fd8b0dcd88a9859ceb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 19:23:43 +0800 Subject: [PATCH 02/14] =?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/controllers/student_works_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index d12913852..f9f4717a6 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -206,7 +206,7 @@ class StudentWorksController < ApplicationController @current_user = current_user @work_members = @homework.homework_type != "group" ? [] : @homework.student_works.where.not(user_id: @work.user_id). where(group_id: @work.group_id).includes(:user) - @attachments = @work.attachments.where.not(attachtype: 7) + @attachments = @work.attachments.where("attachtype != 7 or attachtype is null") end # 判断项目是否已有其他作品关联上了 From bb28f494f8ef3fceede78e141640f237861df211 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 19:24:30 +0800 Subject: [PATCH 03/14] =?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/controllers/courses_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 38472c0d3..9a651cf6e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -12,9 +12,9 @@ class CoursesController < ApplicationController end before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, - :left_banner, :top_banner, :apply_to_join_course] - before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner] + before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, + :left_banner, :top_banner, :apply_to_join_course] before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, :set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers, :top_banner, :left_banner, :add_teacher_popup, :add_teacher, From 65463d855eb18545d4ab305fd008356aeb324368 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 19:38:51 +0800 Subject: [PATCH 04/14] =?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/controllers/courses_controller.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 9a651cf6e..4a7358ffe 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -884,11 +884,11 @@ class CoursesController < ApplicationController end # 验证是否存在同学号的学生 - u_extension = current_user.user_extension - if params[:student].present? && u_extension.student? - same_student_id_users = UserExtension.where.not(user_id: current_user.id).where(student_id: u_extension.student_id, identity: %i[student], school_id: u_extension.school_id).pluck(:user_id) - tip_exception("该课堂已存在同学号的学生,暂时无法加入,请联系老师") if course.students.exists?(user_id: same_student_id_users) - end + # u_extension = current_user.user_extension + # if params[:student].present? && u_extension.student? + # same_student_id_users = UserExtension.where.not(user_id: current_user.id).where(student_id: u_extension.student_id, identity: %i[student], school_id: u_extension.school_id).pluck(:user_id) + # tip_exception("该课堂已存在同学号的学生,暂时无法加入,请联系老师") if course.students.exists?(user_id: same_student_id_users) + # end # 创建学生身份 if params[:student].present? @@ -906,6 +906,7 @@ class CoursesController < ApplicationController CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id) + logger_error("#####################{course.id}") end end From 2b8f5ccc8a6aa5d34b89be86edddc73a3d04ff9a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 19:41:58 +0800 Subject: [PATCH 05/14] =?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/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 4a7358ffe..542c33652 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -906,7 +906,7 @@ class CoursesController < ApplicationController CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id) - logger_error("#####################{course.id}") + logger.info("#####################{course.id}") end end From f38702e584de51685d98fee06ee5cc699e5392c2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 19:48:46 +0800 Subject: [PATCH 06/14] =?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 +- app/models/attachment.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 742deb85b..9771f6e1d 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -454,7 +454,7 @@ module ExportHelper #单个文件的话,不需要压缩,只改名 if homeworks_attach_path.size == 1 out_file = find_or_pack(object, work.user_id, digests.sort){ - des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work, filename.first)}_#{File.basename(homeworks_attach_path.first)}" + des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work, filename.first)}_#{work.id}}" FileUtils.cp homeworks_attach_path.first, des_path des_path } diff --git a/app/models/attachment.rb b/app/models/attachment.rb index bdd749108..1dbc86123 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -25,7 +25,7 @@ class Attachment < ApplicationRecord validates_length_of :description, maximum: 100 def diskfile - File.join(File.join(Rails.root, "files"), disk_directory.to_s, disk_filename.to_s) + File.join(File.join(Rails.root, "files"), disk_directory.to_s, filename.to_s) end def title From 8d8a0414e5f0e5797a73f46027a4eed7628b4ec8 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 20:11:30 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 2efe1df09..53a6d1ae1 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -14,7 +14,7 @@ class AttachmentsController < ApplicationController update_downloads(@file) redirect_to @file.cloud_url and return end - send_file absolute_path(local_path(@file)), type: @file.content_type.presence || 'application/octet-stream' + send_file(absolute_path(local_path(@file)), filename: @file.filename, type: @file.content_type.presence || 'application/octet-stream') update_downloads(@file) end From 70ad9152707cfe4f2ead9f0badc117f199aefff6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 20:18:47 +0800 Subject: [PATCH 08/14] tiaoz --- 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 9771f6e1d..742deb85b 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -454,7 +454,7 @@ module ExportHelper #单个文件的话,不需要压缩,只改名 if homeworks_attach_path.size == 1 out_file = find_or_pack(object, work.user_id, digests.sort){ - des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work, filename.first)}_#{work.id}}" + des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work, filename.first)}_#{File.basename(homeworks_attach_path.first)}" FileUtils.cp homeworks_attach_path.first, des_path des_path } From e65b5692f75c163a93d78eeea3e1a4d6b9f90150 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 20:32:10 +0800 Subject: [PATCH 09/14] =?UTF-8?q?D=E9=99=84=E4=BB=B6=E7=9A=84=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 53a6d1ae1..014262aea 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -100,7 +100,7 @@ class AttachmentsController < ApplicationController def current_month_folder date = Time.now - "#{date.year}/#{date.day.to_s.rjust(2, '0')}" + "#{date.year}/#{date.month.to_s.rjust(2, '0')}" end def file_ext(file_name) From 8a5da06e8e8ff19149fd20b98e015480d40ecdd7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 20:35:50 +0800 Subject: [PATCH 10/14] tiaoz --- app/models/attachment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 1dbc86123..bdd749108 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -25,7 +25,7 @@ class Attachment < ApplicationRecord validates_length_of :description, maximum: 100 def diskfile - File.join(File.join(Rails.root, "files"), disk_directory.to_s, filename.to_s) + File.join(File.join(Rails.root, "files"), disk_directory.to_s, disk_filename.to_s) end def title From ffc36c5cf2c8e64fd204e04c54189a5d6cc55b60 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 09:16:56 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 4 ++-- app/helpers/subjects_helper.rb | 4 ++-- app/views/subjects/show.json.jbuilder | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index b372eb2c0..064061058 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -82,8 +82,8 @@ class SubjectsController < ApplicationController @is_creator = current_user.creator_of_subject?(@subject) # 合作团队 @members = @subject.subject_members.includes(:user) - shixun_ids = @subject.shixuns.published.pluck(:id) - challenge_ids = Challenge.where(shixun_id: shixun_ids).pluck(:id) + @shixuns = @subject.shixuns.published.pluck(:id) + challenge_ids = Challenge.where(shixun_id: @shixuns).pluck(:id) # 实训路径中的所有实训标签 @tags = ChallengeTag.where(challenge_id: challenge_ids).pluck(:name).uniq # 用户获取的实训标签 diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index f0ecd1174..c464c7a7e 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -1,10 +1,10 @@ module SubjectsHelper # 实训路径的发布状态 - def publish_status subject, is_manager, user + def publish_status subject, is_manager, user, shixuns status = -1 if is_manager - status = 0 if subject.status == 0 && subject.shixuns_count > 0 + status = 0 if subject.status == 0 && shixuns.count > 0 status = 1 if subject.status == 1 status = 2 if subject.status == 2 && user.admin? end diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index 14eb1942f..cafb08942 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -6,7 +6,7 @@ json.subject_score @subject.all_score json.member_count @subject.member_count json.allow_delete @is_creator && (@subject.status != 2 || @user.admin?) -json.publish_status publish_status(@subject, @is_creator, @user) +json.publish_status publish_status(@subject, @is_creator, @user, @shixuns) json.allow_statistics @user.manager_of_subject?(@subject) json.allow_send @user.logged? json.allow_visit @user.manager_of_subject?(@subject) || @user.admin? || @subject.status > 1 From 314dda5a358bf9573b20f56819928c3fe816a3bc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 09:22:30 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_commons/group_list.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/homework_commons/group_list.json.jbuilder b/app/views/homework_commons/group_list.json.jbuilder index b5fead17e..d7e2427fd 100644 --- a/app/views/homework_commons/group_list.json.jbuilder +++ b/app/views/homework_commons/group_list.json.jbuilder @@ -7,7 +7,7 @@ json.group_list do end end # 未分班展示情况放在最后 -if @course_groups.count != (@page -1)*@limit.to_i && @course_groups.count < @limit.to_i +if @course_groups.count != (@page - 1)*@limit.to_i && @course_groups.count < @limit.to_i ungroup_work_count = homework_ungroup_works_count(@homework, @ungroup_user_ids) if ungroup_work_count > 0 json.ungroup_list do From d63881d85bbd1e67e51c7d1ab25565f5295f71a4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 09:27:32 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_commons/group_list.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/homework_commons/group_list.json.jbuilder b/app/views/homework_commons/group_list.json.jbuilder index d7e2427fd..aa951bf7d 100644 --- a/app/views/homework_commons/group_list.json.jbuilder +++ b/app/views/homework_commons/group_list.json.jbuilder @@ -7,7 +7,7 @@ json.group_list do end end # 未分班展示情况放在最后 -if @course_groups.count != (@page - 1)*@limit.to_i && @course_groups.count < @limit.to_i +if @course_groups.count != (@page.to_i - 1)*@limit.to_i && @course_groups.count < @limit.to_i ungroup_work_count = homework_ungroup_works_count(@homework, @ungroup_user_ids) if ungroup_work_count > 0 json.ungroup_list do From 62c9ba34c1fd959453b7894633d4b50c36e90806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 23 Jul 2019 10:06:07 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTaskssettinglist.js | 10 ++++----- public/react/src/modules/login/LoginDialog.js | 21 +++++++++++-------- public/react/src/modules/tpm/NewHeader.js | 8 +++---- .../tpm/shixunchild/Challenges/Challenges.js | 7 +++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 99c190063..291095008 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -1203,14 +1203,14 @@ class GraduationTaskssettinglist extends Component{ {taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.length!=0?