Merge branches 'courseware', 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_aliyun2
杨树明 5 years ago
commit eec34b82e9

@ -5,7 +5,7 @@ class Admins::SchoolBaseStatisticService < ApplicationService
sort_columns :student_count, :teacher_count, :course_count, :course_group_count,
:attachment_count, :video_count, :normal_work_count, :shixun_work_count, :shixun_evaluate_count,
:student_works_num, :exercise_count, default_direction: :desc
:student_work_count, :exercise_count, default_direction: :desc
def initialize(params)
@params = params
@ -77,17 +77,17 @@ class Admins::SchoolBaseStatisticService < ApplicationService
case sort_by_column.to_s
when 'teacher_count' then
schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 0')
.select("#{base_query_column}, COUNT(*) teacher_count")
.select("#{base_query_column}, COUNT(ue.id) teacher_count")
when 'student_count' then
schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 1')
.select("#{base_query_column}, COUNT(*) student_count")
when 'course_count' then
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = false')
.select("#{base_query_column}, COUNT(*) course_count")
schools.joins('LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = 0')
.select("#{base_query_column}, COUNT(courses.id) course_count")
when 'course_group_count' then
schools.joins("LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = false
schools.joins("LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = 0
LEFT JOIN course_groups ON course_groups.course_id = courses.id")
.select("#{base_query_column}, COUNT(*) course_group_count")
.select("#{base_query_column}, COUNT(course_groups.id) course_group_count")
when 'attachment_count' then
schools.joins("LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0
LEFT JOIN attachments ON attachments.container_type ='Course' AND attachments.container_id = cs.id")
@ -106,14 +106,14 @@ class Admins::SchoolBaseStatisticService < ApplicationService
.select("#{base_query_column}, COUNT(*) shixun_work_count")
when 'student_work_count' then
schools.joins("LEFT JOIN school_reports ON school_reports.school_id = schools.id")
.select("#{base_query_column}, COUNT(*) student_work_count")
.select("#{base_query_column}, SUM(student_work_count) AS student_work_count")
when 'shixun_evaluate_count' then
schools.joins('LEFT JOIN school_reports ON school_reports.school_id = schools.id')
.select("#{base_query_column}, COUNT(*) shixun_evaluate_count")
.select("#{base_query_column}, SUM(shixun_evaluate_count) AS shixun_evaluate_count")
when 'exercise_count' then
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0
LEFT JOIN exercises ON exercises.course_id = cs.id')
.select("#{base_query_column}, COUNT(*) exercise_count")
.select("#{base_query_column}, COUNT(exercises.id) exercise_count")
end
end

@ -190,12 +190,13 @@ class PublishRightnow extends Component{
this.setState({ visible : false })
return;
}
this.showDialog(response.data.course_groups)
this.setState({
course_groups: response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
starttimeslate_time:response.data.late_time===undefined||response.data.late_time===null||response.data.late_time===""?undefined:response.data.late_time,
})
this.showDialog(response.data.course_groups)
})
.catch(function (error) {
console.log(error);

@ -58,11 +58,7 @@ class OneSelfOrderModal extends Component{
// }else{
// item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
// }
if(this.props.starttimesend){
item.end_time = moment(moment(handleDateString(this.props.starttimesend))).format("YYYY-MM-DD HH:mm");
}else{
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
}
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
newarr.push(item)
} else {
newarr.push(item)
@ -78,7 +74,7 @@ class OneSelfOrderModal extends Component{
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
if(this.props.starttimesend===undefined){
this.setState({
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
@ -89,7 +85,7 @@ class OneSelfOrderModal extends Component{
}else{
if(this.props.starttimesend===undefined){
this.setState({
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
@ -108,11 +104,7 @@ class OneSelfOrderModal extends Component{
course_groups.map((item,key)=>{
if(item.end_time===null){
// item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
if(this.props.starttimesend){
item.end_time = moment(moment(handleDateString(this.props.starttimesend))).format("YYYY-MM-DD HH:mm");
}else{
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
}
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
newarr.push(item)
}else{
newarr.push(item)
@ -131,7 +123,7 @@ class OneSelfOrderModal extends Component{
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
if(this.props.starttimesend===undefined){
this.setState({
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
@ -142,7 +134,7 @@ class OneSelfOrderModal extends Component{
}else{
if(this.props.starttimesend===undefined){
this.setState({
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({

@ -57,11 +57,12 @@ class Immediatelypublish extends Component{
if(this.props.Exercisetype==="exercise"){
let url=`/exercises/${this.props.match.params.Id}/publish_groups.json`;
axios.get(url).then((response) => {
if(response.status===200){
if (response.data) {
let starttimesend=response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time;
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
OneSelftype:true,
Topval:this.props.Exercisetype==="exercise"?"学生将立即收到试卷":"学生将立即收到问卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":this.props.Exercisetype==="exercise"?`本操作只对"未发布"的试卷有效`:`本操作只对"未发布"的问卷有效`,
@ -73,8 +74,9 @@ class Immediatelypublish extends Component{
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
course_groups:response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
starttimesend:starttimesend,
immediatelyopen:response.data.course_groups===null||response.data.course_groups.length===0?false:true,
OneSelftype:true,
})
}
@ -84,12 +86,12 @@ class Immediatelypublish extends Component{
}else{
let url=`/polls/${this.props.match.params.pollId}/publish_groups.json`;
axios.get(url).then((response) => {
if(response){
if (response.data) {
let starttimesend=response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time;
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
OneSelftype:true,
Topval:this.props.Exercisetype==="exercise"?"学生将立即收到试卷":"学生将立即收到问卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":this.props.Exercisetype==="exercise"?`本操作只对"未发布"的试卷有效`:`本操作只对"未发布"的问卷有效`,
@ -101,8 +103,9 @@ class Immediatelypublish extends Component{
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
course_groups:response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
starttimesend:starttimesend,
immediatelyopen:response.data.course_groups===null||response.data.course_groups.length===0?false:true,
OneSelftype:true,
})
}
}).catch((error) => {

@ -383,14 +383,15 @@ class ShixunStudentWork extends Component {
axios.get(url).then((response) => {
if(response.status===200){
if (response.data) {
const dataformat = 'YYYY-MM-DD HH:mm';
let starttime= this.props.getNowFormatDates(1);
let endtime=this.props.getNowFormatDates(2);
let starttimesend=response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time;
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
OneSelftype:true,
Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的作业有效`,
@ -402,8 +403,9 @@ class ShixunStudentWork extends Component {
Saves:this.homeworkstartend,
course_groups:response.data.course_groups,
starttimes:starttime,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
starttimesend:starttimesend,
typs:"start",
OneSelftype:true,
})
}
}).catch((error) => {

@ -1813,20 +1813,21 @@ class Trainingjobsetting extends Component {
axios.get(url).then((response) => {
if (response.status === 200) {
if (response.data) {
const dataformat = 'YYYY-MM-DD HH:mm';
let starttime = this.props.getNowFormatDates(1);
let endtime = this.props.getNowFormatDates(2);
let starttimesend=response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time;
this.setState({
modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
OneSelftype: true,
Topval: "学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval: `本操作只对"未发布"的作业有效`,
starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes: starttime,
starttimesend: response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time,
starttimesend:starttimesend,
typs: "start",
endtime: "截止时间:" + endtime,
Cancelname: "暂不发布",
@ -1836,6 +1837,7 @@ class Trainingjobsetting extends Component {
course_groups:response.data.course_groups,
immediatelyopen:true,
modallate_time:response.data.late_time,
OneSelftype: true,
})
}
}).catch((error) => {

@ -159,14 +159,15 @@ class Workquestionandanswer extends Component {
axios.get(url).then((response) => {
if (response.status === 200) {
if (response.data) {
const dataformat = 'YYYY-MM-DD HH:mm';
let starttime = this.props.getNowFormatDates(1);
let endtime = this.props.getNowFormatDates(2);
let starttimesend=response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time;
this.setState({
modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
OneSelftype: true,
Topval: "学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval: `本操作只对"未发布"的作业有效`,
@ -178,8 +179,9 @@ class Workquestionandanswer extends Component {
Saves: this.homeworkstartend,
course_groups: response.data.course_groups,
starttimes: starttime,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
starttimesend:starttimesend,
typs: "start",
OneSelftype: true,
})
}
}).catch((error) => {

Loading…
Cancel
Save