From e3c4b3f3ff7bb56f535b5c471e9c0b71449cd893 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 17 Mar 2020 16:14:07 +0800
Subject: [PATCH 01/16] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E5=92=8C=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attendances_controller.rb | 15 +++++++++++++++
app/views/attendances/edit.json.jbuilder | 4 ++++
2 files changed, 19 insertions(+)
create mode 100644 app/views/attendances/edit.json.jbuilder
diff --git a/app/controllers/attendances_controller.rb b/app/controllers/attendances_controller.rb
index c8287f413..985052f18 100644
--- a/app/controllers/attendances_controller.rb
+++ b/app/controllers/attendances_controller.rb
@@ -2,6 +2,7 @@ class AttendancesController < ApplicationController
before_action :require_login
before_action :find_course, only: [:index, :statistics]
+ before_action :find_attendance, except: [:index, :statistics]
before_action :user_course_identity
def index
@@ -66,9 +67,23 @@ class AttendancesController < ApplicationController
@avg_leave_rate = data[:avg_leave_rate]
end
+ def edit
+ @groups = @course.course_groups.where(id: @attendance.course_attendance_groups.pluck(:course_group_id))
+ end
+
+ def update
+ tip_exception(403, "") unless @user_course_identity < Course::PROFESSOR || @attendance.user_id == current_user.id
+ @attendance.update!(update_params)
+ render_ok
+ end
+
private
def find_attendance
@attendance = CourseAttendance.find params[:id]
@course = @attendance.course
end
+
+ def update_params
+ params.permit(:name, :mode, :attendance_date, :start_time, :end_time)
+ end
end
\ No newline at end of file
diff --git a/app/views/attendances/edit.json.jbuilder b/app/views/attendances/edit.json.jbuilder
new file mode 100644
index 000000000..77d2b09f3
--- /dev/null
+++ b/app/views/attendances/edit.json.jbuilder
@@ -0,0 +1,4 @@
+json.(@attendance, :name, :mode, :attendance_date, :start_time, :end_time)
+json.groups @groups do |group|
+ json.(group, :id, :name)
+end
\ No newline at end of file
From 5e468dfc03dd272e9629f06a510b14685c322054 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 17 Mar 2020 16:33:43 +0800
Subject: [PATCH 02/16] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E7=9A=84=E7=BC=96?=
=?UTF-8?q?=E8=BE=91=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attendances_controller.rb | 30 +++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/app/controllers/attendances_controller.rb b/app/controllers/attendances_controller.rb
index 985052f18..936bef188 100644
--- a/app/controllers/attendances_controller.rb
+++ b/app/controllers/attendances_controller.rb
@@ -73,7 +73,14 @@ class AttendancesController < ApplicationController
def update
tip_exception(403, "") unless @user_course_identity < Course::PROFESSOR || @attendance.user_id == current_user.id
+ a_end_time = "#{@attendance.attendance_date} #{@attendance.end_time}".to_time
+ new_end_time = "#{params[:attendance_date]} #{params[:end_time]}".to_time
@attendance.update!(update_params)
+
+ # 如果历史签到变为了正在签到,将未创建的学生签到数据补上
+ if a_end_time < Time.current && new_end_time > Time.current
+ create_absence_student_data
+ end
render_ok
end
@@ -86,4 +93,27 @@ class AttendancesController < ApplicationController
def update_params
params.permit(:name, :mode, :attendance_date, :start_time, :end_time)
end
+
+ def create_absence_student_data
+ group_ids = @attendance.course_attendance_groups.pluck(:course_group_id)
+ if group_ids.include?(0)
+ students = @course.students
+ else
+ students = @course.students.where(course_group_id: group_ids)
+ end
+
+ none_users = students.where.not(user_id: @attendance.course_member_attendances.pluck(:user_id))
+
+ attrs = %i[course_attendance_id user_id course_member_id course_id course_group_id created_at updated_at]
+
+ same_attrs = {course_attendance_id: attendance.id, course_id: course.id}
+
+ CourseMemberAttendance.bulk_insert(*attrs) do |worker|
+
+ none_users.each do |student|
+ next if @attendance.course_member_attendances.exists?(user_id: student.user_id)
+ worker.add same_attrs.merge(user_id: student.user_id, course_member_id: student.id, course_group_id: student.course_group_id)
+ end
+ end
+ end
end
\ No newline at end of file
From 7b01bff14facac37e7c33adab9c09227c56034b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Tue, 17 Mar 2020 16:46:50 +0800
Subject: [PATCH 03/16] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A7=86=E9=A2=91?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Video/VideoIndex.js | 2 +-
public/react/src/modules/courses/Video/video.css | 4 +++-
.../src/modules/courses/signin/component/Detailss.js | 5 ++---
.../src/modules/courses/signin/css/signincdi.css | 6 ++++++
.../videostatistics/component/Videostatisticscom.js | 12 +++++++-----
.../component/Videostatisticscomtwo.js | 8 ++++----
.../videostatistics/component/Videostatisticslist.js | 2 +-
7 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js
index 787263cb0..d7b555a2f 100644
--- a/public/react/src/modules/courses/Video/VideoIndex.js
+++ b/public/react/src/modules/courses/Video/VideoIndex.js
@@ -333,7 +333,7 @@ class VideoIndex extends Component {
:
this.props.qiandaoxiangq(false)}> - this.props.qiandaoxiangq(false)}> -
this.props.qiandaoxiangq(false)}>返回
+this.props.qiandaoxiangq(false)}> + this.props.qiandaoxiangq(false)}>
{item && item.name} diff --git a/public/react/src/modules/courses/signin/css/signincdi.css b/public/react/src/modules/courses/signin/css/signincdi.css index 4483b7ae8..50fcceef4 100644 --- a/public/react/src/modules/courses/signin/css/signincdi.css +++ b/public/react/src/modules/courses/signin/css/signincdi.css @@ -111,6 +111,9 @@ .ws46s{ width: 46%; } +.ws47s{ + width: 47%; +} .hs30s{ height: 30%; } @@ -482,3 +485,6 @@ .pd15s{ padding-bottom: 15px !important; } +.ml32{ + margin-left: 32px; +} diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js index ec07abe10..d3d12a97c 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscom.js @@ -35,10 +35,12 @@ class Videostatisticscom extends Component { }}>
this.props.statisticsy(false)} style={{color:'#5091FF'}}> - this.props.statisticsy(false)} style={{color:'#5091FF'}}> +
this.props.statisticsy(false)} > + this.props.statisticsy(false)} >
-+ {this.state.course_second_categories&&this.state.course_second_categories.length>10?
{this.setState({dirSearchValue: e.target.value})}}/>
:""} @@ -1014,7 +1014,7 @@ class Fileslists extends Component{ { course_modules&&course_modules.course_modules.map( (item,key) => { - return item.course_second_categories.filter((item)=> { + return item.course_second_categories&&item.course_second_categories.filter((item)=> { return (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1) }).map((itm,k)=>{ return( @@ -1022,7 +1022,7 @@ class Fileslists extends Component{ ) }) })} - {this.state.course_second_categories.length===0? + {this.state.course_second_categories&&this.state.course_second_categories.length===0?{VHA9LN4&2iCM+1sRdGmzqs+vt4&T?X
zS7? Uc9q|3&yO
z40XJe^Rl{xluCAI`kWvqSf%iSJM j+&x(44H#ggf34U-rosnLp++Os33
zb32{P3DEoRZjR&jcJwo#b)C=gfPWsjyVxH+O5VgT%sh7{WMZM%1!W9`+HRhz(mGN^
z{LTOI!{;lH9s_^!FMV{Gf!95{nkj`ZeDf51>5vOwlf2*eN25*WSqM!5oFLnh7nTqi(C$p{3(
z#0tuS$|kW%k(B`kz*5+7AazY2?{q&l`?1ncWFi!v>+yvTuJ*d;n2^cWNP@4$rSff)
zjNJcK9T6oj5|zTw?vs?v;Eo1lrMaMTKkS$y!jnb@{twxBDoiJslq&>@T;Z?H^pn+R
z@c#99|K&sLABedN{7JHr#@|aw6#p6TOB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