Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

problem_set
cxt 5 years ago
commit 5e59a95969

@ -36,8 +36,8 @@ class Admins::UserStatisticQuery < ApplicationQuery
study_myshixun = Myshixun.where(user_id: ids)
finish_myshixun = Myshixun.where(user_id: ids, status: 1)
study_challenge = Game.joins(:myshixun).where(myshixuns: { user_id: ids }).where(status: [0, 1, 2])
finish_challenge = Game.joins(:myshixun).where(myshixuns: { user_id: ids }).where(status: 2)
study_challenge = Game.where(user_id: ids).where(status: [0, 1, 2])
finish_challenge = Game.where(user_id: ids).where(status: 2)
if time_range.present?
study_myshixun = study_myshixun.where(updated_at: time_range)
@ -106,12 +106,12 @@ class Admins::UserStatisticQuery < ApplicationQuery
when 'finish_challenge_count' then
users =
if time_range.present?
users.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id')
.joins("LEFT JOIN games ON games.myshixun_id = myshixuns.id "\
users#.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id')
.joins("LEFT JOIN games ON games.user_id = users.id "\
"AND games.status = 2 AND games.updated_at BETWEEN '#{time_range.min}' AND '#{time_range.max}'")
else
users.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id')
.joins("LEFT JOIN games ON games.myshixun_id = myshixuns.id AND games.status = 2")
users#.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id')
.joins("LEFT JOIN games ON games.user_id = users.id AND games.status = 2")
end
users.select("#{base_query_column}, COUNT(*) finish_challenge_count")

@ -34,8 +34,11 @@ class PublishRightnow extends Component{
homeworkstart=()=>{
const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) {
this.props.showNotification(`请先选择要立即${isPublish ? "发布" : "截止"}的作业`)
this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`)
return;
}
@ -43,28 +46,30 @@ class PublishRightnow extends Component{
}
showDialog = () => {
showDialog = (course_groups) => {
const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
const dateFormat = 'YYYY-MM-DD HH:mm';
let showdatatype=isPublish===true&&isPublishtype===undefined;
let showdatatypes=isPublish===true||isPublishtype===1;
// getNextHalfHourOfMoment
const startMoment = (moment());
this.setState({
modalname: isPublish ? "立即发布" : "立即截止",
modaltype:1,
visible:isPublish?false:true,
OneSelftype:isPublish?true:false,
Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品",
modalname: showdatatypes ? "立即发布" : "立即截止",
modaltype:course_groups.length> 0 ? 1 : 2,
visible:showdatatype?false:true,
OneSelftype:showdatatype?true:false,
Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品",
// Botvalleft: isPublish ? "暂不发布" : "暂不截止",
Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '',
endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
Cancelname:isPublish ? "暂不发布" : "暂不截止",
Savesname:isPublish ? "立即发布" : "立即截止",
Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '',
endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
Cancelname:showdatatypes ? "暂不发布" : "暂不截止",
Savesname:showdatatypes ? "立即发布" : "立即截止",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
typs:isPublish ? "start" : "end",
typs:showdatatypes ? "start" : "end",
})
}
homeworkhide=()=>{
@ -124,14 +129,15 @@ class PublishRightnow extends Component{
detail:true
}
}
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
let coursesId=this.props.match.params.coursesId;
const url = `/courses/${coursesId}/homework_commons/${isPublish ? "publish_homework" : "end_homework"}.json`
const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json`
axios.post(url, data)
.then((response) => {
if (response.data.status == 0) {
this.homeworkhide()
this.props.showNotification(isPublish ? "立即发布成功" : "立即截止成功")
this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功")
this.props.doWhenSuccess && this.props.doWhenSuccess()
this.setState({ visible : false })
this.props.action && this.props.action()
@ -147,13 +153,16 @@ class PublishRightnow extends Component{
// }
// }
fetchCourseGroups = () => {
const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
let coursesId=this.props.match.params.coursesId;
// TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668
// /homework_commons/:id/publish_groups.json
let url = `/courses/${coursesId}/all_course_groups.json`
if (this.props.checkBoxValues.length == 1) {
const isPublish = this.props.isPublish;
url = `/homework_commons/${this.props.checkBoxValues[0]}/${ isPublish ? 'publish_groups' : 'end_groups'}.json`
url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json`
}
axios.get(url, {
@ -163,7 +172,7 @@ class PublishRightnow extends Component{
this.setState({ visible : false })
return;
}
this.showDialog()
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,
@ -176,6 +185,8 @@ class PublishRightnow extends Component{
render(){
const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
let{
Topvalright,
@ -220,7 +231,7 @@ class PublishRightnow extends Component{
typs={this.state.typs}
/>:""}
{/*立即发布*/}
<OneSelfOrderModal
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
@ -238,8 +249,8 @@ class PublishRightnow extends Component{
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ isPublish ? "立即发布" : "立即截止" }</a> }
/>:""}
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ showdatatypes ? "立即发布" : "立即截止" }</a> }
</div>
)
}

@ -431,7 +431,9 @@ class commonWork extends Component{
></Titlesearchsection>
<PublishRightnow ref="publishModalRef" showActionButton={true} {...this.props} checkBoxValues={checkBoxValues}
showActionButton={false}
isPublish={true} doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow>
isPublish={true}
isPublishtype={1}
doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow>
{
mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
<div className="mt20 edu-back-white padding20-30">

@ -235,10 +235,14 @@ class HomeworkModal extends Component{
<style>
{
`
.ant-checkbox-wrapper {
.HomeworkModal .ant-checkbox-wrapper {
margin-top: 0px;
float: left;
}
.width300{
width:300px;
display: inline-block;
}
`
}
</style>
@ -251,7 +255,7 @@ class HomeworkModal extends Component{
<div className="clearfix edu-txt-center lineh-40" key={key}>
<li style={{ width: '100%',padding: "0px 10px"}}>
<Checkbox
className="task-hide edu-txt-left"
className="task-hide edu-txt-left width300"
name="shixun_homework[]"
value={item.id}
key={item.id}

@ -48,11 +48,12 @@ class OneSelfOrderModal extends Component{
let course_groups = this.props.course_groups;
course_groups.map((item, key) => {
if (item.end_time === null) {
if(this.props.starttimesend===undefined){
// if(this.props.starttimesend===undefined){
// item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
// }else{
// item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
// }
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
}else{
item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
}
newarr.push(item)
} else {
newarr.push(item)
@ -97,11 +98,7 @@ class OneSelfOrderModal extends Component{
let course_groups=this.props.course_groups;
course_groups.map((item,key)=>{
if(item.end_time===null){
if(this.props.starttimesend===undefined){
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
}else{
item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
}
newarr.push(item)
}else{
newarr.push(item)
@ -161,7 +158,21 @@ class OneSelfOrderModal extends Component{
}
onChangeTimeendlist=(date, dateString,id)=>{
let {course_groups}=this.state;
let {course_groups,endtimetypeid}=this.state;
if(endtimetypeid===id){
if(date!=null){
this.setState({
endtimetypeid:undefined
})
}
if(moment(dateString,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{
if(date!=null){
this.setState({
endtimetypeid:undefined
})
}
}
}
let arr=course_groups;
arr.map((item,key)=>{
@ -194,7 +205,7 @@ class OneSelfOrderModal extends Component{
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
this.setState({
endtimetype:true,
endtimetypevalue:"必须晚于发布时间"
endtimetypevalue:"必须晚于当前时间"
})
return
}
@ -219,6 +230,13 @@ class OneSelfOrderModal extends Component{
// arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
}else{
if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
this.setState({
endtimetype:true,
endtimetypevalue:"必须晚于当前时间"
})
return
}
arr.push(items.end_time)
}
}
@ -255,7 +273,8 @@ class OneSelfOrderModal extends Component{
render(){
let {group_ids,endtime,course_groups}=this.state;
// console.log(course_groups)
console.log(this.props.modaltype)
let course_groupstype=course_groups===undefined||course_groups.length===0;
// TODO course_groups为空时的处理
return(
<div>
@ -322,7 +341,7 @@ class OneSelfOrderModal extends Component{
{this.props.starttime===undefined||
this.props.starttime===""?""
: <p className="task-popup-text-center font-16 mt10 mb10">
: <p className="task-popup-text-center font-16 mt20 mb10">
{/*<span className={"font-14 mr20 color979797"}>*/}
{/*<span className={"mr10"}>发布时间:</span>*/}
{/*{this.props.starttime}</span>*/}
@ -344,16 +363,17 @@ class OneSelfOrderModal extends Component{
onChange={this.onChangeTimeend}
className={ this.state.endtimetype===true?"noticeTip":""}
/>
{this.state.endtimetype===true?<div className={"color-red fr mr90 mt5"}>{this.state.endtimetypevalue}</div>:""}
{/*<div className={"fr mr90 mt5"}>(仅支持半点和整点)</div>*/}
</span>:""}
</p>}
{/* usingCheckBeforePost 为true的时候 全选所有分班 */}
<style>
{
`
.ant-checkbox-wrapper {
.HomeworkModal .ant-checkbox-wrapper {
margin-top: 0px;
float: left;
}
@ -373,11 +393,11 @@ class OneSelfOrderModal extends Component{
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
<span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name ml50">分班名称</span>
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr20">截止时间</span>
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</span>
</li>
</div>}
{this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<ul className="upload_select_box fl clearfix mb30"
|| this.props.usingCheckBeforePost ?"":<ul className={this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?"upload_select_box fl clearfix mb20":"upload_select_box fl clearfix mb30"}
style={{"overflow-y":"auto",padding:"10px 0px"}}
id="search_not_members_list"
@ -385,7 +405,7 @@ class OneSelfOrderModal extends Component{
{ <Checkbox.Group style={{ width: '100%' }} value={group_ids} onChange={this.shixunhomeworkedit}>
{
course_groups===undefined?"":course_groups.map((item,key)=>{
course_groups===undefined||course_groups.length===0?"":course_groups.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 mb10" key={key}>
@ -422,12 +442,16 @@ class OneSelfOrderModal extends Component{
</ul>
}
<div className="clearfix mt30 edu-txt-center mb10">
<Checkbox className="fl ml10" checked={this.state.Checkboxtype} onChange={this.Checkboxtype}>全选</Checkbox>
{this.state.endtimetype===true&&course_groupstype===true?<div className={"color-red"} style={{'text-align': 'center'}}>{this.state.endtimetypevalue}</div>:""}
{this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?<div className={"color-red fl ml10 mb20"}>{this.state.endtimetypevalue}</div>:""}
{course_groupstype===true?<div className={this.state.endtimetype===true&&course_groupstype===true?"clearfix mt10 edu-txt-center mb10":"clearfix mt20 edu-txt-center mb10"}>
<a className="task-btn color-white mr30" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
<a className="task-btn task-btn-orange" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
</div>
</div>:<div className="clearfix mt30 edu-txt-center mb10">
{course_groupstype===true?"":<Checkbox className="fl ml10" checked={this.state.Checkboxtype} onChange={this.Checkboxtype}>全选</Checkbox>}
<a className="task-btn task-btn-orange fr" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
<a className="task-btn color-white mr30 fr" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
</div>}
</div>
</Modal>:""}

@ -353,7 +353,7 @@ class GraduationTaskDetail extends Component{
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/>
<OneSelfOrderModal
{this.state.OneSelftype==true?<OneSelfOrderModal
{...this.props}
staytime={this.state.staytime}
starttimes={this.state.starttimes}
@ -376,7 +376,7 @@ class GraduationTaskDetail extends Component{
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
/>:""}

@ -367,7 +367,7 @@ class Immediatelypublish extends Component{
/>
{/*立即发布*/}
<OneSelfOrderModal
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
@ -386,7 +386,7 @@ class Immediatelypublish extends Component{
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
/>:""}
{/* 公用的提示弹框 */}
<Modals

@ -3219,7 +3219,7 @@ class Listofworksstudentone extends Component {
/>
{/*立即发布*/}
<OneSelfOrderModal
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
@ -3238,7 +3238,7 @@ class Listofworksstudentone extends Component {
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
/>:""}
{
homework_status&&homework_status.length===0?
<div className="edu-back-white">

@ -793,7 +793,7 @@ class ShixunStudentWork extends Component {
/>
{/*立即发布*/}
<OneSelfOrderModal
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
@ -812,7 +812,7 @@ class ShixunStudentWork extends Component {
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
/>:""}
<div className={"educontent "}>

@ -414,7 +414,7 @@ class ShixunhomeWorkItem extends Component{
{
discussMessage && discussMessage.upper_category_name &&
<ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }>
{ <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"268px"}:{"maxWidth":"625px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>}
{ <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"268px"}:{"maxWidth":"550px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>}
</ConditionToolTip>
}

@ -2163,7 +2163,7 @@ class Trainingjobsetting extends Component {
{/*立即发布*/}
<OneSelfOrderModal
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
@ -2182,7 +2182,7 @@ class Trainingjobsetting extends Component {
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
/>:""}
<Modals
modalsType={modalsType}

@ -489,7 +489,7 @@ class Workquestionandanswer extends Component {
/>
{/*立即发布*/}
<OneSelfOrderModal
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
@ -508,7 +508,7 @@ class Workquestionandanswer extends Component {
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
/>:""}
<div className={"educontent "}>
<div className="edu-back-white" >

@ -94,6 +94,7 @@ class OfficialAcademicTranscript extends Component {
challenge_id: {id: item.challenge_id},
challenge_comment: item.challenge_comment,
challenge_comment_hidden: item.challenge_comment_hidden,
view_answer: item.view_answer,
// adjustmentminute:asdasd
})
})
@ -172,15 +173,18 @@ class OfficialAcademicTranscript extends Component {
className: "edu-txt-center",
render: (text, record) => {
return (
<span style={{cursor: "default"}}>{record.view_answer === true ? <Tooltip placement="bottom" title={
<span style={{cursor: "default"}}>
{record.view_answer === true ? <Tooltip placement="bottom" title={
<pre>
学生在完成任务评测之前查是否看了参考答案
</pre>
}><span style={{cursor: "default"}}>已查看</span> </Tooltip> : <Tooltip placement="bottom" title={
}><span style={{cursor: "default"}}>已查看</span> </Tooltip>
: <Tooltip placement="bottom" title={
<pre>
学生在完成任务评测之前查是否看了参考答案
</pre>
}><span style={{cursor: "default"}}>未查看</span> </Tooltip>}</span>
}><span style={{cursor: "default"}}>未查看</span> </Tooltip>}
</span>
)
}
},

Loading…
Cancel
Save