杨树明 5 years ago
commit b601fe3c1f

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

@ -315,7 +315,7 @@ class CoursesController < ApplicationController
# @users = User.where.not(id: user_ids_of_course_members)
@users = User.where(status: User::STATUS_ACTIVE)
@users = @users.where("concat(users.firstname, users.lastname) like '%#{name}%'") if name.present?
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
# REDO:Extension
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?

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

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

@ -31,7 +31,7 @@ class Game < ApplicationRecord
# 根据得分比例来算实际得分(试卷、实训作业)
def real_score score
(final_score.to_f / challenge.all_score) * score
((final_score < 0 ? 0 : final_score).to_f / challenge.all_score) * score
end
# 判断实训是否全部通关

@ -1,7 +1,7 @@
json.candidates do
json.array! @users do |user|
json.id user.id
json.name user.firstname + user.lastname
json.name user.real_name
json.nickname user.nickname
json.school_name user.user_extension.school.try(:name)
json.school_id user.user_extension.school.try(:id)

@ -21,7 +21,8 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选
user_answer_b = user_answer.include?(a.id)
json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现
json.choice_id a.id
json.choice_text (edit_type.present? || question.question_type == 2) ? a.choice_text : "#{(index+65).chr}.#{a.choice_text}"
# json.choice_text (edit_type.present? || question.question_type == 2) ? a.choice_text : "#{(index+65).chr}.#{a.choice_text}"
json.choice_text a.choice_text
json.choice_position a.choice_position
if exercise_type == 1 || exercise_type == 4 #1为教师编辑/预览 试卷或问题2为空白试卷即标准答案和用户答案都不显示3为用户开始答题的显示4为老师评阅试卷或学生在截止后查看试卷
json.standard_boolean standard_answer_b

@ -35,15 +35,16 @@ json.commit_results do
if q[:type] != Exercise::PRACTICAL
json.ques_details do
json.array! q[:ques_details].each_with_index.to_a do |d,index|
if q[:type] <= Exercise::MULTIPLE
ques_index = (index+65).chr
elsif q[:type] == Exercise::JUDGMENT
ques_index = (index+1).to_s
else
ques_index = nil
end
# if q[:type] <= Exercise::MULTIPLE
# ques_index = (index+65).chr
# elsif q[:type] == Exercise::JUDGMENT
# ques_index = (index+1).to_s
# else
# ques_index = nil
# end
json.choice_position d[:choice_position]
json.choice_text ques_index.present? ? "#{ques_index}.#{d[:choice_text]}" : d[:choice_text]
# json.choice_text ques_index.present? ? "#{ques_index}.#{d[:choice_text]}" : d[:choice_text]
json.choice_text d[:choice_text]
json.choice_users_count d[:choice_users_count]
json.choice_percent d[:choice_percent]
json.choice_right_boolean d[:right_answer]

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

@ -2,7 +2,7 @@ import React from "react";
import axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage ,SetAppModel} from 'educoder';
import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString} from 'educoder';
import { notification } from 'antd';
import './index.css'
broadcastChannelOnmessage('refreshPage', () => {
@ -18,10 +18,19 @@ function locationurl(list){
}
// TODO 开发期多个身份切换
const debugType =""
// window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
// window._debugType = debugType;
let debugType = ""
if (isDev) {
const _search = window.location.search;
let parsed = {};
if (_search) {
parsed = queryString.parse(_search);
}
debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
window.location.search.indexOf('debug=s') != -1 ? 'student' :
window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || ''
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
@ -130,6 +139,9 @@ export function initAxiosInterceptors(props) {
throw new axios.Cancel('Operation canceled by the user.');
}
// if(response.data.status === 401){
// console.log("401401401")
// }
if (response.data.status === 403) {
// props.history.replace('/403')
// 这里会分2个情况1、刚进入页面发请求返回的4032、进入页面后其他用户操作触发请求返回的403
@ -145,16 +157,20 @@ export function initAxiosInterceptors(props) {
locationurl('/500');
}
// if (response.data.status === 402) {
// console.log(response.data.status);
// console.log(response.data);
// // locationurl(402);
// }
if (response.data.status === 401) {
return config;
}
//
// if (response.data.status === 401) {
// console.log("161");
// console.log(config);
// return config;
// }
// if (response.data.status === 407) {
// 在app js 中解决 Trialapplication
// // </Trialapplication>

@ -574,7 +574,7 @@ class Comments extends Component {
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有评论~</p>
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div>
</div>
: '' }

@ -956,7 +956,7 @@ class Fileslists extends Component{
>
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">无数据哦~</p></div>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p></div>
</div>

@ -715,18 +715,18 @@ class CommonWorkSetting extends Component{
course_id ,
unified_setting: unified_setting, // 统一设置
group_settings: group_settings_param,
publish_time: new Date(temp_publish_time), // 发布
end_time: new Date(temp_end_time), // 截止
publish_time: temp_end_time ? new Date(temp_publish_time) : temp_end_time, // 发布
end_time: temp_end_time ? new Date(temp_end_time) : temp_end_time, // 截止
late_penalty: late_penalty, // 迟交扣分
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:未启用匿评
evaluation_start: new Date(evaluation_start), //匿评开始时间
evaluation_start: evaluation_start ? new Date(evaluation_start) : evaluation_start, //匿评开始时间
evaluation_end: evaluation_end,
evaluation_num: evaluation_num, // 匿评数
absence_penalty: absence_penalty, // 匿评扣分
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, // 违规匿评扣分
ta_mode: ta_mode, // 1:普通模式 0:复审模式
final_mode: final_mode, // true: 单项评分优先, false: 多项评分配比

@ -145,7 +145,7 @@ class CoursesHome extends Component{
{coursesHomelist===undefined?"":coursesHomelist.courses.length===0?<div className="edu-tab-con-box clearfix edu-txt-center mb50">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>:""}
{

@ -9,7 +9,7 @@ class NoneData extends Component{
return(
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
)
}

@ -773,7 +773,7 @@ class GraduationTasks extends Component{
>
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">无数据哦~</p></div>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p></div>
</div>
<div>

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

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

@ -838,7 +838,7 @@ class ShixunStudentWork extends Component {
{datalist === undefined ? "" : datalist.length===0? <div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div>:<Table
dataSource={datalist}

@ -1203,7 +1203,7 @@ class ShixunHomework extends Component{
>
<div className="edu-tab-con-box clearfix edu-txt-center"><img className="edu-nodata-img mb20"
src="/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">无数据哦~</p></div>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p></div>
</div>
</Spin>

@ -68,7 +68,7 @@ class ShixunPathCard extends Component{
):(
<div className="edu-tab-con-box clearfix edu-txt-center mb50">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
)
}

@ -348,14 +348,14 @@ class Challenges extends Component {
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div> : ChallengesDataList.challenge_list === undefined ?
<div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div>
: ChallengesDataList.challenge_list.length === 0 ?
@ -363,7 +363,7 @@ class Challenges extends Component {
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div>
: ChallengesDataList.challenge_list.map((item, key) => {

@ -92,7 +92,7 @@ class Propaedeutics extends Component {
<div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div>
</div>

@ -164,7 +164,7 @@ class Repository extends Component {
trees === undefined || trees === null ? <div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div> :
<div>

@ -64,7 +64,7 @@ class ShixunCard extends Component {
<div className="square-list clearfix">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">无数据哦~</p>
<p className="edu-nodata-p mb20">时还没有相关数据哦</p>
</div>
</div>
<div className="educontent edu-txt-center mb80">

@ -444,8 +444,9 @@ ul.abouttable li .minh-label{min-width: 150px;height: 28px;line-height: 28px;tex
.allNone tr{height: 30px!important;}
/*数据为空公共页面*/
img.edu-nodata-img{ width:300px; margin:50px auto 20px; display: block;}
.edu-nodata-p{ font-size: 20px; text-align: center; color:#999;border-bottom:none!important;padding-left: 18px;box-sizing: border-box;}
img.edu-nodata-img{ width:300px; margin:50px auto 20px; display: block; width: 128px;}
/* 不能加 padding-left: 18px; 会影响其他地方的居中 */
.edu-nodata-p{ font-size: 20px; text-align: center; color:#999;border-bottom:none!important;box-sizing: border-box;}
/*输入为空或者错误的提示*/
.input-none{box-shadow: 0px 0px 2px rgba(0,0,0,0.1);}

Loading…
Cancel
Save