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

dev_forum
hjm 5 years ago
commit 07fed8980c

@ -246,13 +246,15 @@ class HomeworkCommonsController < ApplicationController
student_works = @homework.student_works.where(user_id: user_ids) student_works = @homework.student_works.where(user_id: user_ids)
end end
myshixuns = Myshixun.where(shixun_id: @homework.homework_commons_shixun&.shixun_id, user_id: user_ids). student_works = student_works.includes(:challenge_work_scores)
includes(:games).where(games: {challenge_id: @homework.homework_challenge_settings.pluck(:challenge_id)})
challenge_settings = @homework.homework_challenge_settings challenge_settings = @homework.homework_challenge_settings
challenge_setting_ids = challenge_settings.pluck(:challenge_id)
myshixuns = Myshixun.where(shixun_id: @homework.homework_commons_shixun&.shixun_id, user_id: user_ids).includes(:games)
myshixuns.find_each(batch_size: 100) do |myshixun| myshixuns.find_each(batch_size: 100) do |myshixun|
work = student_works.select{|work| work.user_id == myshixun.user_id}.first work = student_works.select{|work| work.user_id == myshixun.user_id}.first
if work && myshixun if work && myshixun
games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) games = myshixun.games.select{|game| challenge_setting_ids.include?(game.challenge_id)}
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
end end
end end

@ -286,7 +286,7 @@ class HomeworksService
challenge_setting = challenge_settings.select{|setting| setting.challenge_id == game.challenge_id}.first challenge_setting = challenge_settings.select{|setting| setting.challenge_id == game.challenge_id}.first
pass_consume_time += (game.cost_time / 60.0).to_f pass_consume_time += (game.cost_time / 60.0).to_f
user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
adjust_score = work.challenge_work_scores.where(:challenge_id => game.challenge_id).last adjust_score = work.challenge_work_scores.select{|work_score| work_score.challenge_id == game.challenge_id}.last
final_score += if adjust_score.present? final_score += if adjust_score.present?
adjust_score.score adjust_score.score
elsif homework.homework_detail_manual.answer_open_evaluation elsif homework.homework_detail_manual.answer_open_evaluation
@ -300,6 +300,17 @@ class HomeworksService
end end
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
if work.work_status == 0
is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time)
if is_complete || (myshixun.created_at < setting_time.end_time && (!homework.allow_late || setting_time.end_time >= Time.now))
work.work_status = 1
elsif homework.allow_late && myshixun.created_at < homework.late_time
work.work_status = 2
end
end
if work.work_status != 0
if myshixun_endtime.present? if myshixun_endtime.present?
work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
@ -314,18 +325,9 @@ class HomeworksService
end end
end end
if work.work_status == 0
is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time)
if is_complete || (myshixun.created_at < setting_time.end_time && (!homework.allow_late || setting_time.end_time >= Time.now))
work.work_status = 1
elsif homework.allow_late && myshixun.created_at < homework.late_time
work.work_status = 2
end
work.late_penalty = work.work_status == 2 ? homework.late_penalty : 0 work.late_penalty = work.work_status == 2 ? homework.late_penalty : 0
work.commit_time = myshixun.created_at > setting_time.publish_time ? setting_time.publish_time : myshixun.created_at work.commit_time = myshixun.created_at > setting_time.publish_time ? setting_time.publish_time : myshixun.created_at
work.myshixun_id = myshixun.id work.myshixun_id = myshixun.id
end
work.update_time = myshixun.updated_at work.update_time = myshixun.updated_at
work.final_score = final_score work.final_score = final_score
@ -335,4 +337,5 @@ class HomeworksService
work.calculation_time = Time.now work.calculation_time = Time.now
work.save! work.save!
end end
end
end end

Binary file not shown.

@ -10,6 +10,7 @@ broadcastChannelOnmessage('refreshPage', () => {
}) })
function locationurl(list){ function locationurl(list){
debugger
if (window.location.port === "3007") { if (window.location.port === "3007") {
} else { } else {
@ -141,10 +142,7 @@ export function initAxiosInterceptors(props) {
// if(response.data.status === 401){ // if(response.data.status === 401){
// console.log("401401401") // console.log("401401401")
// } // }
if (response.data.status === 403) { if (response.data.status === 403||response.data.status === "403") {
// props.history.replace('/403')
// 这里会分2个情况1、刚进入页面发请求返回的4032、进入页面后其他用户操作触发请求返回的403
// TODO 这里做一个403弹框比较好
locationurl('/403'); locationurl('/403');
} }

@ -997,10 +997,10 @@ class Listofworksstudentone extends Component {
if(result === undefined){ if(result === undefined){
return return
} }
if(result.data.message!==undefined){ // if(result.data.message!==undefined){
//
return; // return;
} // }
this.setState({ this.setState({
teacherdata: result.data, teacherdata: result.data,
@ -1059,9 +1059,6 @@ class Listofworksstudentone extends Component {
} }
axios.post(urll, data).then((result) => { axios.post(urll, data).then((result) => {
if (result) { if (result) {
if(result.data.message!==undefined){
return;
}
// console.log("学生未截至未公开的作品列表") // console.log("学生未截至未公开的作品列表")
// console.log(JSON.stringify(result)) // console.log(JSON.stringify(result))
this.setState({ this.setState({
@ -1491,11 +1488,14 @@ class Listofworksstudentone extends Component {
let url = "/homework_commons/"+homeworkid+"/update_student_score.json?shixun_id="+teacherdata.shixun_id; let url = "/homework_commons/"+homeworkid+"/update_student_score.json?shixun_id="+teacherdata.shixun_id;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response){
if(response.data.status===0) {
this.props.showNotification(`${response.data.message}`); this.props.showNotification(`${response.data.message}`);
// var homeworkid = this.props.match.params.homeworkid; // var homeworkid = this.props.match.params.homeworkid;
this.Getalistofworks(homeworkid); this.Getalistofworks(homeworkid);
this.props.history.replace( matchurl ); // this.props.history.replace(matchurl);
}
}
// this.Getalistofworkstwo("", "", "", "", 1, 20); // this.Getalistofworkstwo("", "", "", "", 1, 20);
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -2160,15 +2160,17 @@ class Listofworksstudentone extends Component {
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response){ if(response){
if(response.data.message!==undefined){ if(response.data.status===0){
return; // if(response.data.message!==undefined){
} // return;
// }
this.setState({ this.setState({
loadingstate: true loadingstate: true
}) })
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); this.Getalistofworks(homeworkid);
this.props.showNotification(`${response.data.message}`); this.props.showNotification(`${response.data.message}`);
this.props.history.replace( matchurl ); }
// this.props.history.replace( matchurl );
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -2214,9 +2216,6 @@ class Listofworksstudentone extends Component {
if(response === undefined){ if(response === undefined){
return return
} }
if(response.data.message!==undefined){
return;
}
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){

@ -479,8 +479,8 @@ class Trainingjobsetting extends Component {
return; return;
} }
if (this.state.latededuction <= 0) { if (this.state.latededuction <0) {
this.props.showNotification(`迟交扣分数不能小于等于`); this.props.showNotification(`迟交扣分数不能小于`);
return; return;
} }

@ -146,7 +146,7 @@ class PathDetailIndex extends Component{
if (result.data.status === 403) { if (result.data.status === 403) {
debugger debugger
window.location.href = "/403"; // window.location.href = "/403";
return; return;
} }
@ -173,7 +173,7 @@ class PathDetailIndex extends Component{
} }
if (result.data.status === 403 ) { if (result.data.status === 403 ) {
debugger debugger
window.location.href = "/403"; // window.location.href = "/403";
return; return;
} }
@ -343,9 +343,11 @@ class PathDetailIndex extends Component{
<p className="clearfix mb20"> <p className="clearfix mb20">
<span className="fl font-18 font-bd">简介</span> <span className="fl font-18 font-bd">简介</span>
{detailInfoList===undefined?"":detailInfoList.allow_statistics===true? {detailInfoList===undefined?"":detailInfoList.allow_statistics===true?
<Tooltip placement="bottom" title={"编辑"}>
<Link className="fr" to={"/paths/"+this.props.match.params.pathId+"/edit"}> <Link className="fr" to={"/paths/"+this.props.match.params.pathId+"/edit"}>
<i className="iconfont icon-bianjidaibeijing font-20 color-green"></i> <i className="iconfont icon-bianjidaibeijing font-20 color-green"></i>
</Link> </Link>
</Tooltip>
:"" :""
} }
</p> </p>

@ -179,7 +179,7 @@ class LoginRegisterComponent extends Component {
} }
//找回密码 //找回密码
Retrievepassword = () => { Retrievepassword = () => {
if (this.state.Phonenumberisnotcobool === false) { if (this.state.Phonenumberisnotcobool === false&&this.state.Phonenumberisnotco!==undefined) {
this.openNotification(this.state.Phonenumberisnotco); this.openNotification(this.state.Phonenumberisnotco);
this.setState({ this.setState({
Whethertoverify:this.state.Whethertoverify===true?false:true, Whethertoverify:this.state.Whethertoverify===true?false:true,
@ -189,6 +189,9 @@ class LoginRegisterComponent extends Component {
if (this.state.login === undefined|| this.state.login.length ===0 || this.state.login === "") { if (this.state.login === undefined|| this.state.login.length ===0 || this.state.login === "") {
this.setState({ this.setState({
Phonenumberisnotco:"账号不能为空", Phonenumberisnotco:"账号不能为空",
Phonenumberisnotcobool: false,
dragOk: false,
Whethertoverify: this.state.Whethertoverify === true ? false : true,
}) })
return return
} }
@ -197,6 +200,8 @@ class LoginRegisterComponent extends Component {
// this.openNotification(`请拖动滑块完成验证`,2); // this.openNotification(`请拖动滑块完成验证`,2);
this.setState({ this.setState({
Phonenumberisnotcosytdhk:"请拖动滑块完成验证", Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
dragOk: false,
Whethertoverify: this.state.Whethertoverify === true ? false : true,
}) })
return return
} }
@ -479,12 +484,15 @@ class LoginRegisterComponent extends Component {
//是否验证通过 //是否验证通过
dragOkCallback = () => { dragOkCallback = () => {
console.log(this.state.login); console.log(this.state.login);
this.setState({
Phonenumberisnotcosytdhk:undefined,
})
if (this.state.login === "" || this.state.login.length === 0) { if (this.state.login === "" || this.state.login.length === 0) {
this.setState({ this.setState({
Phonenumberisnotco: "账号不能为空", Phonenumberisnotco: "账号不能为空",
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Phonenumberisnotcosytdhk:undefined,
dragOk: false, dragOk: false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify: this.state.Whethertoverify === true ? false : true,
}) })
@ -502,6 +510,7 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotco: stringdata, Phonenumberisnotco: stringdata,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
Phonenumberisnotcosytdhk:undefined,
dragOk:false, dragOk:false,
Whethertoverify: this.state.Whethertoverify === true ? false : true, Whethertoverify: this.state.Whethertoverify === true ? false : true,
}) })
@ -509,6 +518,7 @@ class LoginRegisterComponent extends Component {
this.setState({ this.setState({
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: true, Phonenumberisnotcobool: true,
Phonenumberisnotcosytdhk:undefined,
dragOk: true, dragOk: true,
}); });

@ -207,12 +207,15 @@ class LoginRegisterComponent extends Component {
//是否验证通过 //是否验证通过
dragOkCallback = () => { dragOkCallback = () => {
debugger debugger
this.setState({
Phonenumberisnotcosytdhk:undefined,
})
if (this.state.logins.length === 0) { if (this.state.logins.length === 0) {
this.setState({ this.setState({
Phonenumberisnotcos: undefined, Phonenumberisnotcos:"账号不能为空",
Phonenumberisnotcobool: false, Phonenumberisnotcobool: true,
dragOk:true, dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return; return;
} }
@ -373,21 +376,28 @@ class LoginRegisterComponent extends Component {
// this.openNotification(`请同意服务协议条款`,2); // this.openNotification(`请同意服务协议条款`,2);
// return; // return;
// } // }
if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) {
this.setState({
Phonenumberisnotcos:"账号不能为空",
Phonenumberisnotcobool: true,
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
})
return
}
if(this.state.pciphone===true){ if(this.state.pciphone===true){
if (this.state.dragOk === false) { if (this.state.dragOk === false) {
// this.openNotification(`请拖动滑块完成验证`,2); // this.openNotification(`请拖动滑块完成验证`,2);
this.setState({ this.setState({
Phonenumberisnotcosytdhk:"请拖动滑块完成验证", Phonenumberisnotcosytdhk:"请拖动滑块完成验证",
dragOk:false,
Whethertoverify:this.state.Whethertoverify===true?false:true,
}) })
return return
} }
} }
if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) {
this.setState({ if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) {
Phonenumberisnotcos:"账号不能为空",
})
return
} else if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) {
// this.openNotification(`请输入验证码`,2); // this.openNotification(`请输入验证码`,2);
this.setState({ this.setState({
Phonenumberisnotcosyzm:"验证码不能为空", Phonenumberisnotcosyzm:"验证码不能为空",
@ -898,7 +908,7 @@ class LoginRegisterComponent extends Component {
<div> <div>
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab} className="mt20"> <Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab} className="mt20">
<Menu.Item key="0" className={tab===0?"active font-18":"font-18"} > 登录</Menu.Item> <Menu.Item key="0" className={tab===0?"active font-18":"font-18"} > 登录</Menu.Item>
<Menu.Item key="1" className={tab===1?"active font-18":"font-18"} >注册</Menu.Item> <Menu.Item key="1" className={tab===1?"active font-18 ":"font-18 "} style={{marginLeft:"10px"}} >注册</Menu.Item>
</Menu> </Menu>
{ {

Loading…
Cancel
Save