diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 9b5f0b869..fdaa30305 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -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 # 查看参考答案接口 diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 6042fbc9a..973e73dac 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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? diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 84ee9daf2..cfc1c4ba5 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1597,7 +1597,7 @@ class HomeworkCommonsController < ApplicationController att = attachment.copy att.author_id = homework_bank.user_id att.copy_from = attachment.id - att.attachtype = attachment.attachtype + att.attachtype = attachment.attachtype || 1 homework_bank.attachments << att end homework_bank diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 5ff247729..098c07d1b 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -154,7 +154,7 @@ class QuestionBanksController < ApplicationController att.container_id = nil att.container_type = nil att.author_id = homework.user_id - att.attachtype = attachment.attachtype + att.attachtype = attachment.attachtype || 1 # att.attachtype = 1 att.copy_from = attachment.id att.save! diff --git a/app/models/game.rb b/app/models/game.rb index ae056a702..d81b794a5 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -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 # 判断实训是否全部通关 diff --git a/app/views/courses/search_teacher_candidate.json.jbuilder b/app/views/courses/search_teacher_candidate.json.jbuilder index 33bed4100..49109b729 100644 --- a/app/views/courses/search_teacher_candidate.json.jbuilder +++ b/app/views/courses/search_teacher_candidate.json.jbuilder @@ -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) diff --git a/db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb b/db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb new file mode 100644 index 000000000..a85152894 --- /dev/null +++ b/db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb @@ -0,0 +1,6 @@ +class DeleteContentsIsNullForChallengeAnswers < ActiveRecord::Migration[5.2] + def change + contents = ChallengeAnswer.where("contents = ''") + contents.delete_all + end +end diff --git a/public/images/educoder/nodata.png b/public/images/educoder/nodata.png index 15a9e522f..ad4c76b97 100644 Binary files a/public/images/educoder/nodata.png and b/public/images/educoder/nodata.png differ diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 554cb5bcb..003ef5a9b 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -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 diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 1b2e2b45a..ce5cc8017 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -574,7 +574,7 @@ class Comments extends Component {
-

暂时还没有评论~

+

暂时还没有相关数据哦!

: '' } diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 34fe53e4f..f83b525ee 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -956,7 +956,7 @@ class Fileslists extends Component{ >
-

暂无数据哦~

+

暂时还没有相关数据哦!

diff --git a/public/react/src/modules/courses/coursesHome/CoursesHome.js b/public/react/src/modules/courses/coursesHome/CoursesHome.js index 3f4b4ad12..962413e54 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHome.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHome.js @@ -145,7 +145,7 @@ class CoursesHome extends Component{ {coursesHomelist===undefined?"":coursesHomelist.courses.length===0?
-

暂无数据哦~

+

暂时还没有相关数据哦!

:""} { diff --git a/public/react/src/modules/courses/coursesPublic/NoneData.js b/public/react/src/modules/courses/coursesPublic/NoneData.js index 9e23cbe2e..8c280b6c5 100644 --- a/public/react/src/modules/courses/coursesPublic/NoneData.js +++ b/public/react/src/modules/courses/coursesPublic/NoneData.js @@ -9,7 +9,7 @@ class NoneData extends Component{ return(
-

暂无数据哦~

+

暂时还没有相关数据哦!

) } diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index ac2a226bd..08639b521 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -773,7 +773,7 @@ class GraduationTasks extends Component{ >
-

暂无数据哦~

+

暂时还没有相关数据哦!

diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 8dd33bcd3..0c808e01d 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -838,7 +838,7 @@ class ShixunStudentWork extends Component { {datalist === undefined ? "" : datalist.length===0?
-

暂无数据哦~

+

暂时还没有相关数据哦!

:
-

暂无数据哦~

+

暂时还没有相关数据哦!

diff --git a/public/react/src/modules/paths/ShixunPathCard.js b/public/react/src/modules/paths/ShixunPathCard.js index d538ad255..9260b9f46 100644 --- a/public/react/src/modules/paths/ShixunPathCard.js +++ b/public/react/src/modules/paths/ShixunPathCard.js @@ -68,7 +68,7 @@ class ShixunPathCard extends Component{ ):(
-

暂无数据哦~

+

暂时还没有相关数据哦!

) } diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 85b0920e0..f5d57ae21 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -348,14 +348,14 @@ class Challenges extends Component {
-

暂无数据哦~

+

暂时还没有相关数据哦!

: ChallengesDataList.challenge_list === undefined ?
-

暂无数据哦~

+

暂时还没有相关数据哦!

: ChallengesDataList.challenge_list.length === 0 ? @@ -363,7 +363,7 @@ class Challenges extends Component {
-

暂无数据哦~

+

暂时还没有相关数据哦!

: ChallengesDataList.challenge_list.map((item, key) => { diff --git a/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js b/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js index 7582f52e4..a2b20415d 100644 --- a/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js +++ b/public/react/src/modules/tpm/shixunchild/Propaedeutics/Propaedeu_tics.js @@ -92,7 +92,7 @@ class Propaedeutics extends Component {
-

暂无数据哦~

+

暂时还没有相关数据哦!

diff --git a/public/react/src/modules/tpm/shixunchild/Repository/Repository.js b/public/react/src/modules/tpm/shixunchild/Repository/Repository.js index acdeb616b..c888ba6d8 100644 --- a/public/react/src/modules/tpm/shixunchild/Repository/Repository.js +++ b/public/react/src/modules/tpm/shixunchild/Repository/Repository.js @@ -164,7 +164,7 @@ class Repository extends Component { trees === undefined || trees === null ?
-

暂无数据哦~

+

暂时还没有相关数据哦!

:
diff --git a/public/react/src/modules/tpm/shixuns/ShixunCard.js b/public/react/src/modules/tpm/shixuns/ShixunCard.js index 18e261bb5..ae6aa696d 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunCard.js +++ b/public/react/src/modules/tpm/shixuns/ShixunCard.js @@ -64,7 +64,7 @@ class ShixunCard extends Component {
-

暂无数据哦~

+

暂时还没有相关数据哦!

diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index 3777201b4..af2725447 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -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);}