From c0e5eda9f125bae79d27445d3c08b1873811fca9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 10:38:54 +0800 Subject: [PATCH 01/14] 1 --- lib/tasks/sync_evaluate.rake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index 831792a90..9db748e6a 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -2,12 +2,18 @@ desc "同步学院或者单位评测数" namespace :sync_evaluate do task outpus_count: :environment do - School.find_each do |school| + if ENV['school_id'].present? + schools = School.where(id: ENV['school_id']) + else + schools = School.all + end + schools.find_each do |school| Parallel.each_with_index(school, in_processes: 5) do |s| puts "school_id:#{s.id}" evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where g.user_id = ue.user_id and ue.school_id = '#{s.id}'").first.try(:e_count) + puts "evaluate_count: #{evaluate_count}" report = SchoolReport.find_or_initialize_by(school_id: s.id) report.school_name = s.name report.shixun_evaluate_count = evaluate_count From 22f20a1b6a59ddd0361412220eb6c35a44ba5abb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 10:40:13 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_evaluate.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index 9db748e6a..0613817b9 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -3,7 +3,7 @@ desc "同步学院或者单位评测数" namespace :sync_evaluate do task outpus_count: :environment do if ENV['school_id'].present? - schools = School.where(id: ENV['school_id']) + schools = School.where(id: ENV['school_id'].to_i) else schools = School.all end From f4c779e7ab47b31216a062fb141d2f76f8271cf2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 10:41:36 +0800 Subject: [PATCH 03/14] 1 --- lib/tasks/sync_evaluate.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index 0613817b9..14d6d7acc 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -7,8 +7,8 @@ namespace :sync_evaluate do else schools = School.all end - schools.find_each do |school| - Parallel.each_with_index(school, in_processes: 5) do |s| + schools.find_each do |s| + #Parallel.each_with_index(school, in_processes: 5) do |s| puts "school_id:#{s.id}" evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where g.user_id = ue.user_id and ue.school_id = '#{s.id}'").first.try(:e_count) @@ -19,7 +19,7 @@ namespace :sync_evaluate do report.shixun_evaluate_count = evaluate_count report.save - end + #end end end end \ No newline at end of file From 452a38117ada80868d5999b36cb79df5fe34ba0e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 11:03:49 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_evaluate.rake | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index 14d6d7acc..bb54f9565 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -2,13 +2,8 @@ desc "同步学院或者单位评测数" namespace :sync_evaluate do task outpus_count: :environment do - if ENV['school_id'].present? - schools = School.where(id: ENV['school_id'].to_i) - else - schools = School.all - end - schools.find_each do |s| - #Parallel.each_with_index(school, in_processes: 5) do |s| + schools.find_each do |school| + Parallel.each_with_index(school, in_processes: 5) do |s| puts "school_id:#{s.id}" evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where g.user_id = ue.user_id and ue.school_id = '#{s.id}'").first.try(:e_count) @@ -19,7 +14,7 @@ namespace :sync_evaluate do report.shixun_evaluate_count = evaluate_count report.save - #end + end end end end \ No newline at end of file From bc20d0a09e1a740895b377ee95c1e02ba56697d0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 11:08:51 +0800 Subject: [PATCH 05/14] 1 --- lib/tasks/sync_evaluate.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index bb54f9565..65ce0a355 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -2,7 +2,7 @@ desc "同步学院或者单位评测数" namespace :sync_evaluate do task outpus_count: :environment do - schools.find_each do |school| + School.find_each do |school| Parallel.each_with_index(school, in_processes: 5) do |s| puts "school_id:#{s.id}" evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where From d368edb988dc62f6b13c0d3e370bc70008fccd78 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 11:13:49 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_evaluate.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index 65ce0a355..67117f613 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -2,7 +2,7 @@ desc "同步学院或者单位评测数" namespace :sync_evaluate do task outpus_count: :environment do - School.find_each do |school| + School.find_in_batches(batch_size: 50) do |school| Parallel.each_with_index(school, in_processes: 5) do |s| puts "school_id:#{s.id}" evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where From 1a14231a47fe3e01ab45607dbd39dd5da4230a7a Mon Sep 17 00:00:00 2001 From: harry Date: Sun, 8 Mar 2020 11:20:27 +0800 Subject: [PATCH 07/14] =?UTF-8?q?fix=20=E4=BB=8E=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E5=90=8E=E7=BC=96=E8=BE=91=E5=99=A8=E7=99=BD?= =?UTF-8?q?=E5=BA=95=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/developer/recordDetail/index.scss | 6 ------ 1 file changed, 6 deletions(-) diff --git a/public/react/src/modules/developer/recordDetail/index.scss b/public/react/src/modules/developer/recordDetail/index.scss index b7c093fdd..be5e68a06 100644 --- a/public/react/src/modules/developer/recordDetail/index.scss +++ b/public/react/src/modules/developer/recordDetail/index.scss @@ -1,11 +1,5 @@ @import '../split_pane_resizer.scss'; -.result_code_area .monaco-editor, -.monaco-editor-background, -.monaco-editor .inputarea.ime-input { - background-color: #f9f9f9 !important; -} - .result_code_area .monaco-editor .line-numbers { color: #999 !important; } From 0ad473878ac68d5ac2c598a0807a097ece217ed4 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Sun, 8 Mar 2020 12:38:10 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/css/Courses.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index a525cbb6f..12ac47997 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -435,7 +435,8 @@ a.white-btn.use_scope-btn:hover{ .maxwidth190{max-width: 190px; color:#666666;font-size: 14px;} .color05101A{color:#05101A;} .liactive{border-left: 1px solid #4CACFF;} -.ant-btn-lg{height: 39px;} +.xaxisreverseorder .ant-input-group-addon .ant-btn-lg{height: 38px;} +.ant-input-group-addon .ant-btn-lg{height: 39px;border-radius: 0px 3px 3px 0px!important;border: none!important;} .bannername{ max-width: 907px; overflow: hidden; From 8a0b12166b9d126870c49fac04549a7f469944fa Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Sun, 8 Mar 2020 12:38:13 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/constants/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/constants/index.js b/public/react/src/constants/index.js index e9401e76e..ad983f8c9 100644 --- a/public/react/src/constants/index.js +++ b/public/react/src/constants/index.js @@ -81,7 +81,7 @@ const CONST = { type: 'label', content: [ { - text: '字体大小', + text: '代码保存', value: 'CTRL + S' }, { From f5f22ca351a951910c211b46a383674fa1bf9bbe Mon Sep 17 00:00:00 2001 From: harry Date: Sun, 8 Mar 2020 12:48:45 +0800 Subject: [PATCH 10/14] =?UTF-8?q?fix=20c++=E8=AF=AD=E6=B3=95=E9=AB=98?= =?UTF-8?q?=E4=BA=AE=20=E4=BB=A3=E7=A0=81=E4=B8=8D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/myMonacoEditor/index.js | 26 +++++-------------- .../newOrEditTask/leftpane/editorTab/index.js | 2 +- .../developer/studentStudy/rightpane/index.js | 8 ++++-- public/react/src/redux/actions/ojForUser.js | 4 +-- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/public/react/src/modules/developer/components/myMonacoEditor/index.js b/public/react/src/modules/developer/components/myMonacoEditor/index.js index 87f9da0bd..790c1481d 100644 --- a/public/react/src/modules/developer/components/myMonacoEditor/index.js +++ b/public/react/src/modules/developer/components/myMonacoEditor/index.js @@ -11,7 +11,8 @@ import React, { useState, useRef, useEffect } from 'react'; import { Drawer, Tooltip, Badge } from 'antd'; import { fromStore, CNotificationHOC } from 'educoder'; import { connect } from 'react-redux'; -import MonacoEditor from '@monaco-editor/react'; +import { ControlledEditor } from '@monaco-editor/react'; + import SettingDrawer from '../../components/monacoSetting'; import CONST from '../../../../constants'; import MyIcon from '../../../../common/components/MyIcon'; @@ -47,8 +48,6 @@ function MyMonacoEditor(props, ref) { return fromStore('oj_theme') || 'dark'; }); const [height, setHeight] = useState('calc(100% - 56px)'); - const editorRef = useRef(null); - console.log(language, code, '-------========----------') useEffect(() => { setHeight(showOrHideControl ? 'calc(100% - 378px)' : 'calc(100% - 56px)'); @@ -71,21 +70,10 @@ function MyMonacoEditor(props, ref) { setTheme(value); } - // 文本框内容变化时,记录文本框内容 - const handleEditorChange = (_, monaco) => { - editorRef.current = monaco; // 获取当前monaco实例 - } - useEffect(() => { - if (editorRef.current) { - editorRef.current.onDidChangeModelContent(e => { // 监听编辑器内容的变化 - const val = editorRef.current.getValue(); - onCodeChange(val); - }); - } - }, [ - editorRef.current - ]) + function onChangeHandler(ev, value) { + onCodeChange(value); + } // 配置编辑器属性 const editorOptions = { @@ -152,14 +140,14 @@ function MyMonacoEditor(props, ref) { - diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index 13ecd0b07..acbdfc393 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -26,7 +26,7 @@ const { Option } = Select; const maps = { language: [ { title: 'C', key: 'C' }, - { title: 'C++', key: 'C++' }, + { title: 'C++', key: 'cpp' }, { title: 'Python', key: 'Python' }, { title: 'Java', key: 'Java' } ], diff --git a/public/react/src/modules/developer/studentStudy/rightpane/index.js b/public/react/src/modules/developer/studentStudy/rightpane/index.js index 0b0b96556..c5a71e290 100644 --- a/public/react/src/modules/developer/studentStudy/rightpane/index.js +++ b/public/react/src/modules/developer/studentStudy/rightpane/index.js @@ -57,7 +57,7 @@ const RightPane = (props) => { timer = setInterval(function () { clearInterval(timer); timer = null; - saveUserCodeForInterval(identifier); + saveUserCodeForInterval(identifier, value); }, 5000); } } @@ -99,13 +99,17 @@ const RightPane = (props) => { }); } const { getFieldDecorator } = props.form; + let language = hack.language + if (language === 'C++') { + language = 'cpp' + } return (
{ export const saveUserCodeForInterval = (identifier, code) => { return (dispatch, getState) => { - const { userCode } = getState().ojForUserReducer; dispatch({ type: types.AUTO_UPDATE_CODE, payload: true }); fetchUpdateCode(identifier, { - code: Base64.encode(userCode) + code: Base64.encode(code) }).then(res => { if (res.data.status === 401) { return; @@ -135,7 +134,6 @@ export const saveUserCodeForInterval = (identifier, code) => { * @param {*} type 测评类型 debug | submit */ export const updateCode = (identifier, inputValue, type) => { - console.log(1111); return (dispatch, getState) => { const { userCode, isUpdateCode } = getState().ojForUserReducer; if (isUpdateCode) { From c492bdd449b0c00f9107a63a8995adfbd7d7fcfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sun, 8 Mar 2020 14:16:21 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/redux/actions/ojForm.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 05c28b07d..b11c99a8b 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -167,7 +167,6 @@ export const validateOjForm = (props, type, cb) => { }); tcValidResult.push(tempObj); }); - try { if(ojForm.sub_discipline_id.length===0){ hasSuccess = false; From 469de6928fc01b657e99a8561df6185ab36f24cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sun, 8 Mar 2020 15:46:51 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/redux/actions/ojForm.js | 72 +++++++++++++----------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index b11c99a8b..1c88cec41 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -142,7 +142,7 @@ export const validateOjForm = (props, type, cb) => { let validateResult = emptyValidate(key, value); const errMsg = validateResult[key].errMsg; if (errMsg) { - // hasSuccess = false; + hasSuccess = false; } else { // 唯一性校验 const bool = testCases.some((item, j) => { @@ -167,38 +167,7 @@ export const validateOjForm = (props, type, cb) => { }); tcValidResult.push(tempObj); }); - try { - if(ojForm.sub_discipline_id.length===0){ - hasSuccess = false; - notification['error']({ - message: '提示', - description: '课程必须选择!' - }); - - }else if(ojForm.timeLimit===null){ - hasSuccess = false; - notification['error']({ - message: '提示', - description: '时间限制必须输入!' - }); - } else if(ojForm.name.length===0){ - hasSuccess = false; - notification['error']({ - message: '提示', - description: '任务名称必须输入!' - }); - - }else if(ojForm.description.length===0){ - hasSuccess = false; - notification['error']({ - message: '提示', - description: '描述必须输入!' - }); - } - - }catch (e) { - - } + // if (testCases.length === 0) { // hasSuccess = false; @@ -233,6 +202,43 @@ export const validateOjForm = (props, type, cb) => { payload: false }); } + + + try { + if(ojForm.sub_discipline_id.length===0){ + hasSuccess = false; + notification['error']({ + message: '提示', + description: '课程必须选择!' + }); + + }else if(ojForm.timeLimit===null){ + hasSuccess = false; + notification['error']({ + message: '提示', + description: '时间限制必须输入!' + }); + } else if(ojForm.name.length===0){ + hasSuccess = false; + notification['error']({ + message: '提示', + description: '任务名称必须输入!' + }); + + }else if(ojForm.description.length===0){ + hasSuccess = false; + notification['error']({ + message: '提示', + description: '描述必须输入!' + }); + } + + }catch (e) { + + } + + + /** 表单验证结束 */ /** 表单验证通过后,调用保存 or 更新 or 发布 */ if (hasSuccess) { From cd2d87c5b26ce4ab75e440a8eabea67b8c1234f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sun, 8 Mar 2020 15:50:24 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/redux/actions/ojForm.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 1c88cec41..07ddbb48b 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -132,6 +132,7 @@ export const validateOjForm = (props, type, cb) => { } }); // 验证测试用例中的数组是否都有对应的值 + let tcbool=false; const tcValidResult = []; // 验证测试用例: 1.必须要有输出值 2. 输入值与输出值必须唯一 testCases.forEach((obj, i) => { @@ -143,6 +144,16 @@ export const validateOjForm = (props, type, cb) => { const errMsg = validateResult[key].errMsg; if (errMsg) { hasSuccess = false; + + if(tcbool===false){ + tcbool=true + notification['error']({ + message: '提示', + description: '测试用例必须填写输出!' + }); + + } + } else { // 唯一性校验 const bool = testCases.some((item, j) => { From 1a2461eacdf91b65914397d4dd77e748e14f974f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sun, 8 Mar 2020 16:51:16 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/redux/actions/ojForm.js | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 07ddbb48b..62de0fed8 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -142,17 +142,24 @@ export const validateOjForm = (props, type, cb) => { // 非空校验 let validateResult = emptyValidate(key, value); const errMsg = validateResult[key].errMsg; - if (errMsg) { - hasSuccess = false; - - if(tcbool===false){ - tcbool=true - notification['error']({ - message: '提示', - description: '测试用例必须填写输出!' - }); + // console.log("-------"); + // console.log(errMsg); + // console.log(key); + // console.log(value); + + if (errMsg) { + if(key==="output"){ + hasSuccess = false; + if(tcbool===false){ + tcbool=true + notification['error']({ + message: '提示', + description: '测试用例必须填写输出!' + }); + + } + } - } } else { // 唯一性校验