From ff1bba9576921851f1a79b081a3ec2eb136f4aff Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 22 Aug 2019 18:15:41 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A4=9A=E9=87=8D=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E7=9A=84=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index af235c4c9..4cf6aa15a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -549,7 +549,7 @@ class CoursesController < ApplicationController course_member = CourseMember.find_by!(id: params[:course_member_id].to_i, course_id: @course.id) tip_exception("删除失败") if course_member.CREATOR? or course_member.STUDENT? - course_student = CourseMember.find_by(id: course_member.user_id, course_id: @course.id, role: %i[STUDENT]) + course_student = CourseMember.find_by(user_id: course_member.user_id, course_id: @course.id, role: %i[STUDENT]) course_member.destroy! course_student.update_attributes(is_active: 1) if course_student.present? && !course_student.is_active normal_status(0, "删除成功") @@ -772,8 +772,10 @@ class CoursesController < ApplicationController students.each do |student| course_member = CourseMember.find_by(id: student[:course_member_id].to_i, course_id: @course.id) if course_member.present? + member_teacher = CourseMember.find_by(user_id: course_member.user_id, course_id: @course.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR]) student_ids << course_member.user_id course_member.destroy! + member_teacher.update_attributes(is_active: 1) if member_teacher.present? end end CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, student_ids) if student_ids.present? From 18a770e024da65c6860d1fa5a19022e17121c218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 22 Aug 2019 18:19:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/coursesDetail/CoursesLeftNav.js | 4 ++-- public/react/src/modules/paths/PathDetail/DetailTop.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index c6cc1bc44..af2d115fc 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -884,7 +884,7 @@ class Coursesleftnav extends Component{ this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> { item.type==="announcement"?: - item.type==="online_learning"?: + item.type==="online_learning"?: item.type==="shixun_homework"?: item.type==="common_homework"?: item.type==="group_homework"?: @@ -1001,7 +1001,7 @@ class Coursesleftnav extends Component{ { item.type==="announcement"?: - item.type==="online_learning"?: + item.type==="online_learning"?: item.type==="shixun_homework"?: item.type==="common_homework"?: item.type==="group_homework"?: diff --git a/public/react/src/modules/paths/PathDetail/DetailTop.js b/public/react/src/modules/paths/PathDetail/DetailTop.js index b18d13f2a..6800093d4 100644 --- a/public/react/src/modules/paths/PathDetail/DetailTop.js +++ b/public/react/src/modules/paths/PathDetail/DetailTop.js @@ -332,8 +332,8 @@ class DetailTop extends Component{ border-radius:4px; border:1px solid rgba(255,255,255,1); } - .minwinth600{ - min-width:600px; + .maxwinth700{ + max-width:700px; } ` } @@ -361,7 +361,7 @@ class DetailTop extends Component{ { detailInfoList.member_count!=0 ?
  • 学习人数{detailInfoList.member_count}
  • : ""} } -
    +
    {detailInfoList===undefined?"":detailInfoList.allow_statistics===true? From 04f621e46bc48574b0f0b9c051c3501336051b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 22 Aug 2019 18:26:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/coursesDetail/CoursesBanner.js | 7 ++++++- .../src/modules/courses/coursesPublic/CoursesListType.js | 2 ++ public/react/src/modules/courses/css/Courses.css | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 25e85dcf4..49800a90c 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -503,7 +503,12 @@ class CoursesBanner extends Component { } {excellent===true? - 开放课程 + + + + :""} 未提交:""} {item==="已确认"?已确认:""} {item==="已截止"?已截止:""} + {item==="开放课程"?开放课程:""} + ) diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index f9e32f95e..dbdd42398 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -907,6 +907,10 @@ a.white-btn.use_scope-btn:hover{ .edu-filter-btn-FC2B6A{ background:#FC2B6A !important; } + +.edu-filter-btn-FF6800{ + background:#FF6800 !important; +} .color666666{ color:#666666 !important; } From 895f420902c8a5f4e34590b97474d55704378f25 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 22 Aug 2019 18:30:05 +0800 Subject: [PATCH 4/4] =?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/course.rb | 1 + app/services/users/course_service.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index b46464ea6..e2fc5140b 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -82,6 +82,7 @@ class Course < ApplicationRecord scope :by_keywords, lambda { |keywords| where("name LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank? } + scope :started, -> { where("start_date is null or start_date <= '#{Date.today}'") } acts_as_taggable diff --git a/app/services/users/course_service.rb b/app/services/users/course_service.rb index 9eb34917e..de70c5b86 100644 --- a/app/services/users/course_service.rb +++ b/app/services/users/course_service.rb @@ -23,11 +23,11 @@ class Users::CourseService def category_scope_courses case params[:category] when 'study' then - user.as_student_courses + user.as_student_courses.started when 'manage' then user.manage_courses else - ids = user.as_student_courses.pluck(:id) + user.manage_courses.pluck(:id) + ids = user.as_student_courses.started.pluck(:id) + user.manage_courses.pluck(:id) Course.where(id: ids) end end