From 31d5e0ccc2217ebfcf5419e1e8a1801fddb07be6 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Thu, 10 Oct 2019 17:13:21 +0800
Subject: [PATCH 01/20] tea
---
.../modules/courses/members/ChangeRolePop.js | 0
.../modules/courses/members/studentsList.js | 2 +-
.../modules/courses/members/teacherList.js | 37 ++++++++++++++-----
3 files changed, 29 insertions(+), 10 deletions(-)
create mode 100644 public/react/src/modules/courses/members/ChangeRolePop.js
diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index 1b0b19d6f..cba7dbf54 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Divider } from "antd";
+import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Divider, Popconfirm } from "antd";
import ClipboardJS from 'clipboard'
import '../css/Courses.css'
import '../css/members.css'
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index 86ae7aa0b..d3f4521b3 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import { Input,Checkbox,Table, Divider, Tooltip,Spin, Menu } from "antd";
+import { Input,Checkbox,Table, Divider, Tooltip,Spin, Menu, Popconfirm } from "antd";
import CourseLayoutcomponent from '../common/CourseLayoutComponent'
import NoneData from "../coursesPublic/NoneData"
@@ -150,15 +150,34 @@ function buildColumns(that) {
)
} else {
return (
-
- {record.role != ROLE_ADMIN && that.onDelete(record)} style={'grey'}>删除}
- {(record.role == ROLE_TEACHER || record.role == ROLE_TEACHER_ASSISTANT || isAdminOrCreator) && record.role != ROLE_ADMIN
- && }
- { record.role == ROLE_TEACHER ? that.changeToAssistant(record)}>变更为助教 : '' }
- { record.role == ROLE_TEACHER_ASSISTANT ? that.changeToTeacher(record)}>变更为教师 : '' }
- { record.role == ROLE_ADMIN && isAdminOrCreator ? that.showChangeAdminModal(record)}>更换管理员 : '' }
+
+ 删除
+
+ 管理员
+ 助教
+ 学生
+
+ }
+ >
+ 修改角色
+
+
+
+
+ //
+ // {record.role != ROLE_ADMIN && that.onDelete(record)} style={'grey'}>删除}
+ // {(record.role == ROLE_TEACHER || record.role == ROLE_TEACHER_ASSISTANT || isAdminOrCreator) && record.role != ROLE_ADMIN
+ // && }
+ // { record.role == ROLE_TEACHER ? that.changeToAssistant(record)}>变更为助教 : '' }
+ // { record.role == ROLE_TEACHER_ASSISTANT ? that.changeToTeacher(record)}>变更为教师 : '' }
+ // { record.role == ROLE_ADMIN && isAdminOrCreator ? that.showChangeAdminModal(record)}>更换管理员 : '' }
- )
+ //
+ )
}
},
From a91cf878c0bb5e18f406842cccd6f88779b1a745 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 11 Oct 2019 09:44:04 +0800
Subject: [PATCH 02/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworksstudentone.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 0cd04f5d5..5eed392d5 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -2627,9 +2627,11 @@ class Listofworksstudentone extends Component {
// return
// }
this.setState({
- loadingstate: true
+ loadingstate: true,
+ page:1,
+ limit:20,
})
- this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, this.state.page, this.state.limit);
+ this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, 1,20);
// console.log(value)
@@ -2641,9 +2643,11 @@ class Listofworksstudentone extends Component {
// this.onSearch();
// console.log("使用了回车键");
this.setState({
- loadingstate: true
+ loadingstate: true,
+ page:1,
+ limit:20,
})
- this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit);
+ this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1,20);
}
}
//排序
From 764d0cc071242da038549a43e960234d78514698 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 11 Oct 2019 09:48:49 +0800
Subject: [PATCH 03/20] =?UTF-8?q?=E6=AF=95=E8=AE=BE=E4=BB=BB=E5=8A=A1?=
=?UTF-8?q?=E7=9A=84=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/graduation_tasks/_public_navigation.json.jbuilder | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/views/graduation_tasks/_public_navigation.json.jbuilder b/app/views/graduation_tasks/_public_navigation.json.jbuilder
index 00280c31b..992d03fd8 100644
--- a/app/views/graduation_tasks/_public_navigation.json.jbuilder
+++ b/app/views/graduation_tasks/_public_navigation.json.jbuilder
@@ -2,4 +2,5 @@ json.partial! "graduation_topics/show_navigation", locals: {course: course, grad
json.task_status task_curr_status(graduation, course)[:status]
json.task_name graduation.name
json.task_id graduation.id
-json.status graduation.status
\ No newline at end of file
+json.status graduation.status
+json.end_time graduation.end_time
\ No newline at end of file
From e67b8e3404cc61a3087603e469478f093937d0b8 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 11 Oct 2019 09:56:04 +0800
Subject: [PATCH 04/20] style2
---
public/react/src/common/course/WordsBtn.js | 14 ++++++++++----
.../src/modules/courses/members/teacherList.js | 15 +++++++++------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/public/react/src/common/course/WordsBtn.js b/public/react/src/common/course/WordsBtn.js
index 58b000338..85a85cfb6 100644
--- a/public/react/src/common/course/WordsBtn.js
+++ b/public/react/src/common/course/WordsBtn.js
@@ -8,15 +8,21 @@ class WordsBtn extends Component {
}
render() {
- let{to, href,targets}=this.props
+ let{to, href,targets, style2 }=this.props
return(
{
to==undefined&&targets==undefined ?
- {this.props.children}:
- targets!=undefined? {this.props.children}
+ {this.props.children}:
+ targets!=undefined? {this.props.children}
:
- {this.props.children}
+ {this.props.children}
}
)
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index d3f4521b3..1dd8cd3f9 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -117,7 +117,7 @@ function buildColumns(that) {
const hasGraduationModule = that.hasGraduationModule()
if (hasGraduationModule && showSorter) {
columns.push({
- title: '答辩组',
+ title: '所在答辩组',
// width: 90,
sorter: showSorter,
sortDirections: sortDirections,
@@ -141,6 +141,9 @@ function buildColumns(that) {
width: 150,
align:'center',
render: (text, record) => {
+ const isAdmin = record.role == ROLE_ADMIN
+ const isTeacher = record.role == ROLE_TEACHER
+ const isAssitant = record.role == ROLE_TEACHER_ASSISTANT
if (record.application_id) {
return (
@@ -151,19 +154,19 @@ function buildColumns(that) {
} else {
return (
- 删除
+ that.onDelete(record)} style={'grey'}>删除
- 管理员
- 助教
+ 管理员
+ 助教
学生
}
>
- 修改角色
+ 修改角色
From d2b2384b9477a93980933c05a4549a81eb0fd900 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 11 Oct 2019 11:05:16 +0800
Subject: [PATCH 05/20] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/members/ChangeRolePop.js | 72 +++++++++++++++++++
.../modules/courses/members/teacherList.js | 18 ++++-
2 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js
index e69de29bb..44dfc28fc 100644
--- a/public/react/src/modules/courses/members/ChangeRolePop.js
+++ b/public/react/src/modules/courses/members/ChangeRolePop.js
@@ -0,0 +1,72 @@
+import React, { useState, useEffect } from 'react'
+import { trigger, WordsBtn } from 'educoder'
+import { Input, Checkbox, Popconfirm } from "antd";
+import axios from 'axios'
+
+/**
+ 角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
+*/
+function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification }) {
+ const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles)
+ useEffect(() => {
+ setCheckBoxRoles(member_roles)
+ }, [member_roles])
+ function onCheckBoxChange(val) {
+ console.log(val)
+
+ const isTeacher = checkBoxRoles.indexOf('PROFESSOR')
+ const isAssitant = checkBoxRoles.indexOf('ASSISTANT_PROFESSOR')
+ const isTeacherNew = val.indexOf('PROFESSOR')
+ const isAssitantNew = val.indexOf('ASSISTANT_PROFESSOR')
+ if (isTeacherNew > -1 && isTeacher == -1 && isAssitantNew > -1) {
+ val.splice(isAssitantNew, 1)
+ }
+ if (isAssitantNew > -1 && isAssitant == -1 && isTeacherNew > -1) {
+ val.splice(isTeacherNew, 1)
+ }
+
+ setCheckBoxRoles(val)
+ }
+ function onCancel() {
+ setCheckBoxRoles(member_roles)
+ }
+ const onConfirm = async () => {
+ if (checkBoxRoles && checkBoxRoles.length == 0) {
+ showNotification('请至少选择一个角色')
+ return;
+ }
+ const url = `/courses/${courseId}/change_member_role.json`
+ const response = await axios.post(url, {
+ roles: checkBoxRoles,
+ user_id: record.user_id
+ })
+ if (response.data.status == 0) {
+ onChangeRoleSuccess()
+ }
+ console.log(response)
+ }
+ const isAdmin = checkBoxRoles.indexOf('CREATOR') != -1
+ const isTeacher = checkBoxRoles.indexOf('PROFESSOR') != -1
+ const isAssitant = checkBoxRoles.indexOf('ASSISTANT_PROFESSOR') != -1
+ const isStudent = checkBoxRoles.indexOf('STUDENT') != -1
+ return (
+
+ {isAdmin && 管理员}
+ {!isAdmin && 教师}
+ 助教
+ 学生
+
+ }
+ >
+ 修改角色
+
+ )
+}
+export default ChangeRolePop
\ No newline at end of file
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index 1dd8cd3f9..72b667300 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -24,6 +24,7 @@ import AddAdminModal from './modal/AddAdminModal'
import CourseGroupChooserModal from './modal/CourseGroupChooserModal'
import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from './common'
import CourseGroupChooser from './CourseGroupChooser'
+import ChangeRolePop from './ChangeRolePop'
const Search = Input.Search;
const ROLE_ADMIN = "管理员"
@@ -38,6 +39,8 @@ function buildColumns(that) {
const isAdminOrTeacher = that.props.isAdminOrTeacher()
const { course_groups, filterKey } = that.state
const showSorter = filterKey == '1'
+ const courseId = that.props.match.params.coursesId
+
const columns = [{
title: '序号',
dataIndex: 'name',
@@ -152,10 +155,18 @@ function buildColumns(that) {
that.onAgree(record)} style={{color: '#4CACFF'}}>同意
)
} else {
+
return (
that.onDelete(record)} style={'grey'}>删除
-
+ {/*
修改角色
-
+ */}
@@ -366,6 +377,9 @@ class studentsList extends Component{
console.log(error);
});
}
+ onChangeRoleSuccess = () => {
+ this.fetchAll()
+ }
fetchAll = async (argPage) => {
this.setState({
isSpin:true
From 3ed24f333d611fa69ad87defdfee4671b4045584 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 11 Oct 2019 11:09:59 +0800
Subject: [PATCH 06/20] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/shixunHomework/ShixunhomeWorkItem.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index 557e1ca89..4ebe801c5 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -354,8 +354,8 @@ class ShixunhomeWorkItem extends Component{
{/* {discussMessage.author.name} */}
{ discussMessage.author && {discussMessage.author} }
- {discussMessage.commit_count===undefined?"":{discussMessage.commit_count} 已交}
- {discussMessage.uncommit_count===undefined?"":{discussMessage.uncommit_count} 未交}
+ {discussMessage.commit_count===undefined?"":{discussMessage.commit_count} 已开始做题}
+ {discussMessage.uncommit_count===undefined?"":{discussMessage.uncommit_count} 未开始做题}
{/*{discussMessage.replies_count} 3 未评*/}
{
From 4846cb348747d9491ea886802a338c06729a38bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 11 Oct 2019 11:24:46 +0800
Subject: [PATCH 07/20] =?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/shixunHomework/ShixunhomeWorkItem.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index 4ebe801c5..8b63a3471 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -381,7 +381,7 @@ class ShixunhomeWorkItem extends Component{
{
discussMessage && discussMessage.upper_category_name &&
22 }>
- { {discussMessage.upper_category_name}}
+ { {discussMessage.upper_category_name}}
}
From 94852128f519468448c4c1eb22bff8b2520c9c39 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Fri, 11 Oct 2019 11:29:52 +0800
Subject: [PATCH 08/20] add_commit_method_to exercise_user
---
app/controllers/admins/shixun_settings_controller.rb | 2 +-
app/controllers/exercises_controller.rb | 3 ++-
app/jobs/end_exercise_calculate_job.rb | 3 ++-
app/models/exercise_user.rb | 1 +
app/models/shixun.rb | 1 +
app/tasks/exercise_publish_task.rb | 6 ++++--
app/views/exercises/_exercise_user.json.jbuilder | 1 +
app/views/exercises/_user_exercise_info.json.jbuilder | 1 +
.../20191011030441_add_commit_method_to_exercise_user.rb | 5 +++++
9 files changed, 18 insertions(+), 5 deletions(-)
create mode 100644 db/migrate/20191011030441_add_commit_method_to_exercise_user.rb
diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb
index 0ccd5725d..9202ccce6 100644
--- a/app/controllers/admins/shixun_settings_controller.rb
+++ b/app/controllers/admins/shixun_settings_controller.rb
@@ -92,6 +92,6 @@ class Admins::ShixunSettingsController < Admins::BaseController
end
def setting_params
- params.permit(:use_scope,:excute_time,:close,:status,:can_copy,:webssh,:hidden,:homepage_show,:task_pass,:code_hidden,:id,tag_repertoires:[])
+ params.permit(:use_scope,:excute_time,:close,:status,:can_copy,:webssh,:hidden,:homepage_show,:task_pass,:code_hidden,:page_no, :id,tag_repertoires:[])
end
end
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index f2e8508f0..30f09cc64 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -1088,7 +1088,8 @@ class ExercisesController < ApplicationController
:end_at => Time.now,
:objective_score => objective_score,
:score => total_score,
- :subjective_score => subjective_score
+ :subjective_score => subjective_score,
+ :commit_method => @answer_committed_user&.commit_method.to_i > 0 ? @answer_committed_user&.commit_method.to_i : params[:commit_method].to_i
}
@answer_committed_user.update_attributes(commit_option)
CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id)
diff --git a/app/jobs/end_exercise_calculate_job.rb b/app/jobs/end_exercise_calculate_job.rb
index 39d8bb1db..b6d8e491e 100644
--- a/app/jobs/end_exercise_calculate_job.rb
+++ b/app/jobs/end_exercise_calculate_job.rb
@@ -19,7 +19,8 @@ class EndExerciseCalculateJob < ApplicationJob
:end_at => Time.now,
:objective_score => objective_score,
:score => total_score,
- :subjective_score => user_sub_score
+ :subjective_score => user_sub_score,
+ :commit_method => user&.commit_method.to_i > 0 ? user&.commit_method.to_i : 4
}
user.update_attributes(commit_option)
end
diff --git a/app/models/exercise_user.rb b/app/models/exercise_user.rb
index 84f042b25..0f2e8456e 100644
--- a/app/models/exercise_user.rb
+++ b/app/models/exercise_user.rb
@@ -1,4 +1,5 @@
class ExerciseUser < ApplicationRecord
+ # commit_method 0 为默认, 1为学生的手动提交,2为倒计时结束后自动提交,3为试卷定时截止的自动提交, 4为教师手动的立即截止
belongs_to :user
belongs_to :exercise
diff --git a/app/models/shixun.rb b/app/models/shixun.rb
index 4912ea15a..0cdb2e82b 100644
--- a/app/models/shixun.rb
+++ b/app/models/shixun.rb
@@ -1,5 +1,6 @@
class Shixun < ApplicationRecord
include Searchable::Shixun
+ attr_accessor :page_no #管理员页面 实训配置更新状态时,需要接受page_no参数
# status: 0:编辑 1:申请发布 2:正式发布 3:关闭 -1:软删除
# hide_code: 隐藏代码窗口
diff --git a/app/tasks/exercise_publish_task.rb b/app/tasks/exercise_publish_task.rb
index 220512664..a7b533d05 100644
--- a/app/tasks/exercise_publish_task.rb
+++ b/app/tasks/exercise_publish_task.rb
@@ -66,7 +66,8 @@ class ExercisePublishTask
:end_at => Time.now,
:objective_score => s_score,
:score => total_score,
- :subjective_score => subjective_score
+ :subjective_score => subjective_score,
+ :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3
}
exercise_user.update_attributes(commit_option)
end
@@ -108,7 +109,8 @@ class ExercisePublishTask
:end_at => Time.now,
:objective_score => s_score,
:score => total_score,
- :subjective_score => subjective_score
+ :subjective_score => subjective_score,
+ :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3
}
exercise_user.update_attributes(commit_option)
end
diff --git a/app/views/exercises/_exercise_user.json.jbuilder b/app/views/exercises/_exercise_user.json.jbuilder
index d41fb9e20..5f00bbd70 100644
--- a/app/views/exercises/_exercise_user.json.jbuilder
+++ b/app/views/exercises/_exercise_user.json.jbuilder
@@ -8,6 +8,7 @@ json.user_group_name ex_user_info[:user_group_name]
json.student_id ex_user_info[:student_id]
json.commit_status ex_user_info[:commit_status]
json.end_at ex_user_info[:end_at]
+json.commit_method exercise_user&.commit_method.to_i
if subjective_type == 1
json.objective_score ex_user_info[:ex_object_score]
json.subjective_score ex_user_info[:ex_subject_score]
diff --git a/app/views/exercises/_user_exercise_info.json.jbuilder b/app/views/exercises/_user_exercise_info.json.jbuilder
index 0d21cc593..bdac3a985 100644
--- a/app/views/exercises/_user_exercise_info.json.jbuilder
+++ b/app/views/exercises/_user_exercise_info.json.jbuilder
@@ -9,6 +9,7 @@ json.exercise_answer_user do
json.user_id ex_answerer.id
json.login ex_answerer.login
if exercise_user.present?
+ json.commit_method exercise_user&.commit_method.to_i
json.start_at exercise_user.start_at
json.score exercise_user.score.present? ? exercise_user.score.round(1).to_s : "0.0"
end
diff --git a/db/migrate/20191011030441_add_commit_method_to_exercise_user.rb b/db/migrate/20191011030441_add_commit_method_to_exercise_user.rb
new file mode 100644
index 000000000..060e5eb5f
--- /dev/null
+++ b/db/migrate/20191011030441_add_commit_method_to_exercise_user.rb
@@ -0,0 +1,5 @@
+class AddCommitMethodToExerciseUser < ActiveRecord::Migration[5.2]
+ def change
+ add_column :exercise_users, :commit_method, :integer, :default => 0
+ end
+end
From 0629bc15af5cf4801e873f9bca2b052d248a81d7 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Fri, 11 Oct 2019 13:49:08 +0800
Subject: [PATCH 09/20] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E6=8F=90?=
=?UTF-8?q?=E4=BA=A4=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/exercises_controller.rb | 35 ++++++++++++++++++-------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index 8f7d43196..e76148f20 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -1077,12 +1077,22 @@ class ExercisesController < ApplicationController
def commit_exercise
ActiveRecord::Base.transaction do
begin
- if @user_course_identity > Course::ASSISTANT_PROFESSOR #为学生时
- objective_score = calculate_student_score(@exercise,current_user)[:total_score]
- subjective_score = @answer_committed_user.subjective_score
- total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
- total_score = objective_score + total_score_subjective_score
- commit_option = {
+ can_commit_exercise = false
+ if (@user_course_identity > Course::ASSISTANT_PROFESSOR) && params[:commit_method].present? #为学生时
+ if params[:commit_method].to_i == 2 #自动提交时
+ user_left_time = get_exercise_left_time(@exercise,current_user)
+ if user_left_time.to_i <= 0
+ can_commit_exercise = true
+ end
+ else
+ can_commit_exercise = true
+ end
+ if can_commit_exercise
+ objective_score = calculate_student_score(@exercise,current_user)[:total_score]
+ subjective_score = @answer_committed_user.subjective_score
+ total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
+ total_score = objective_score + total_score_subjective_score
+ commit_option = {
:status => 1,
:commit_status => 1,
:end_at => Time.now,
@@ -1090,10 +1100,15 @@ class ExercisesController < ApplicationController
:score => total_score,
:subjective_score => subjective_score,
:commit_method => @answer_committed_user&.commit_method.to_i > 0 ? @answer_committed_user&.commit_method.to_i : params[:commit_method].to_i
- }
- @answer_committed_user.update_attributes(commit_option)
- CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id)
- normal_status(0,"试卷提交成功!")
+ }
+ @answer_committed_user.update_attributes(commit_option)
+ CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id)
+ normal_status(0,"试卷提交成功!")
+ else
+ normal_status(-1,"提交失败,请重试!")
+ end
+ else
+ normal_status(-1,"提交失败,请重试!")
end
rescue Exception => e
uid_logger_error(e.message)
From c4c7380162ff70c491aba83bbb81f5986a216862 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 11 Oct 2019 13:58:54 +0800
Subject: [PATCH 10/20] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=A4=E5=8D=B7?=
=?UTF-8?q?=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/exercise/ExerciseReviewAndAnswer.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
index f45de9b64..59072a862 100644
--- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
+++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
@@ -129,7 +129,9 @@ class ExerciseReviewAndAnswer extends Component{
autoCommitExercise=()=>{
let eId=this.props.match.params.Id;
let url=`/exercises/${eId}/commit_exercise.json`;
- axios.post(url).then((result)=>{
+ axios.post(url,{
+ commit_method:2
+ }).then((result)=>{
if(result){
this.setState({
Modalstype:true,
@@ -139,6 +141,7 @@ class ExerciseReviewAndAnswer extends Component{
ModalSave:this.sureCommit,
Loadtype:true
})
+ this.props.showNotification(`${result.data.message}`);
}
}).catch((error)=>{
console.log(error);
@@ -485,7 +488,9 @@ class ExerciseReviewAndAnswer extends Component{
//交卷
let eId=this.props.match.params.Id;
let url=`/exercises/${eId}/commit_exercise.json`;
- axios.post(url).then((result)=>{
+ axios.post(url,{
+ commit_method:1
+ }).then((result)=>{
if(result){
this.setState({
Modalstype:false,
From 4761f518d789b52f23d0831664bf44e44559df01 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 11 Oct 2019 14:00:11 +0800
Subject: [PATCH 11/20] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/css/members.css | 4 +
.../modules/courses/members/studentsList.css | 3 +
.../modules/courses/members/studentsList.js | 124 +++++++++++++-----
3 files changed, 100 insertions(+), 31 deletions(-)
create mode 100644 public/react/src/modules/courses/members/studentsList.css
diff --git a/public/react/src/modules/courses/css/members.css b/public/react/src/modules/courses/css/members.css
index 67524d130..ab7effaa0 100644
--- a/public/react/src/modules/courses/css/members.css
+++ b/public/react/src/modules/courses/css/members.css
@@ -84,4 +84,8 @@
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
+}
+
+.changeRolePop .ant-checkbox-group {
+ width: 230px !important;
}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/members/studentsList.css b/public/react/src/modules/courses/members/studentsList.css
new file mode 100644
index 000000000..49a81fa32
--- /dev/null
+++ b/public/react/src/modules/courses/members/studentsList.css
@@ -0,0 +1,3 @@
+.stu_table .ant-table-thead > tr > th, .stu_table .ant-table-tbody > tr > td {
+ padding: 14px 8px;
+}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index cba7dbf54..5f614cfbc 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -14,6 +14,8 @@ import _ from 'lodash'
import NoneData from "../coursesPublic/NoneData"
import DownloadMessageysl from "../../modals/DownloadMessageysl";
import CreateGroupByImportModal from './modal/CreateGroupByImportModal'
+import ChangeRolePop from './ChangeRolePop'
+import "./studentsList.css"
const Search =Input.Search;
const TYPE_STUDENTS = 1
@@ -22,6 +24,7 @@ const TYPE_COURSE_GOURP_CHILD = 3
const buildColumns = (that,isParent) => {
const { course_groups , sortedInfo } = that.state
let showSorter = isParent==true
+ const courseId = that.props.match.params.coursesId
const columns=[{
title: '序号',
dataIndex: 'id',
@@ -32,19 +35,21 @@ const buildColumns = (that,isParent) => {
render: (id, student, index) => {
return (that.state.page - 1) * 20 + index + 1
}
- }, {
- title: '用户id',
- dataIndex: 'login',
- key: 'login',
- align:'center',
- width:"10%",
- className:"color-grey-6",
- render: (login, record) => {
- return 10 ? login : ''}
- >{login}
- }
- }, {
+ },
+ // {
+ // title: '用户id',
+ // dataIndex: 'login',
+ // key: 'login',
+ // align:'center',
+ // width:"10%",
+ // className:"color-grey-6",
+ // render: (login, record) => {
+ // return 10 ? login : ''}
+ // >{login}
+ // }
+ // },
+ {
title: '姓名',
dataIndex: 'name',
key: 'name',
@@ -69,14 +74,45 @@ const buildColumns = (that,isParent) => {
return 10 ? student_id : ''}
style={{maxWidth: '160px'}} >{student_id}
}
- }];
+ }
+ , {
+ title: '手机号',
+ dataIndex: 'user_phone',
+ key: 'user_phone',
+ align:'center',
+ width:"10%",
+ className:"color-grey-6",
+ // sorter: true,
+ // sortDirections: sortDirections,
+ // sortOrder: sortedInfo.columnKey === 'user_phone' && sortedInfo.order,
+ render: (user_phone, record) => {
+ return 10 ? user_phone : ''}
+ style={{maxWidth: '160px'}} >{user_phone}
+ }
+ }
+ , {
+ title: '邮箱',
+ dataIndex: 'user_mail',
+ key: 'user_mail',
+ align:'center',
+ width:"10%",
+ className:"color-grey-6",
+ // sorter: true,
+ // sortDirections: sortDirections,
+ // sortOrder: sortedInfo.columnKey === 'user_mail' && sortedInfo.order,
+ render: (user_mail, record) => {
+ return 10 ? user_mail : ''}
+ style={{maxWidth: '160px'}} >{user_mail}
+ }
+ }
+ ];
if (course_groups && course_groups.length) {
columns.push({
title: '分班',
dataIndex: 'course_group_name',
key: 'course_group_name',
align:'center',
- width:"40%",
+ width:"25%",
className:"color-grey-6",
sorter:showSorter,
sortDirections: sortDirections,
@@ -95,14 +131,36 @@ const buildColumns = (that,isParent) => {
const isAdmin = that.props.isAdmin()
if (isAdmin) {
columns.unshift({
- title: '',
- dataIndex: 'check',
- key: 'check',
- render: (text, item) => {
- return
- },
- width:"5%"
- })
+ title: '',
+ dataIndex: 'check',
+ key: 'check',
+ render: (text, item) => {
+ return
+ },
+ width:"5%"
+ })
+
+ columns.push({
+ title: '操作',
+ key: 'action',
+ width: '18%',
+ align:'center',
+ render: (text, record) => {
+ return (
+
+ that.onDelete(record)} style={'grey'}>删除学生
+
+
+ )
+ },
+ })
+
}
return columns;
@@ -242,7 +300,9 @@ class studentsList extends Component{
onChange=()=>{
}
-
+ onChangeRoleSuccess = () => {
+ this.fetchAll()
+ }
componentDidMount() {
this.setState({
isSpin:true
@@ -451,11 +511,13 @@ class studentsList extends Component{
}
}
// 多选
- onDelete = () => {
- const len = this.state.checkBoxValues.length
- if (len == 0) {
- this.props.showNotification('请先从列表选择要删除的学生')
- return;
+ onDelete = (record) => {
+ if (!record) {
+ const len = this.state.checkBoxValues.length
+ if (len == 0) {
+ this.props.showNotification('请先从列表选择要删除的学生')
+ return;
+ }
}
this.props.confirm({
@@ -465,7 +527,7 @@ class studentsList extends Component{
let id = this.props.match.params.coursesId
let url=`/courses/${id}/delete_from_course.json`;
axios.post((url), {
- students: this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
+ students: [{course_member_id: record.user_id}] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
}).then((result)=>{
if (result.data.status == 0) {
this.props.showNotification('删除成功')
@@ -701,7 +763,7 @@ class studentsList extends Component{
{isAdmin &&
已选 {checkBoxValues.length} 个}
- {isAdmin &&
删除}
+ {/* {isAdmin &&
删除} */}
{isAdmin &&
移动到...
From 8191926264022d362aa757d4c5522a3b21873d75 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 11 Oct 2019 14:11:03 +0800
Subject: [PATCH 12/20] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E3=80=81=E9=97=AE?=
=?UTF-8?q?=E5=8D=B7=E7=9A=84=E7=AB=8B=E5=8D=B3=E5=8F=91=E5=B8=83=E5=BC=B9?=
=?UTF-8?q?=E6=A1=86=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../homework_commons_controller.rb | 53 +++++++++++++++----
app/controllers/polls_controller.rb | 48 ++++++++++++-----
.../publish_groups.json.jbuilder | 4 +-
app/views/polls/publish_groups.json.jbuilder | 6 +++
config/routes.rb | 1 +
5 files changed, 88 insertions(+), 24 deletions(-)
create mode 100644 app/views/polls/publish_groups.json.jbuilder
diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb
index 0ed5730a4..70f0345b1 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -1036,6 +1036,7 @@ class HomeworkCommonsController < ApplicationController
# 可立即发布的分班:当前用户管理的分班去除已发布的分班
group_ids = @course.charge_group_ids(@current_user) - @homework.homework_group_settings.group_published.pluck(:course_group_id)
@course_groups = @course.course_groups.where(id: group_ids)
+ @group_settings = @homework.homework_group_settings.where(id: group_ids)
else
tip_exception("没有可发布的分班")
end
@@ -1043,16 +1044,28 @@ class HomeworkCommonsController < ApplicationController
def publish_homework
tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0
- tip_exception("缺少截止时间参数") if params[:end_time].blank?
- tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
- tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
- @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
+ if params[:detail].blank?
+ tip_exception("缺少截止时间参数") if params[:end_time].blank?
+ tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
+ tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
+ else
+ group_end_times = params[:group_end_times].reject(&:blank?).map{|time| time.to_time}
+ group_ids = params[:group_ids].reject(&:blank?)
+ tip_exception("缺少截止时间参数") if group_end_times.blank?
+ tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length
+ group_end_times.each do |time|
+ tip_exception("分班截止时间不能早于当前时间") if time <= Time.now
+ tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ @course.end_date.present? && time > @course.end_date.end_of_day
+ end
+ end
homeworks = @course.homework_commons.where(id: params[:homework_ids])
homeworks = homeworks.includes(:homework_group_settings, :homework_detail_manual)
charge_group_ids = @course.charge_group_ids(current_user)
- publish_groups = charge_group_ids & params[:group_ids] if params[:group_ids]
+ publish_groups = charge_group_ids & group_ids if group_ids
# ActiveRecord::Base.transaction do
begin
@@ -1062,18 +1075,26 @@ class HomeworkCommonsController < ApplicationController
if !params[:group_ids].blank?
# 全选即统一设置,unified_setting为true
- if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size
+ if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size &&
+ ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?)
homework.homework_group_settings.destroy_all
homework.unified_setting = true
- homework.end_time = params[:end_time]
+ homework.end_time = params[:detail] ? group_end_times.max : params[:end_time]
else
homework.unified_setting = false
# 创建作业分班设置:homework_group_setting
create_homework_group_settings(homework)
# 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数
- homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now,
- end_time: params[:end_time])
+ if params[:detail]
+ group_ids.each_with_index do |group_id, index|
+ homework.homework_group_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now,
+ end_time: group_end_times[index])
+ end
+ else
+ homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now,
+ end_time: params[:end_time])
+ end
# 发消息
tiding_group_ids = publish_groups
end
@@ -1086,7 +1107,7 @@ class HomeworkCommonsController < ApplicationController
# 截止时间的处理
if homework.end_time.nil?
- homework.end_time = params[:end_time]
+ homework.end_time = params[:detail] ? group_end_times.max : params[:end_time]
elsif homework.max_group_end_time
homework.end_time = homework.max_group_end_time
end
@@ -1101,12 +1122,22 @@ class HomeworkCommonsController < ApplicationController
create_homework_group_settings(homework)
none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published
- none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time])
+ if params[:detail]
+ group_ids.each_with_index do |group_id, index|
+ none_publish_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now,
+ end_time: group_end_times[index])
+ end
+ else
+ none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time])
+ end
+
if homework.max_group_end_time
homework.end_time = homework.max_group_end_time
end
HomeworkCommonPushNotifyJob.perform_later(homework.id, none_publish_settings.pluck(:course_group_id))
end
+
+
if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1
homework.homework_detail_manual.update_attribute("comment_status", 1)
end
diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb
index dcbded6fe..a8e081cb2 100644
--- a/app/controllers/polls_controller.rb
+++ b/app/controllers/polls_controller.rb
@@ -2,10 +2,10 @@ class PollsController < ApplicationController
# before_action :check_poll_status 问卷的发消息和定时任务没有做
before_action :require_login, :check_auth,except: [:index]
before_action :find_course, except: [:show,:poll_setting,:commit_setting,:edit,:update,:start_answer,:commit_poll,
- :commit_result,:poll_lists,:cancel_publish,:cancel_publish_modal,:common_header]
+ :commit_result,:poll_lists,:cancel_publish,:cancel_publish_modal,:common_header,:publish_groups]
before_action :get_poll_and_course, only: [:show,:poll_setting,:commit_setting,:edit,:update,:start_answer,
:commit_poll,:commit_result,:poll_lists,:cancel_publish,
- :cancel_publish_modal,:common_header]
+ :cancel_publish_modal,:common_header, :publish_groups]
before_action :user_course_identity
before_action :is_course_teacher, except: [:index,:start_answer,:poll_setting,:commit_poll,:commit_result,:poll_lists,:common_header] #判断是否为课堂老师
before_action :check_user_status
@@ -242,12 +242,35 @@ class PollsController < ApplicationController
end
end
end
+
+ # 详情页的立即发布弹框
+ def publish_groups
+ @current_user = current_user
+ # 可立即发布的分班:当前用户管理的分班去除已发布的分班
+ group_ids = @course.charge_group_ids(@current_user) - @poll.poll_group_settings.poll_group_published.pluck(:course_group_id)
+ @course_groups = @course.course_groups.where(id: group_ids)
+ @group_settings = @poll.poll_group_settings.where(id: group_ids)
+ end
+
#首页批量或单独 立即发布,应是跳出弹窗,设置开始时间和截止时间。
def publish
- tip_exception("缺少截止时间参数") if params[:end_time].blank?
- tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
- tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
- @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
+ if params[:detail].blank?
+ tip_exception("缺少截止时间参数") if params[:end_time].blank?
+ tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
+ tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
+ else
+ group_end_times = params[:group_end_times].reject(&:blank?).map{|time| time.to_time}
+ group_ids = params[:group_ids].reject(&:blank?)
+ tip_exception("缺少截止时间参数") if group_end_times.blank?
+ tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length
+ group_end_times.each do |time|
+ tip_exception("分班截止时间不能早于当前时间") if time <= Time.now
+ tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ @course.end_date.present? && time > @course.end_date.end_of_day
+ end
+ end
+
ActiveRecord::Base.transaction do
begin
check_ids = Poll.where(id: params[:check_ids])
@@ -259,26 +282,27 @@ class PollsController < ApplicationController
pl_status = poll.poll_group_settings.find_in_poll_group("course_group_id",params[:group_ids]).poll_group_not_published.present? ? 1 : 0 #立即发布针对分组设置的全部未发布的班级才生效
end
if pl_status == 1 #如果问卷存在已发布的,或者是已截止的,那么则直接跳过
- g_course = params[:group_ids] #表示是否传入分班参数,如果传入分班的参数,那么poll的统一设置需修改
+ g_course = group_ids #表示是否传入分班参数,如果传入分班的参数,那么poll的统一设置需修改
if g_course
- user_course_groups = @course.charge_group_ids(current_user)
- if g_course.map(&:to_i).sort == user_course_groups.sort # 如果是设置为全部班级,则问卷不用分组,且问卷设定为统一设置,否则则分组设置
+ user_course_groups = @course.course_groups.pluck(:id)
+ if g_course.map(&:to_i).sort == user_course_groups.sort &&
+ ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) # 如果是设置为全部班级,则问卷不用分组,且问卷设定为统一设置,否则则分组设置
poll.poll_group_settings.destroy_all
poll_unified = true
e_time = ex_end_time
else
poll_unified = false
- g_course.each do |i|
+ g_course.each_with_index do |i, index|
poll_group_setting = poll.poll_group_settings.find_in_poll_group("course_group_id",i).first #根据课堂分班的id,寻找问卷所在的班级
if poll_group_setting #如果该问卷分组存在,则更新,否则新建
- poll_group_setting.update_attributes(publish_time:Time.now,end_time:ex_end_time)
+ poll_group_setting.update_attributes(publish_time:Time.now, end_time: params[:detail] ? group_end_times[index] : ex_end_time)
else
p_course_group = {
:poll_id => poll.id,
:course_group_id => i,
:course_id => poll.course.id,
:publish_time => Time.now,
- :end_time => ex_end_time,
+ :end_time => params[:detail] ? group_end_times[index] : ex_end_time,
}
new_poll_group = poll.poll_group_settings.new p_course_group
new_poll_group.save
diff --git a/app/views/homework_commons/publish_groups.json.jbuilder b/app/views/homework_commons/publish_groups.json.jbuilder
index 67722bb04..f3a99dbca 100644
--- a/app/views/homework_commons/publish_groups.json.jbuilder
+++ b/app/views/homework_commons/publish_groups.json.jbuilder
@@ -1,4 +1,6 @@
json.course_groups @course_groups do |group|
json.id group.id
json.name group.name
-end
\ No newline at end of file
+ json.end_time @group_settings.select{|group_setting| group_setting.course_group_id == group.id}.first&.end_time
+end
+json.end_time @homework.end_time
\ No newline at end of file
diff --git a/app/views/polls/publish_groups.json.jbuilder b/app/views/polls/publish_groups.json.jbuilder
new file mode 100644
index 000000000..f63a2ea90
--- /dev/null
+++ b/app/views/polls/publish_groups.json.jbuilder
@@ -0,0 +1,6 @@
+json.course_groups @course_groups do |group|
+ json.id group.id
+ json.name group.name
+ json.end_time @group_settings.select{|group_setting| group_setting.course_group_id == group.id}.first&.end_time
+end
+json.end_time @poll.end_time
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 847afaa83..1fd31c50c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -584,6 +584,7 @@ Rails.application.routes.draw do
post :cancel_publish #撤销发布
get :cancel_publish_modal #撤销发布的弹窗
get :common_header
+ get :publish_groups
end
resources :poll_questions,only:[:new,:create]
end
From 213157d542ec73d313e00df13400571c1890356b Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 11 Oct 2019 14:17:54 +0800
Subject: [PATCH 13/20] course_member_id
---
public/react/src/modules/courses/members/studentsList.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index 5f614cfbc..c4d4abbda 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -527,7 +527,7 @@ class studentsList extends Component{
let id = this.props.match.params.coursesId
let url=`/courses/${id}/delete_from_course.json`;
axios.post((url), {
- students: [{course_member_id: record.user_id}] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
+ students: [{course_member_id: record.course_member_id}] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
}).then((result)=>{
if (result.data.status == 0) {
this.props.showNotification('删除成功')
From fb95ef4d18adde4a1d3cacbf4670310cf18d58b1 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 11 Oct 2019 14:22:04 +0800
Subject: [PATCH 14/20] =?UTF-8?q?=E5=AE=BD=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/members/studentsList.css | 2 +-
public/react/src/modules/courses/members/studentsList.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/members/studentsList.css b/public/react/src/modules/courses/members/studentsList.css
index 49a81fa32..ebab316a0 100644
--- a/public/react/src/modules/courses/members/studentsList.css
+++ b/public/react/src/modules/courses/members/studentsList.css
@@ -1,3 +1,3 @@
.stu_table .ant-table-thead > tr > th, .stu_table .ant-table-tbody > tr > td {
- padding: 14px 8px;
+ padding: 14px 6px;
}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index 5f614cfbc..9a4f4be3b 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -143,7 +143,7 @@ const buildColumns = (that,isParent) => {
columns.push({
title: '操作',
key: 'action',
- width: '18%',
+ width: '20%',
align:'center',
render: (text, record) => {
return (
From 6b0f8d1a9e2f6e4b1dacd89725273c4eda0e277e Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 11 Oct 2019 14:31:53 +0800
Subject: [PATCH 15/20] stu
---
public/react/src/modules/courses/members/studentsList.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index 2d26cff91..e3859345a 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -814,7 +814,7 @@ class studentsList extends Component{
- {!this.state.isSpin &&
+ {students && students.length &&
}
From c180267b807bef2e02a5853c1f17c1edd223a463 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 11 Oct 2019 14:32:04 +0800
Subject: [PATCH 16/20] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=AB=8B?=
=?UTF-8?q?=E5=8D=B3=E5=8F=91=E5=B8=83=E5=BC=B9=E6=A1=86=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/exercises_controller.rb | 46 ++++++++++++++-----
app/controllers/polls_controller.rb | 7 +--
.../exercises/publish_groups.json.jbuilder | 6 +++
config/routes.rb | 1 +
4 files changed, 46 insertions(+), 14 deletions(-)
create mode 100644 app/views/exercises/publish_groups.json.jbuilder
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index 30fef596d..a51f65c6b 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -683,12 +683,34 @@ class ExercisesController < ApplicationController
end
end
+ # 详情页的立即发布弹框
+ def publish_groups
+ @current_user = current_user
+ # 可立即发布的分班:当前用户管理的分班去除已发布的分班
+ group_ids = @course.charge_group_ids(@current_user) - @exercise.exercise_group_settings.exercise_group_published.pluck(:course_group_id)
+ @course_groups = @course.course_groups.where(id: group_ids)
+ @group_settings = @exercise.exercise_group_settings.where(id: group_ids)
+ end
+
#首页批量或单独 立即发布,应是跳出弹窗,设置开始时间和截止时间。
def publish
- tip_exception("缺少截止时间参数") if params[:end_time].blank?
- tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
- tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
- @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
+ if params[:detail].blank?
+ tip_exception("缺少截止时间参数") if params[:end_time].blank?
+ tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
+ tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
+ else
+ group_end_times = params[:group_end_times].reject(&:blank?).map{|time| time.to_time}
+ group_ids = params[:group_ids].reject(&:blank?)
+ tip_exception("缺少截止时间参数") if group_end_times.blank?
+ tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length
+ group_end_times.each do |time|
+ tip_exception("分班截止时间不能早于当前时间") if time <= Time.now
+ tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ @course.end_date.present? && time > @course.end_date.end_of_day
+ end
+ end
+
ActiveRecord::Base.transaction do
begin
check_ids = Exercise.where(id: params[:check_ids])
@@ -702,28 +724,30 @@ class ExercisesController < ApplicationController
.exercise_group_not_published.present? ? 1 : 0
end
if ex_status == 1 #如果试卷存在已发布的,或者是已截止的,那么则直接跳过
- g_course = params[:group_ids] #表示是否传入分班参数,如果传入分班的参数,那么试卷的统一设置需修改
+ g_course = group_ids #表示是否传入分班参数,如果传入分班的参数,那么试卷的统一设置需修改
tiding_group_ids = g_course
if g_course
- user_course_groups = @course.charge_group_ids(current_user)
- if g_course.map(&:to_i).sort == user_course_groups.sort # 如果是设置为全部班级,则试卷不用分组,且试卷设定为统一设置,否则则分组设置
+ user_course_groups = @course.course_groups.pluck(:id)
+ if g_course.map(&:to_i).sort == user_course_groups.sort &&
+ ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) # 如果是设置为全部班级,则试卷不用分组,且试卷设定为统一设置,否则则分组设置
exercise.exercise_group_settings.destroy_all
ex_unified = true
- e_time = ex_end_time
+ e_time = params[:detail] ? group_end_times.max : ex_end_time
tiding_group_ids = []
else
ex_unified = false
- g_course.each do |i|
+ g_course.each_with_index do |i, index|
exercise_group_setting = exercise.exercise_group_settings.find_in_exercise_group("course_group_id",i).first #根据课堂分班的id,寻找试卷所在的班级
+ group_end_time = params[:detail] ? group_end_times[index] : ex_end_time
if exercise_group_setting #如果该试卷分组存在,则更新,否则新建
- exercise_group_setting.update_attributes(publish_time:Time.now,end_time:ex_end_time)
+ exercise_group_setting.update_attributes(publish_time: Time.now, end_time: group_end_time)
else
p_course_group = {
:exercise_id => exercise.id,
:course_group_id => i,
:course_id => exercise.course.id,
:publish_time => Time.now,
- :end_time => ex_end_time,
+ :end_time => group_end_time,
}
new_exercise_group = exercise.exercise_group_settings.new p_course_group
new_exercise_group.save
diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb
index a8e081cb2..6b9fd004c 100644
--- a/app/controllers/polls_controller.rb
+++ b/app/controllers/polls_controller.rb
@@ -289,20 +289,21 @@ class PollsController < ApplicationController
((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) # 如果是设置为全部班级,则问卷不用分组,且问卷设定为统一设置,否则则分组设置
poll.poll_group_settings.destroy_all
poll_unified = true
- e_time = ex_end_time
+ e_time = params[:detail] ? group_end_times.max : ex_end_time
else
poll_unified = false
g_course.each_with_index do |i, index|
poll_group_setting = poll.poll_group_settings.find_in_poll_group("course_group_id",i).first #根据课堂分班的id,寻找问卷所在的班级
+ group_end_time = params[:detail] ? group_end_times[index] : ex_end_time
if poll_group_setting #如果该问卷分组存在,则更新,否则新建
- poll_group_setting.update_attributes(publish_time:Time.now, end_time: params[:detail] ? group_end_times[index] : ex_end_time)
+ poll_group_setting.update_attributes(publish_time: Time.now, end_time: group_end_time)
else
p_course_group = {
:poll_id => poll.id,
:course_group_id => i,
:course_id => poll.course.id,
:publish_time => Time.now,
- :end_time => params[:detail] ? group_end_times[index] : ex_end_time,
+ :end_time => group_end_time,
}
new_poll_group = poll.poll_group_settings.new p_course_group
new_poll_group.save
diff --git a/app/views/exercises/publish_groups.json.jbuilder b/app/views/exercises/publish_groups.json.jbuilder
new file mode 100644
index 000000000..72cefdd1a
--- /dev/null
+++ b/app/views/exercises/publish_groups.json.jbuilder
@@ -0,0 +1,6 @@
+json.course_groups @course_groups do |group|
+ json.id group.id
+ json.name group.name
+ json.end_time @group_settings.select{|group_setting| group_setting.course_group_id == group.id}.first&.end_time
+end
+json.end_time @exercise.end_time
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 1fd31c50c..b94d1ca9a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -616,6 +616,7 @@ Rails.application.routes.draw do
get :exercise_result
post :cancel_exercise
get :begin_commit #提交前的弹窗
+ get :publish_groups
end
resources :exercise_questions,only:[:new,:create,:index]
end
From 2435342ae91136272a5927cec143609c6fd6a0fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 11 Oct 2019 14:34:25 +0800
Subject: [PATCH 17/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/shixunHomework/ShixunhomeWorkItem.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index 8b63a3471..be138996f 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -354,8 +354,8 @@ class ShixunhomeWorkItem extends Component{
{/* {discussMessage.author.name} */}
{ discussMessage.author && {discussMessage.author} }
- {discussMessage.commit_count===undefined?"":{discussMessage.commit_count} 已开始做题}
- {discussMessage.uncommit_count===undefined?"":{discussMessage.uncommit_count} 未开始做题}
+ {discussMessage.commit_count===undefined?"":已开始做题:{discussMessage.commit_count}}
+ {discussMessage.uncommit_count===undefined?"":未开始做题:{discussMessage.uncommit_count}}
{/*{discussMessage.replies_count} 3 未评*/}
{
@@ -381,7 +381,7 @@ class ShixunhomeWorkItem extends Component{
{
discussMessage && discussMessage.upper_category_name &&
22 }>
- { {discussMessage.upper_category_name}}
+ { {discussMessage.upper_category_name}}
}
From 938b974d772cb299084a48d7ced8f7446d1d9d22 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Fri, 11 Oct 2019 14:34:57 +0800
Subject: [PATCH 18/20] check commit_method
---
app/controllers/exercises_controller.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index e76148f20..f74eefabf 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -1078,6 +1078,7 @@ class ExercisesController < ApplicationController
ActiveRecord::Base.transaction do
begin
can_commit_exercise = false
+ Rails.logger.info("######____________params[:commit_method]_________################{params[:commit_method]}")
if (@user_course_identity > Course::ASSISTANT_PROFESSOR) && params[:commit_method].present? #为学生时
if params[:commit_method].to_i == 2 #自动提交时
user_left_time = get_exercise_left_time(@exercise,current_user)
From 369bbac497959b52fcc83168ccf56e6d3d82529d Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 11 Oct 2019 14:40:32 +0800
Subject: [PATCH 19/20] =?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/exercises_controller.rb | 2 +-
app/controllers/homework_commons_controller.rb | 2 +-
app/controllers/polls_controller.rb | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index ac18754cd..3835baf55 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -689,7 +689,7 @@ class ExercisesController < ApplicationController
# 可立即发布的分班:当前用户管理的分班去除已发布的分班
group_ids = @course.charge_group_ids(@current_user) - @exercise.exercise_group_settings.exercise_group_published.pluck(:course_group_id)
@course_groups = @course.course_groups.where(id: group_ids)
- @group_settings = @exercise.exercise_group_settings.where(id: group_ids)
+ @group_settings = @exercise.exercise_group_settings.where(course_group_id: group_ids)
end
#首页批量或单独 立即发布,应是跳出弹窗,设置开始时间和截止时间。
diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb
index 70f0345b1..9941e1d42 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -1036,7 +1036,7 @@ class HomeworkCommonsController < ApplicationController
# 可立即发布的分班:当前用户管理的分班去除已发布的分班
group_ids = @course.charge_group_ids(@current_user) - @homework.homework_group_settings.group_published.pluck(:course_group_id)
@course_groups = @course.course_groups.where(id: group_ids)
- @group_settings = @homework.homework_group_settings.where(id: group_ids)
+ @group_settings = @homework.homework_group_settings.where(course_group_id: group_ids)
else
tip_exception("没有可发布的分班")
end
diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb
index 6b9fd004c..2259907e4 100644
--- a/app/controllers/polls_controller.rb
+++ b/app/controllers/polls_controller.rb
@@ -249,7 +249,7 @@ class PollsController < ApplicationController
# 可立即发布的分班:当前用户管理的分班去除已发布的分班
group_ids = @course.charge_group_ids(@current_user) - @poll.poll_group_settings.poll_group_published.pluck(:course_group_id)
@course_groups = @course.course_groups.where(id: group_ids)
- @group_settings = @poll.poll_group_settings.where(id: group_ids)
+ @group_settings = @poll.poll_group_settings.where(course_group_id: group_ids)
end
#首页批量或单独 立即发布,应是跳出弹窗,设置开始时间和截止时间。
From ef56ceb092633add234a03a4d2b4288a42531207 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 11 Oct 2019 14:40:44 +0800
Subject: [PATCH 20/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/shixunHomework/ShixunhomeWorkItem.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index be138996f..7aa1d44de 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -354,8 +354,8 @@ class ShixunhomeWorkItem extends Component{
{/* {discussMessage.author.name} */}
{ discussMessage.author && {discussMessage.author} }
- {discussMessage.commit_count===undefined?"":已开始做题:{discussMessage.commit_count}}
- {discussMessage.uncommit_count===undefined?"":未开始做题:{discussMessage.uncommit_count}}
+ {discussMessage.commit_count===undefined?"":已开始做题 {discussMessage.commit_count}}
+ {discussMessage.uncommit_count===undefined?"":未开始做题 {discussMessage.uncommit_count}}
{/*{discussMessage.replies_count} 3 未评*/}
{
@@ -381,7 +381,7 @@ class ShixunhomeWorkItem extends Component{
{
discussMessage && discussMessage.upper_category_name &&
22 }>
- { {discussMessage.upper_category_name}}
+ { {discussMessage.upper_category_name}}
}