diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index b83431a82..3f7a451fd 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -768,7 +768,7 @@ class GamesController < ApplicationController # REDO:需要添加详细的说明 def cost_time #return if @game.status >= 2 - cost_time = (params[:time].to_i < 0 ? 0 : params[:time].to_i) + @game.cost_time.to_i + cost_time = params[:time].to_i < @game.cost_time.to_i ? (@game.cost_time.to_i + params[:time].to_i) : params[:time].to_i @game.update_attribute(:cost_time, cost_time) end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 94ced56fd..a8a586759 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -625,14 +625,12 @@ class HomeworkCommonsController < ApplicationController @homework.score_open = params[:score_open] @homework.save! - # if score_change - # @homework.student_works.has_committed.each do |student_work| - # HomeworksService.new.set_shixun_final_score student_work - # end - # end + if score_change && @homework.end_or_late_none_group + UpdateShixunWorkScoreJob.perform_now(@homework.id) + end # 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止) - if update_eff_score && @homework.end_or_late_none_group + if !score_change && update_eff_score && @homework.end_or_late_none_group HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id) end diff --git a/app/jobs/update_shixun_work_score_job.rb b/app/jobs/update_shixun_work_score_job.rb new file mode 100644 index 000000000..1701915c9 --- /dev/null +++ b/app/jobs/update_shixun_work_score_job.rb @@ -0,0 +1,10 @@ +class UpdateShixunWorkScoreJob < ApplicationJob + queue_as :default + + def perform(homework_id) + homework = HomeworkCommon.find_by(id: homework_id) + return if homework.blank? + + homework.update_homework_work_score + end +end diff --git a/app/models/searchable/shixun.rb b/app/models/searchable/shixun.rb index 3229f278f..c574ecb1d 100644 --- a/app/models/searchable/shixun.rb +++ b/app/models/searchable/shixun.rb @@ -39,7 +39,7 @@ module Searchable::Shixun end def should_index? - [0, 1, 2].include?(status) # published + !hidden? && [0, 1, 2].include?(status) # published end def to_searchable_json diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 8477da774..d4f372823 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -111,14 +111,14 @@ class StudentWork < ApplicationRecord # 作品总体评价 def overall_appraisal - case self.work_score.to_i - when (90..100) + case (self.work_score.to_f / homework_common.total_score).round(2) + when (0.90..1.00) '优秀' - when (70...90) + when (0.70...0.90) '良好' - when (60...70) + when (0.60...0.70) '及格' - when (0...60) + when (0.00...0.60) '不及格' end end diff --git a/app/models/user.rb b/app/models/user.rb index 74d9b11d2..ec0640700 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -699,6 +699,10 @@ class User < ApplicationRecord LimitForbidControl::UserLogin.new(self).clear end + def from_sub_site? + laboratory_id.present? && laboratory_id != 1 + end + protected def validate_password_length # 管理员的初始密码是5位 diff --git a/app/views/games/cost_time.json.jbuilder b/app/views/games/cost_time.json.jbuilder new file mode 100644 index 000000000..76e908307 --- /dev/null +++ b/app/views/games/cost_time.json.jbuilder @@ -0,0 +1 @@ +json.identifier @game.identifier \ No newline at end of file diff --git a/app/views/student_works/shixun_work_report.json.jbuilder b/app/views/student_works/shixun_work_report.json.jbuilder index 40b0e28c2..162e2ab1c 100644 --- a/app/views/student_works/shixun_work_report.json.jbuilder +++ b/app/views/student_works/shixun_work_report.json.jbuilder @@ -11,13 +11,13 @@ if @shixun json.myself_experience @work.myshixun.try(:total_score).to_i json.total_experience @shixun.all_score json.work_score number_with_precision @work.work_score.to_f.round(2), precision: 1 - json.all_work_score number_with_precision 100, precision: 1 + json.all_work_score number_with_precision @homework.total_score, precision: 1 json.time_consuming @work.myshixun_consume json.evaluate_count @user_evaluate_count.to_i if @homework.work_efficiency json.eff_score_full number_with_precision @homework.eff_score, precision: 1 json.eff_score number_with_precision @work.eff_score.to_f.round(2), precision: 1 - json.challenge_score_full number_with_precision (100 - @homework.eff_score), precision: 1 + json.challenge_score_full number_with_precision (@homework.total_score - @homework.eff_score), precision: 1 json.challenge_score number_with_precision @work.final_score.to_f.round(2), precision: 1 end diff --git a/app/views/subjects/right_banner.json.jbuilder b/app/views/subjects/right_banner.json.jbuilder index ef5645f26..f9a52af83 100644 --- a/app/views/subjects/right_banner.json.jbuilder +++ b/app/views/subjects/right_banner.json.jbuilder @@ -1,4 +1,4 @@ -json.qrcode_img Util::FileManage.exists?(@subject, '_qrcode') ? Util::FileManage.source_disk_file_url(@subject, '_qrcode') : nil +json.qrcode_img nil json.members @members do |member| json.partial! 'subject_member', locals: { user: member.user } diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index d25a6fdde..f51e0e630 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -509,7 +509,7 @@ li.li-width7{width: 7%;text-align: left} background-position: center; background-repeat: no-repeat; } -.invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6)} +.invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6);z-index: 5000;} .inviteTipbtn a{font-size:14px;width: 100%;height: 30px;line-height: 30px;display: block;color: #747A7F;background-color: rgba(5,16,26,0.4)} .inviteTipbtn a:hover{color: #4cacff!important;} .top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;} diff --git a/public/react/public/js/codemirror/merge/merge.js b/public/react/public/js/codemirror/merge/merge.js index 25b44e513..a4337b8c4 100755 --- a/public/react/public/js/codemirror/merge/merge.js +++ b/public/react/public/js/codemirror/merge/merge.js @@ -13,7 +13,7 @@ })(function(CodeMirror) { "use strict"; var Pos = CodeMirror.Pos; - var svgNS = "http://www.w3.org/2000/svg"; + var svgNS = "https://www.w3.org/2000/svg"; var value, orig1, orig2, dv, panes = 2, highlight = true, connect = null, collapse = false; CodeMirror.k_init=function(id,newData,oldData){ diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index bcd470134..dce678480 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -129,7 +129,7 @@ class TPIContextProvider extends Component { tpm_cases_modified, tpm_modified, tpm_script_modified, - showUpdateDialog: false + showUpdateDialog: false, }) } @@ -145,7 +145,6 @@ class TPIContextProvider extends Component { window.__fetchAllFlag = false; this.fetchAll(stageId); - this.costTimeInterval = window.setInterval(()=> { const { game } = this.state; if (!game || game.status === 2) { // 已完成的任务不需要计时 @@ -183,7 +182,7 @@ class TPIContextProvider extends Component { url: url, async: async, //IMPORTANT, the call will be synchronous data: { - time: game.cost_time + time: game.cost_time } }).done((data) => { console.log('complete'); @@ -406,7 +405,6 @@ pop_box_new(htmlvalue, 480, 182); } resData.game = game; - const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData; if (myshixun.system_tip) { // system_tip为true的时候 不弹框提示用户更新 @@ -440,7 +438,6 @@ pop_box_new(htmlvalue, 480, 182); this.setState({ ...resData, - currentGamePassed: false, loading: false, testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), @@ -519,7 +516,6 @@ pop_box_new(htmlvalue, 480, 182); // var url = `/api/v1/games/${stageId}` var url = `/tasks/${stageId}.json` - // {"status":1,"message":"undefined method `authenticate!' for #"} window.__fetchAllFlag = true; diff --git a/public/react/src/history.js b/public/react/src/history.js index 943008704..fe2ed9e02 100644 --- a/public/react/src/history.js +++ b/public/react/src/history.js @@ -1,4 +1,5 @@ -import createHistory from 'history/createBrowserHistory'; +// import createHistory from 'history/createBrowserHistory'; +const createHistory = require('history').createBrowserHistory; const history = createHistory(); diff --git a/public/react/src/images/shixuns/search.svg b/public/react/src/images/shixuns/search.svg index cf0e16c0c..3548b7b84 100644 --- a/public/react/src/images/shixuns/search.svg +++ b/public/react/src/images/shixuns/search.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/react/src/images/tpi/message.svg b/public/react/src/images/tpi/message.svg index ca544e7ce..2bc508b5c 100644 --- a/public/react/src/images/tpi/message.svg +++ b/public/react/src/images/tpi/message.svg @@ -1,6 +1,6 @@ - - - + diff --git a/public/react/src/modules/competition/CompetitionMaxImg.js b/public/react/src/modules/competition/CompetitionMaxImg.js index 9f9906487..fe172221f 100644 --- a/public/react/src/modules/competition/CompetitionMaxImg.js +++ b/public/react/src/modules/competition/CompetitionMaxImg.js @@ -38,8 +38,8 @@ class CompetitionMaxImg extends React.Component {
-

Educoder竞赛平台

-

Educoder是一个面向计算机类的互联网IT教育和实战平台,

+

在线竞赛平台

+

在线竞赛平台是一个面向计算机类的互联网IT教育和实战平台,

提供企业级工程实训,以实现工程化专业教学的自动化和智能化。

@@ -57,8 +57,8 @@ class CompetitionMaxImg extends React.Component {
-

Educoder竞赛平台

-

Educoder是一个面向计算机类的互联网IT教育和实战平台,

+

在线竞赛平台

+

在线竞赛平台是一个面向计算机类的互联网IT教育和实战平台,

提供企业级工程实训,以实现工程化专业教学的自动化和智能化。

@@ -76,8 +76,8 @@ class CompetitionMaxImg extends React.Component {
-

Educoder竞赛平台

-

Educoder是一个面向计算机类的互联网IT教育和实战平台,

+

在线竞赛平台

+

在线竞赛平台是一个面向计算机类的互联网IT教育和实战平台,

提供企业级工程实训,以实现工程化专业教学的自动化和智能化。

@@ -92,8 +92,8 @@ class CompetitionMaxImg extends React.Component { : type === 6 ?
-

Educoder竞赛平台

-

Educoder是一个面向计算机类的互联网IT教育和实战平台,

+

在线竞赛平台

+

在线竞赛平台是一个面向计算机类的互联网IT教育和实战平台,

提供企业级工程实训,以实现工程化专业教学的自动化和智能化。

{ @@ -160,4 +160,4 @@ export default CompetitionMaxImg; // //
// // // //
-// //
\ No newline at end of file +// //
diff --git a/public/react/src/modules/courses/coursesPublic/NoneData.js b/public/react/src/modules/courses/coursesPublic/NoneData.js index 35d7a5271..e039fd0d0 100644 --- a/public/react/src/modules/courses/coursesPublic/NoneData.js +++ b/public/react/src/modules/courses/coursesPublic/NoneData.js @@ -8,7 +8,7 @@ class NoneData extends Component{ render(){ const { style } = this.props; return( -
+
-

+ } + +

+
+ +
-
- -
- ) - })} + ) + })} + {/*页数*/} + {data === undefined ? "" + : + (count > 10 ? +
+
+ +
+
: "" + ) + }
- {/*页数*/} - {data === undefined ? "" - : - (count > 10 ? -
-
- -
-
: "" - ) - - }
) } } -export default MessagSub; \ No newline at end of file +export default MessagSub; diff --git a/public/react/src/modules/page/main/CodeRepositoryView.js b/public/react/src/modules/page/main/CodeRepositoryView.js index acdf7693d..5dd87f6a0 100644 --- a/public/react/src/modules/page/main/CodeRepositoryView.js +++ b/public/react/src/modules/page/main/CodeRepositoryView.js @@ -112,29 +112,6 @@ class CodeRepositoryView extends Component { .removeClass("codeRepoShow") // .removeClass("fa-caret-down").addClass("fa-caret-right"); }) - - // $('#codetab_con_1').append(``) - // $('#codetab_con_1 .codemirrorBackground').hide() - window.addEventListener('beforeunload', this.beforeUnload); - } - - componentWillUnmount () { - window.removeEventListener('beforeunload', this.beforeUnload); - } - - beforeUnload = (e) => { - // console.log(this.props); - const { game } = this.props; - const url = `/api/tasks/${game.identifier}/cost_time.json`; - axios.get(url).then(res => { - // TODO - }); - const msg = '确定要离开吗?'; - e = e || window.event; - if (e) { - e.returnValue = msg; - } - return msg; } onTreeSelect = (selectedKeys, info) => { diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index 7a56d0ccf..992954489 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -313,10 +313,11 @@ class InfosCourse extends Component{ {/* 289 */} { page == 1 && is_current && !category && - this.props.current_user && this.props.current_user.user_identity != "学生" ? : "" + this.props.current_user && this.props.current_user.user_identity != "学生" ? + : "" } { - (!data || (data && data.courses.length==0)) && category && + (!data || (data && data.courses.length === 0)) && (category || (!category && this.props.current_user && this.props.current_user.user_identity == "学生")) && } { data && data.courses && data.courses.map((item,key)=>{ diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index e89d120da..d9db6108d 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -327,8 +327,7 @@ class InfosPath extends Component{
{/* 295 */} { - page == 1 && is_current && !category && - this.props.current_user && this.props.current_user.user_identity != "学生" ? :"" + page == 1 && is_current && !category ? :"" } { (!data || (data && data.subjects.length==0)) && category && diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index e1895a406..9dccd1c3d 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -313,7 +313,7 @@ class InfosProject extends Component{
{/* 289 */} { - page == 1 && is_current && this.props.current_user && !category && this.props.current_user.user_identity != "学生" ? + page == 1 && is_current ? :"" diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 6e3a31418..22c4e7fcf 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -335,7 +335,7 @@ class InfosShixun extends Component{
{/* 298 */} { - page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? + page == 1 && is_current && !category ? :"" } { diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 5aace2464..3ed8a36c3 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -513,7 +513,7 @@ li.li-width7{width: 7%;text-align: left} background-position: center; background-repeat: no-repeat; } -.invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6)} +.invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6);z-index: 5000;} .inviteTipbtn a{font-size:14px;width: 100%;height: 30px;line-height: 30px;display: block;color: #747A7F;background-color: rgba(5,16,26,0.4)} .inviteTipbtn a:hover{color: #4cacff!important;} .top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;}