diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 2efe1df09..014262aea 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 @@ -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) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 38472c0d3..542c33652 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, @@ -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.info("#####################{course.id}") end end 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 # 判断项目是否已有其他作品关联上了 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/homework_commons/group_list.json.jbuilder b/app/views/homework_commons/group_list.json.jbuilder index b5fead17e..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 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 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 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?