From ba740a815bf06644c3cc02f47041260273cbb23a Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 17 Mar 2020 10:46:09 +0800
Subject: [PATCH 1/9] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admins/courses_controller.rb | 4 ++--
app/models/course.rb | 4 ++++
app/views/admins/courses/index.xlsx.axlsx | 8 ++++++--
app/views/admins/courses/shared/_list.html.erb | 14 +++++++++-----
app/views/admins/courses/shared/_td.html.erb | 6 +++++-
5 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/app/controllers/admins/courses_controller.rb b/app/controllers/admins/courses_controller.rb
index 518054e12..c1093d9e7 100644
--- a/app/controllers/admins/courses_controller.rb
+++ b/app/controllers/admins/courses_controller.rb
@@ -7,13 +7,13 @@ class Admins::CoursesController < Admins::BaseController
courses = Admins::CourseQuery.call(params)
@ended_courses = courses.where(is_end: 1).size
@processed_courses = courses.where(is_end: 0).size
- @courses = paginate courses.includes(:school, :students, :attachments, :homework_commons, teacher: :user_extension)
+ @courses = paginate courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, teacher: :user_extension)
respond_to do |format|
format.js
format.html
format.xlsx do
- @courses = courses.includes(:school, :students, :attachments, :homework_commons, :course_acts, teacher: :user_extension)
+ @courses = courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: :user_extension)
filename = "课堂列表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
render xlsx: 'index', filename: filename
end
diff --git a/app/models/course.rb b/app/models/course.rb
index a0daaea22..cb8e3560d 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -406,6 +406,10 @@ class Course < ApplicationRecord
homework_commons.select{|homework| homework.homework_type == type}.size
end
+ def student_works_count
+ StudentWork.joins(:homework_common).where(homework_commons: {course_id: id}).where("work_status > 0").size
+ end
+
private
#创建课程后,给该用户发送消息
diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx
index 7cab54482..cb8ab0610 100644
--- a/app/views/admins/courses/index.xlsx.axlsx
+++ b/app/views/admins/courses/index.xlsx.axlsx
@@ -3,17 +3,21 @@ wb = xlsx_package.workbook
wb.styles do |s|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
wb.add_worksheet(name: "课堂列表") do |sheet|
- sheet.add_row %w(ID 课堂名称 成员 资源 普通作业 分组作业 实训作业 试卷 评测次数 私有 状态 单位 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
+ sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 作品数 试卷 评测次数 私有 状态 单位 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
@courses.each do |course|
data = [
course.id,
course.name,
- course.course_members_count,
+ course.teacher_course_members.size,
+ course.students.size,
get_attachment_count(course, 0),
+ course.informs.size,
+ course.course_videos.size,
course.course_homework_count(1),
course.course_homework_count(3),
course.course_homework_count(4),
+ course.student_works_count,
course.exercises_count,
course.evaluate_count,
course.is_public == 1 ? "--" : "√",
diff --git a/app/views/admins/courses/shared/_list.html.erb b/app/views/admins/courses/shared/_list.html.erb
index 4105c8153..47839c549 100644
--- a/app/views/admins/courses/shared/_list.html.erb
+++ b/app/views/admins/courses/shared/_list.html.erb
@@ -3,18 +3,22 @@
序号 |
ID |
- 课堂名称 |
- 成员 |
+ 课堂名称 |
+ 老师 |
+ 学生 |
资源 |
+ 公告 |
+ 视频 |
普通作业 |
分组作业 |
实训作业 |
+ 作品数 |
试卷 |
评测次数 |
私有 |
- 状态 |
- 单位 |
- 创建者 |
+ 状态 |
+ 单位 |
+ 创建者 |
<%= sort_tag('创建时间', name: 'created_at', path: admins_courses_path) %> |
首页 |
邮件通知 |
diff --git a/app/views/admins/courses/shared/_td.html.erb b/app/views/admins/courses/shared/_td.html.erb
index 7b72179da..397a69aae 100644
--- a/app/views/admins/courses/shared/_td.html.erb
+++ b/app/views/admins/courses/shared/_td.html.erb
@@ -3,11 +3,15 @@
<%= link_to(course.name, "/classrooms/#{course.id}", target: '_blank') %>
|
-<%= course.course_members_count %> |
+<%= course.teacher_course_members.size %> |
+<%= course.students.size %> |
<%= get_attachment_count(course, 0) %> |
+<%= course.informs.size %> |
+<%= course.course_videos.size %> |
<%= course.course_homework_count("normal") %> |
<%= course.course_homework_count("group") %> |
<%= course.course_homework_count("practice") %> |
+<%= course.student_works_count %> |
<%= course.exercises_count %> |
<%= course.evaluate_count %> |
<%= course.is_public == 1 ? "--" : "√" %> |
From fdef75d144baa4593fb8794b6aefc87ea5305e22 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 17 Mar 2020 11:03:28 +0800
Subject: [PATCH 2/9] =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admins/courses_controller.rb | 2 +-
app/views/admins/courses/index.xlsx.axlsx | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/controllers/admins/courses_controller.rb b/app/controllers/admins/courses_controller.rb
index c1093d9e7..4f82d5d58 100644
--- a/app/controllers/admins/courses_controller.rb
+++ b/app/controllers/admins/courses_controller.rb
@@ -13,7 +13,7 @@ class Admins::CoursesController < Admins::BaseController
format.js
format.html
format.xlsx do
- @courses = courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: :user_extension)
+ @courses = courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: [user_extension: :department])
filename = "课堂列表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
render xlsx: 'index', filename: filename
end
diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx
index cb8ab0610..3185f21be 100644
--- a/app/views/admins/courses/index.xlsx.axlsx
+++ b/app/views/admins/courses/index.xlsx.axlsx
@@ -3,7 +3,7 @@ wb = xlsx_package.workbook
wb.styles do |s|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
wb.add_worksheet(name: "课堂列表") do |sheet|
- sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 作品数 试卷 评测次数 私有 状态 单位 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
+ sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
@courses.each do |course|
data = [
@@ -23,6 +23,7 @@ wb.styles do |s|
course.is_public == 1 ? "--" : "√",
course.is_end ? "已结束" : "正在进行",
course.school&.name,
+ course.teacher&.department_name
course.teacher&.real_name,
course.created_at&.strftime('%Y-%m-%d %H:%M'),
course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--"
From 3fca3d83244b97142b38978497663c6c33312978 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 17 Mar 2020 11:13:11 +0800
Subject: [PATCH 3/9] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/admins/courses/index.xlsx.axlsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx
index 3185f21be..22cf58e4d 100644
--- a/app/views/admins/courses/index.xlsx.axlsx
+++ b/app/views/admins/courses/index.xlsx.axlsx
@@ -23,7 +23,7 @@ wb.styles do |s|
course.is_public == 1 ? "--" : "√",
course.is_end ? "已结束" : "正在进行",
course.school&.name,
- course.teacher&.department_name
+ course.teacher&.department_name,
course.teacher&.real_name,
course.created_at&.strftime('%Y-%m-%d %H:%M'),
course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--"
From fcdd2da413c95169994f53e30a21e66adee702e7 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 17 Mar 2020 11:36:07 +0800
Subject: [PATCH 4/9] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/admins/courses/index.xlsx.axlsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx
index cb8ab0610..f21141de0 100644
--- a/app/views/admins/courses/index.xlsx.axlsx
+++ b/app/views/admins/courses/index.xlsx.axlsx
@@ -14,9 +14,9 @@ wb.styles do |s|
get_attachment_count(course, 0),
course.informs.size,
course.course_videos.size,
- course.course_homework_count(1),
- course.course_homework_count(3),
- course.course_homework_count(4),
+ course.course_homework_count("normal"),
+ course.course_homework_count("group"),
+ course.course_homework_count("practice"),
course.student_works_count,
course.exercises_count,
course.evaluate_count,
From f987bcd5e2e882ac186bd501b6c8d354b0250721 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 17 Mar 2020 11:41:30 +0800
Subject: [PATCH 5/9] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=A2=9E=E5=8A=A0=E7=BB=9F=E8=AE=A1=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/course.rb | 5 +++++
app/views/admins/courses/index.xlsx.axlsx | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/app/models/course.rb b/app/models/course.rb
index cb8e3560d..d4d5387d5 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -406,6 +406,11 @@ class Course < ApplicationRecord
homework_commons.select{|homework| homework.homework_type == type}.size
end
+ # 课堂作业数
+ def published_course_homework_count type
+ homework_commons.select{|homework| homework.homework_type == type && homework.publish_time.present? && homework.publish_time <= Time.now}.size
+ end
+
def student_works_count
StudentWork.joins(:homework_common).where(homework_commons: {course_id: id}).where("work_status > 0").size
end
diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx
index 9690eaa05..bc6581972 100644
--- a/app/views/admins/courses/index.xlsx.axlsx
+++ b/app/views/admins/courses/index.xlsx.axlsx
@@ -3,7 +3,7 @@ wb = xlsx_package.workbook
wb.styles do |s|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
wb.add_worksheet(name: "课堂列表") do |sheet|
- sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
+ sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
@courses.each do |course|
data = [
@@ -17,6 +17,7 @@ wb.styles do |s|
course.course_homework_count("normal"),
course.course_homework_count("group"),
course.course_homework_count("practice"),
+ course.published_course_homework_count("practice"),
course.student_works_count,
course.exercises_count,
course.evaluate_count,
From a3416e0171875a7c0d56c8b0a34c20256f73a157 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 13:50:15 +0800
Subject: [PATCH 6/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../component/Videostatisticscomtwo.js | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js
index 8893eb07e..054e2ac86 100644
--- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js
+++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js
@@ -458,7 +458,18 @@ class Videostatisticscomtwo extends Component {
mytitle=this.props&&this.props.mytitle;
}else{
- mytitle=this.state.data[0].title;
+ if(this.state.data){
+ if(this.state.data.length>0){
+ try {
+ if(this.state.data[0].title){
+ mytitle=this.state.data[0].title;
+ }
+ }catch (e) {
+
+ }
+
+ }
+ }
}
return (
From ca7a02d7ac38967a52dbcc40330c959eaf62ec2b 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 14:06:23 +0800
Subject: [PATCH 7/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../shixunHomework/Listofworksstudentone.js | 70 ++-----------------
1 file changed, 5 insertions(+), 65 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index cd8061906..f6e82d396 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -3364,9 +3364,6 @@ class Listofworksstudentone extends Component {
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
- // if(response.data.message!==undefined){
- // return;
- // }
setTimeout(() => {
this.setState({
loadingstate: true
@@ -3382,10 +3379,8 @@ class Listofworksstudentone extends Component {
} catch (e) {
}
-
- }, 2500);
+ }, 500);
}
- // this.props.history.replace( matchurl );
}
}).catch((error) => {
console.log(error)
@@ -3672,27 +3667,9 @@ class Listofworksstudentone extends Component {
- {/*{course_is_end===true?"":
*/}
- {/*{teacherdata&&teacherdata.update_score===true&&computeTimetype===true?*/}
- {/* (this.props.isNotMember()===false?*/}
- {/* 查看最新成绩*/}
- {/*
:""):*/}
- {/* teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
- {/* (this.props.isNotMember()===false?*/}
- {/* 查看最新成绩*/}
- {/*
:"")*/}
- {/*}*/}
- {/*}*/}
+
- {/* this.onSearchKeywordKeyUpt(e)}*/}
- {/* onInput={this.inputSearchValuest}*/}
- {/* onSearch={this.searchValuest}*/}
- {/*>*/}
+
{publicSearchs("请输入姓名或学号搜索",this.searchValuest,this.inputSearchValuest,this.inputSearchValuest)}
@@ -3993,27 +3970,7 @@ class Listofworksstudentone extends Component {
- {/*
计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}*/}
- {/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":
*/}
- {/* {computeTimetype===true?*/}
- {/* (this.props.isNotMember()===false?*/}
- {/* (*/}
- {/* teacherdata&&teacherdata.update_score===true?*/}
- {/* */}
- {/* 查看最新成绩*/}
- {/*
*/}
- {/* :""*/}
- {/* )*/}
- {/* :"")*/}
- {/* :*/}
- {/* (teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
- {/* this.props.isNotMember()===false?*/}
- {/* */}
- {/* 查看最新成绩*/}
- {/*
*/}
- {/* :"")*/}
- {/* }*/}
- {/*}*/}
+
@@ -4238,24 +4195,7 @@ class Listofworksstudentone extends Component {
- {/*
计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}*/}
- {/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":
*/}
- {/* {computeTimetype===true?*/}
-
- {/* (this.props.isNotMember()===false?*/}
- {/* (*/}
- {/* teacherdata&&teacherdata.update_score===true?*/}
- {/* */}
- {/* 查看最新成绩*/}
- {/*
:""*/}
- {/* )*/}
- {/* :""):*/}
- {/* teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
- {/* (this.props.isNotMember()===false?*/}
- {/* 查看最新成绩*/}
- {/*
:"")*/}
- {/* }*/}
- {/*}*/}
+
From be50b57aae5a7cc8578596d49e5deb8559f2abfd Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 17 Mar 2020 14:12:27 +0800
Subject: [PATCH 8/9] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E8=BF=9E=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/left_banner.json.jbuilder | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/views/courses/left_banner.json.jbuilder b/app/views/courses/left_banner.json.jbuilder
index b53dbbb79..efc40f5ef 100644
--- a/app/views/courses/left_banner.json.jbuilder
+++ b/app/views/courses/left_banner.json.jbuilder
@@ -30,6 +30,7 @@ json.course_modules @course_modules.each do |mod|
json.third_category category.children do |child|
json.partial! "category_info", category: child
+ json.parent_id child.parent_id
end
end
end
From 7b32ae5c30be796a6c326f4842d6c8746d37a462 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 14:15:45 +0800
Subject: [PATCH 9/9] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AE=A1=E7=AE=97?=
=?UTF-8?q?=E6=97=B6=E9=97=B4=20=E6=97=B6=E9=97=B4=E9=95=BF=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworksstudentone.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index f6e82d396..fb9c244cd 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -2519,7 +2519,6 @@ class Listofworksstudentone extends Component {
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
- setTimeout(() => {
this.props.showNotification(`${response.data.message}`);
// var homeworkid = this.props.match.params.homeworkid;
this.Getalistofworks(homeworkid, false);
@@ -2529,12 +2528,14 @@ class Listofworksstudentone extends Component {
} catch (e) {
}
- }, 2500);
}
}
// this.Getalistofworkstwo("", "", "", "", 1, 20);
}).catch((error) => {
console.log(error)
+ this.setState({
+ computeTimetype:true
+ })
});
}
@@ -3364,7 +3365,6 @@ class Listofworksstudentone extends Component {
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
- setTimeout(() => {
this.setState({
loadingstate: true
})
@@ -3379,11 +3379,13 @@ class Listofworksstudentone extends Component {
} catch (e) {
}
- }, 500);
}
}
}).catch((error) => {
console.log(error)
+ this.setState({
+ computeTimetype:true
+ })
});
};