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

dev_forum
杨树林 5 years ago
commit ea6245ba93

@ -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
# 查看参考答案接口 # 查看参考答案接口

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

@ -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!

@ -31,7 +31,7 @@ class Game < ApplicationRecord
# 根据得分比例来算实际得分(试卷、实训作业) # 根据得分比例来算实际得分(试卷、实训作业)
def real_score score 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 end
# 判断实训是否全部通关 # 判断实训是否全部通关

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

@ -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 axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy"; import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage ,SetAppModel} from 'educoder'; import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString} from 'educoder';
import { notification } from 'antd'; import { notification } from 'antd';
import './index.css' import './index.css'
broadcastChannelOnmessage('refreshPage', () => { broadcastChannelOnmessage('refreshPage', () => {
@ -18,10 +18,19 @@ function locationurl(list){
} }
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
const debugType ="" let debugType = ""
// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : if (isDev) {
// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' const _search = window.location.search;
// window._debugType = debugType; 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) { export function initAxiosInterceptors(props) {
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation // TODO 避免重复的请求 https://github.com/axios/axios#cancellation

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

@ -956,7 +956,7 @@ class Fileslists extends Component{
> >
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="/images/educoder/nodata.png" /> <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>

@ -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"> {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")}/> <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>:""}
{ {

@ -9,7 +9,7 @@ class NoneData extends Component{
return( return(
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <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>
) )
} }

@ -773,7 +773,7 @@ class GraduationTasks extends Component{
> >
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="/images/educoder/nodata.png" /> <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>
<div> <div>

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

@ -68,7 +68,7 @@ class ShixunPathCard extends Component{
):( ):(
<div className="edu-tab-con-box clearfix edu-txt-center mb50"> <div className="edu-tab-con-box clearfix edu-txt-center mb50">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <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>
) )
} }

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

@ -92,7 +92,7 @@ class Propaedeutics extends Component {
<div className="alltask"> <div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <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> </div>
</div> </div>

@ -164,7 +164,7 @@ class Repository extends Component {
trees === undefined || trees === null ? <div className="alltask"> trees === undefined || trees === null ? <div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <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> : </div> :
<div> <div>

@ -64,7 +64,7 @@ class ShixunCard extends Component {
<div className="square-list clearfix"> <div className="square-list clearfix">
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <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> </div>
<div className="educontent edu-txt-center mb80"> <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;} .allNone tr{height: 30px!important;}
/*数据为空公共页面*/ /*数据为空公共页面*/
img.edu-nodata-img{ width:300px; margin:50px auto 20px; display: block;} img.edu-nodata-img{ width:300px; margin:50px auto 20px; display: block; width: 128px;}
.edu-nodata-p{ font-size: 20px; text-align: center; color:#999;border-bottom:none!important;padding-left: 18px;box-sizing: border-box;} /* 不能加 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);} .input-none{box-shadow: 0px 0px 2px rgba(0,0,0,0.1);}

Loading…
Cancel
Save