dev_forum
cxt 5 years ago
commit 3c7018b4c6

@ -230,11 +230,16 @@ class ChallengesController < ApplicationController
def crud_answer def crud_answer
raise '参考答案不能为空' if params[:challenge_answer].empty? raise '参考答案不能为空' if params[:challenge_answer].empty?
raise '占比之和必须为100%' if params[:challenge_answer].map{|a| a[:score]}.sum != 100 raise '占比之和必须为100%' if params[:challenge_answer].map{|a| a[:score]}.sum != 100
@challenge.challenge_answers.destroy_all if @challenge.challenge_answers ActiveRecord::Base.transaction do
params[:challenge_answer].each_with_index do |answer, index| @challenge.challenge_answers.destroy_all if @challenge.challenge_answers
ChallengeAnswer.create(name: answer[:name], contents: answer[:contents], params[:challenge_answer].each_with_index do |answer, index|
level: index+1, score: answer[:score], challenge_id: @challenge.id) # 内容为空不保存
next if answer[:contents].blank?
ChallengeAnswer.create(name: answer[:name], contents: answer[:contents],
level: index+1, score: answer[:score], challenge_id: @challenge.id)
end
end end
end end
# 查看参考答案接口 # 查看参考答案接口

@ -1597,7 +1597,7 @@ class HomeworkCommonsController < ApplicationController
att = attachment.copy att = attachment.copy
att.author_id = homework_bank.user_id att.author_id = homework_bank.user_id
att.copy_from = attachment.id att.copy_from = attachment.id
att.attachtype = attachment.attachtype att.attachtype = attachment.attachtype || 1
homework_bank.attachments << att homework_bank.attachments << att
end end
homework_bank homework_bank

@ -154,7 +154,7 @@ class QuestionBanksController < ApplicationController
att.container_id = nil att.container_id = nil
att.container_type = nil att.container_type = nil
att.author_id = homework.user_id att.author_id = homework.user_id
att.attachtype = attachment.attachtype att.attachtype = attachment.attachtype || 1
# att.attachtype = 1 # att.attachtype = 1
att.copy_from = attachment.id att.copy_from = attachment.id
att.save! att.save!

@ -0,0 +1,6 @@
class DeleteContentsIsNullForChallengeAnswers < ActiveRecord::Migration[5.2]
def change
contents = ChallengeAnswer.where("contents = ''")
contents.delete_all
end
end

@ -130,6 +130,9 @@ export function initAxiosInterceptors(props) {
throw new axios.Cancel('Operation canceled by the user.'); throw new axios.Cancel('Operation canceled by the user.');
} }
// if(response.data.status === 401){
// console.log("401401401")
// }
if (response.data.status === 403) { if (response.data.status === 403) {
// props.history.replace('/403') // props.history.replace('/403')
// 这里会分2个情况1、刚进入页面发请求返回的4032、进入页面后其他用户操作触发请求返回的403 // 这里会分2个情况1、刚进入页面发请求返回的4032、进入页面后其他用户操作触发请求返回的403
@ -145,16 +148,20 @@ export function initAxiosInterceptors(props) {
locationurl('/500'); locationurl('/500');
} }
// if (response.data.status === 402) { // if (response.data.status === 402) {
// console.log(response.data.status); // console.log(response.data.status);
// console.log(response.data); // console.log(response.data);
// // locationurl(402); // // locationurl(402);
// } // }
//
if (response.data.status === 401) { // if (response.data.status === 401) {
return config; // console.log("161");
} // console.log(config);
// return config;
// }
// if (response.data.status === 407) { // if (response.data.status === 407) {
// 在app js 中解决 Trialapplication // 在app js 中解决 Trialapplication
// // </Trialapplication> // // </Trialapplication>

@ -715,18 +715,18 @@ class CommonWorkSetting extends Component{
course_id , course_id ,
unified_setting: unified_setting, // 统一设置 unified_setting: unified_setting, // 统一设置
group_settings: group_settings_param, group_settings: group_settings_param,
publish_time: new Date(temp_publish_time), // 发布 publish_time: temp_end_time ? new Date(temp_publish_time) : temp_end_time, // 发布
end_time: new Date(temp_end_time), // 截止 end_time: temp_end_time ? new Date(temp_end_time) : temp_end_time, // 截止
late_penalty: late_penalty, // 迟交扣分 late_penalty: late_penalty, // 迟交扣分
allow_late: allow_late, // 是否允许补交 allow_late: allow_late, // 是否允许补交
late_time: new Date(late_time), // 补交截止时间 late_time: late_time ? new Date(late_time) : late_time, // 补交截止时间
anonymous_comment: anonymous_comment, // true: 启用匿评 false:未启用匿评 anonymous_comment: anonymous_comment, // true: 启用匿评 false:未启用匿评
evaluation_start: new Date(evaluation_start), //匿评开始时间 evaluation_start: evaluation_start ? new Date(evaluation_start) : evaluation_start, //匿评开始时间
evaluation_end: evaluation_end, evaluation_end: evaluation_end,
evaluation_num: evaluation_num, // 匿评数 evaluation_num: evaluation_num, // 匿评数
absence_penalty: absence_penalty, // 匿评扣分 absence_penalty: absence_penalty, // 匿评扣分
anonymous_appeal: anonymous_appeal, // true: 启用匿评申诉, false:未启用 anonymous_appeal: anonymous_appeal, // true: 启用匿评申诉, false:未启用
appeal_time: new Date(appeal_time), // 申诉结束时间 appeal_time: appeal_time ? new Date(appeal_time) : appeal_time, // 申诉结束时间
appeal_penalty: appeal_penalty, // 违规匿评扣分 appeal_penalty: appeal_penalty, // 违规匿评扣分
ta_mode: ta_mode, // 1:普通模式 0:复审模式 ta_mode: ta_mode, // 1:普通模式 0:复审模式
final_mode: final_mode, // true: 单项评分优先, false: 多项评分配比 final_mode: final_mode, // true: 单项评分优先, false: 多项评分配比

@ -982,7 +982,7 @@ class Listofworksstudentone extends Component {
// console.log("935"); // console.log("935");
// debugger // debugger
let urll = `/homework_commons/${homeworkid}/works_list.json`; let urll = `/homework_commons/${homeworkid}/works_list.json`;
var data = { var datasysl = {
search: "", search: "",
order: "", order: "",
b_order: "desc", b_order: "desc",
@ -991,12 +991,17 @@ class Listofworksstudentone extends Component {
work_status: "", work_status: "",
course_group: "", course_group: "",
} }
axios.post(urll, data).then((result) => { axios.post(urll, datasysl).then((result) => {
console.log("980000000____________________"); console.log("980000000____________________");
debugger
if(result === undefined){ if(result === undefined){
return return
} }
if(result.data.message!==undefined){
return;
}
this.setState({ this.setState({
teacherdata: result.data, teacherdata: result.data,
task_status: result.data.task_status, task_status: result.data.task_status,
@ -1054,6 +1059,9 @@ 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({
@ -1315,6 +1323,9 @@ class Listofworksstudentone extends Component {
var url = `/student_works/${userids}/shixun_work.json`; var url = `/student_works/${userids}/shixun_work.json`;
axios.get(url).then((result) => { axios.get(url).then((result) => {
if (result) { if (result) {
if(result.data.message!==undefined){
return;
}
// console.log("Listofworksstudentone.js") // console.log("Listofworksstudentone.js")
// console.log(JSON.stringify(result)) // console.log(JSON.stringify(result))
let datalist = []; let datalist = [];
@ -1416,6 +1427,9 @@ class Listofworksstudentone extends Component {
} }
axios.post(urll, data).then((result) => { axios.post(urll, data).then((result) => {
if (result !== undefined) { if (result !== undefined) {
if(result.data.message!==undefined){
return;
}
// console.log("学生公开的作品列表") // console.log("学生公开的作品列表")
// console.log(JSON.stringify(result)) // console.log(JSON.stringify(result))
this.setState({ this.setState({
@ -1476,6 +1490,7 @@ 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) => {
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);
@ -1521,7 +1536,11 @@ class Listofworksstudentone extends Component {
// console.log(url) // console.log(url)
// console.log("作品列表______________________") // console.log("作品列表______________________")
// console.log(JSON.stringify(result)) // console.log(JSON.stringify(result))
if (result !== undefined) { if (result !== undefined) {
if(result.data.message!==undefined){
return;
}
this.setState({ this.setState({
teacherdata: result.data, teacherdata: result.data,
task_status: result.data.task_status, task_status: result.data.task_status,
@ -1895,6 +1914,7 @@ class Listofworksstudentone extends Component {
if (result) { if (result) {
// console.log("TraineetraininginformationModal.js") // console.log("TraineetraininginformationModal.js")
// console.log(JSON.stringify(result)) // console.log(JSON.stringify(result))
let datalist = []; let datalist = [];
var game_list = result.data.game_list var game_list = result.data.game_list
var boolgalist=true; var boolgalist=true;
@ -2134,11 +2154,16 @@ class Listofworksstudentone extends Component {
let url = "/homework_commons/"+homeworkid+"/update_score.json"; let url = "/homework_commons/"+homeworkid+"/update_score.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response){
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.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.props.showNotification(`${response.data.message}`); this.props.showNotification(`${response.data.message}`);
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -2183,6 +2208,9 @@ 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){

@ -59,10 +59,10 @@ class ShixunHomeworkPage extends Component {
// console.log(teacherdata); // console.log(teacherdata);
this.setState({ this.setState({
jobsettingsdatapage: jobsettingsdata.data.message!==undefined?undefined:jobsettingsdata, jobsettingsdatapage: jobsettingsdata.data.message===undefined?jobsettingsdata:undefined,
teacherdatapage: teacherdata.message!==undefined?undefined:teacherdata, teacherdatapage: teacherdata.message===undefined?teacherdata:undefined,
code_review: teacherdata.code_review!==undefined?teacherdata.code_review :false, code_review: teacherdata.code_review===undefined?false :teacherdata.code_review,
view_report: teacherdata.view_report!==undefined? teacherdata.view_report:false, view_report: teacherdata.view_report!==undefined? false:teacherdata.view_report,
}) })
} }
@ -116,9 +116,9 @@ class ShixunHomeworkPage extends Component {
let {tab, teacherdatapage, jobsettingsdatapage} = this.state; let {tab, teacherdatapage, jobsettingsdatapage} = this.state;
const isAdmin = this.props.isAdmin(); const isAdmin = this.props.isAdmin();
// console.log(119) console.log(119)
// console.log(jobsettingsdatapage); console.log(jobsettingsdatapage);
// console.log(teacherdatapage); console.log(teacherdatapage);
return ( return (
<div className="newMain clearfix "> <div className="newMain clearfix ">
<div className={"educontent mb20"} style={{width: "1200px"}}> <div className={"educontent mb20"} style={{width: "1200px"}}>

Loading…
Cancel
Save