From b09075af21a5ce7f75f5398b7e0cd43142862eba Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 19 Nov 2019 16:22:07 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E6=97=A0=E6=95=B0=E6=8D=AE=E5=85=AC?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E4=BB=B6=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/coursesPublic/NoneData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From e4d65cf571e25d21e4f477518590d06851dfa664 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 19 Nov 2019 17:20:19 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E4=B8=8D=E8=83=BD=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/searchable/shixun.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f3d6ead7caa61a8626732fa343928293f02bf4d8 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Tue, 19 Nov 2019 17:54:12 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9TPI=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/context/TPIContextProvider.js | 13 +++++------ .../modules/page/main/CodeRepositoryView.js | 23 ------------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index bcd470134..d63e02174 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -129,7 +129,8 @@ class TPIContextProvider extends Component { tpm_cases_modified, tpm_modified, tpm_script_modified, - showUpdateDialog: false + showUpdateDialog: false, + initTime: 0 }) } @@ -145,7 +146,6 @@ class TPIContextProvider extends Component { window.__fetchAllFlag = false; this.fetchAll(stageId); - this.costTimeInterval = window.setInterval(()=> { const { game } = this.state; if (!game || game.status === 2) { // 已完成的任务不需要计时 @@ -167,7 +167,7 @@ class TPIContextProvider extends Component { } // force 评测通过后,异步执行该方法,强制同步costTime到服务端 _updateCostTime(async = false, force) { - const { game, loading } = this.state; + const { game, loading, initTime = 0 } = this.state; // TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断 if (!force && (loading || !game || game.status === 2)) { return; // 已完成的任务不需要处理 @@ -178,12 +178,13 @@ class TPIContextProvider extends Component { } // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` + const disTime = Math.abs(game.cost_time - initTime); window.$.ajax({ type: 'get', url: url, async: async, //IMPORTANT, the call will be synchronous data: { - time: game.cost_time + time: disTime } }).done((data) => { console.log('complete'); @@ -406,7 +407,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 +440,7 @@ pop_box_new(htmlvalue, 480, 182); this.setState({ ...resData, - + initTime: game.cost_time, currentGamePassed: false, loading: false, testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), @@ -519,7 +519,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/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) => { From 4b1e2d19c4e3c4f47180092951a9156803c959fa Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 19 Nov 2019 17:54:54 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/usersInfo/InfosCourse.js | 5 +++-- public/react/src/modules/user/usersInfo/InfosPath.js | 3 +-- public/react/src/modules/user/usersInfo/InfosProject.js | 2 +- public/react/src/modules/user/usersInfo/InfosShixun.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) 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 ? :"" } { From c56904381f5302b2cf83fe2a1d850661333a3e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 19 Nov 2019 18:14:32 +0800 Subject: [PATCH 06/16] =?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/public/css/edu-all.css | 2 +- public/stylesheets/educoder/edu-all.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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;} From 9684a5fdc7afb0f4bf6cebc928f8131c489dfe02 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 19 Nov 2019 18:45:08 +0800 Subject: [PATCH 07/16] 1 --- app/views/admins/identity_authentications/shared/_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb index 607feb93a..02c40b5a0 100644 --- a/app/views/admins/identity_authentications/shared/_list.html.erb +++ b/app/views/admins/identity_authentications/shared/_list.html.erb @@ -43,7 +43,7 @@ <%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> <% end %> - <% if user.from_sub_site? %> + <% if user&.from_sub_site? %> 合作 <% end %> From 900a863bf0c37f55478e0e330bd4e0fc050e8f22 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 19 Nov 2019 18:48:54 +0800 Subject: [PATCH 08/16] 1 --- app/models/user.rb | 4 ++++ .../admins/identity_authentications/shared/_list.html.erb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb index 02c40b5a0..607feb93a 100644 --- a/app/views/admins/identity_authentications/shared/_list.html.erb +++ b/app/views/admins/identity_authentications/shared/_list.html.erb @@ -43,7 +43,7 @@ <%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> <% end %> - <% if user&.from_sub_site? %> + <% if user.from_sub_site? %> 合作 <% end %> From cf2966fd14c610711fde16e87b939987a8c1dac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 19 Nov 2019 19:02:58 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/message/js/MessagSub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index f4c768cd3..98036301e 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -153,7 +153,7 @@ class MessagSub extends Component { case "ApplyAddSchools" : if (item.tiding_type === "Apply") { // 单位审批 - return window.open("admins/unit_applies") + return window.open("/admins/unit_applies") } if (item.tiding_type === "System") { // 账号管理页 From 85bf09ea478fc57cc4504be3770879a83ae8a904 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 19 Nov 2019 19:58:25 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E8=80=97=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 2 +- app/views/games/cost_time.json.jbuilder | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 app/views/games/cost_time.json.jbuilder diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index b83431a82..9c5087399 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 ? (@game.cost_time+params[:time]) : params[:time].to_i @game.update_attribute(:cost_time, cost_time) end 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 From 1738f171040b7a6ac4f74517fcaa19155c1471cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 19 Nov 2019 20:02:24 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/competition/CompetitionMaxImg.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 +// //
From 01fec576cbb0c8bf17d125d1198540b90ed42f0e Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Tue, 19 Nov 2019 20:03:56 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/context/TPIContextProvider.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index d63e02174..dce678480 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -130,7 +130,6 @@ class TPIContextProvider extends Component { tpm_modified, tpm_script_modified, showUpdateDialog: false, - initTime: 0 }) } @@ -167,7 +166,7 @@ class TPIContextProvider extends Component { } // force 评测通过后,异步执行该方法,强制同步costTime到服务端 _updateCostTime(async = false, force) { - const { game, loading, initTime = 0 } = this.state; + const { game, loading } = this.state; // TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断 if (!force && (loading || !game || game.status === 2)) { return; // 已完成的任务不需要处理 @@ -178,13 +177,12 @@ class TPIContextProvider extends Component { } // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` - const disTime = Math.abs(game.cost_time - initTime); window.$.ajax({ type: 'get', url: url, async: async, //IMPORTANT, the call will be synchronous data: { - time: disTime + time: game.cost_time } }).done((data) => { console.log('complete'); @@ -440,7 +438,6 @@ pop_box_new(htmlvalue, 480, 182); this.setState({ ...resData, - initTime: game.cost_time, currentGamePassed: false, loading: false, testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), From 33a05bdcf2ebc92e9fbc52ed4574b7baac003c2a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 19 Nov 2019 20:24:06 +0800 Subject: [PATCH 13/16] 1 --- app/controllers/games_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 9c5087399..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 < @game.cost_time ? (@game.cost_time+params[:time]) : params[: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 From ee8e4b3f99b1ddb1573086f979cb9bb0f6cf129c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 20 Nov 2019 10:06:16 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/right_banner.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } From e81e115075f43154fae0ad6fab61b1ba4b1bf5cb Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Wed, 20 Nov 2019 10:32:51 +0800 Subject: [PATCH 15/16] http -> https --- public/react/public/js/codemirror/merge/merge.js | 2 +- public/react/src/history.js | 3 ++- public/react/src/images/shixuns/search.svg | 2 +- public/react/src/images/tpi/message.svg | 2 +- public/react/src/images/tpi/messagegrey.svg | 2 +- public/react/src/images/tpi/sendimg.svg | 2 +- public/react/src/logo.svg | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) 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/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 @@ - - - + From 8341b685243ebd2abaf362e08ebd0d6263fecb72 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 20 Nov 2019 11:09:26 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E8=AE=A1=E7=AE=97=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 10 ++++------ app/jobs/update_shixun_work_score_job.rb | 10 ++++++++++ app/models/student_work.rb | 10 +++++----- .../student_works/shixun_work_report.json.jbuilder | 4 ++-- 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 app/jobs/update_shixun_work_score_job.rb 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/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/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