From 50dd27e744828c4b3226f879a0a32c9447564b8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 25 Jul 2019 16:52:04 +0800
Subject: [PATCH 1/6] b
---
public/react/src/modules/tpm/newshixuns/Newshixuns.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
index 8cb79e9d0..c15269c5a 100644
--- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js
+++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
@@ -16,6 +16,7 @@ import './css/Newshixuns.css';
import {getUrl} from 'educoder'
+import moment from 'moment';
let path = getUrl("/editormd/lib/")
From 016f6377eb8910f24b78bdb586c8cea6352944da Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Thu, 25 Jul 2019 17:06:56 +0800
Subject: [PATCH 2/6] current_user &&
---
public/react/src/modules/courses/exercise/ExerciseNew.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js
index fe1b8f565..f5332d56e 100644
--- a/public/react/src/modules/courses/exercise/ExerciseNew.js
+++ b/public/react/src/modules/courses/exercise/ExerciseNew.js
@@ -407,11 +407,11 @@ class ExerciceNew extends Component{
}
`}
-
+ ]}> }
{this.isEdit ? "编辑" : "新建"}试卷
From 8debe9d99ea56eaea61dbe08ff1685cc0a7ce50b Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Thu, 25 Jul 2019 17:07:02 +0800
Subject: [PATCH 3/6] key
---
.../src/modules/courses/exercise/ExerciseDisplay.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/ExerciseDisplay.js b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
index 4da4768d2..bd70bece6 100644
--- a/public/react/src/modules/courses/exercise/ExerciseDisplay.js
+++ b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
@@ -120,35 +120,35 @@ class ExerciseDisplay extends Component{
return
} else if (item.question_type == 2) {
return
} else if (item.question_type == 3) {
return
} else if (item.question_type == 4) {
return
} else if (item.question_type == 5) {
return
}
From aa32f311f61b43fffe5fd4b3c87bcee4546561c6 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 25 Jul 2019 17:08:55 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=88=90=E7=BB=A9?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../homework_commons_controller.rb | 8 +--
app/services/homeworks_service.rb | 49 ++++++++++--------
dump.rdb | Bin 0 -> 551 bytes
3 files changed, 31 insertions(+), 26 deletions(-)
create mode 100644 dump.rdb
diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb
index cfc1c4ba5..4c8d2a729 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -246,13 +246,15 @@ class HomeworkCommonsController < ApplicationController
student_works = @homework.student_works.where(user_id: user_ids)
end
- myshixuns = Myshixun.where(shixun_id: @homework.homework_commons_shixun&.shixun_id, user_id: user_ids).
- includes(:games).where(games: {challenge_id: @homework.homework_challenge_settings.pluck(:challenge_id)})
+ student_works = student_works.includes(:challenge_work_scores)
+
challenge_settings = @homework.homework_challenge_settings
+ challenge_setting_ids = challenge_settings.pluck(:challenge_id)
+ myshixuns = Myshixun.where(shixun_id: @homework.homework_commons_shixun&.shixun_id, user_id: user_ids).includes(:games)
myshixuns.find_each(batch_size: 100) do |myshixun|
work = student_works.select{|work| work.user_id == myshixun.user_id}.first
if work && myshixun
- games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id))
+ games = myshixun.games.select{|game| challenge_setting_ids.include?(game.challenge_id)}
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
end
end
diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb
index b835685a6..ab149403d 100644
--- a/app/services/homeworks_service.rb
+++ b/app/services/homeworks_service.rb
@@ -286,7 +286,7 @@ class HomeworksService
challenge_setting = challenge_settings.select{|setting| setting.challenge_id == game.challenge_id}.first
pass_consume_time += (game.cost_time / 60.0).to_f
user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
- adjust_score = work.challenge_work_scores.where(:challenge_id => game.challenge_id).last
+ adjust_score = work.challenge_work_scores.select{|work_score| work_score.challenge_id == game.challenge_id}.last
final_score += if adjust_score.present?
adjust_score.score
elsif homework.homework_detail_manual.answer_open_evaluation
@@ -300,19 +300,6 @@ class HomeworksService
end
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
- if myshixun_endtime.present?
- work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
-
- efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
- work.efficiency = format("%.2f", efficiency)
-
- if myshixun_endtime <= homework_end_or_late_time
- work.compelete_status = myshixun_endtime < setting_time.publish_time ? 2 : 1
-
- # 如果作业的最大效率值有变更则更新所有作品的效率分
- homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency
- end
- end
if work.work_status == 0
is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time)
@@ -321,18 +308,34 @@ class HomeworksService
elsif homework.allow_late && myshixun.created_at < homework.late_time
work.work_status = 2
end
+ end
+
+ if work.work_status != 0
+ if myshixun_endtime.present?
+ work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
+
+ efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
+ work.efficiency = format("%.2f", efficiency)
+
+ if myshixun_endtime <= homework_end_or_late_time
+ work.compelete_status = myshixun_endtime < setting_time.publish_time ? 2 : 1
+
+ # 如果作业的最大效率值有变更则更新所有作品的效率分
+ homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency
+ end
+ end
+
work.late_penalty = work.work_status == 2 ? homework.late_penalty : 0
work.commit_time = myshixun.created_at > setting_time.publish_time ? setting_time.publish_time : myshixun.created_at
work.myshixun_id = myshixun.id
- end
+ work.update_time = myshixun.updated_at
- work.update_time = myshixun.updated_at
-
- work.final_score = final_score
- score = work.final_score + work.eff_score - work.late_penalty
- work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) unless work.ultimate_score
- #logger.info("#############work_score: #{score}")
- work.calculation_time = Time.now
- work.save!
+ work.final_score = final_score
+ score = work.final_score + work.eff_score - work.late_penalty
+ work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) unless work.ultimate_score
+ #logger.info("#############work_score: #{score}")
+ work.calculation_time = Time.now
+ work.save!
+ end
end
end
\ No newline at end of file
diff --git a/dump.rdb b/dump.rdb
new file mode 100644
index 0000000000000000000000000000000000000000..a799840b19b627ba79861403e776c55d27442bac
GIT binary patch
literal 551
zcmYMxOKTHR90l;3jA;Fl{vUxEFJ_+ycVLbWWY`bin0FMo$
zMCX4l)Vc?sUea^;X;G{;Ty)tsKxzYLeVHkVhg)SUDlki=93r)<&n4oxx2;Rsu
zet@TIFXm(z*;aP4yuM@JMxHsSx=mHrT~!e&Z8Sx>Px~U1HAS>l$5HfFLy$G9VM`eE
z=n#L(aVyh>F!lY#Tfquhuq?eRj=2|cFPUX`@ZwS$K$w^xilmd;LvRwjFEpB@*4r)3
z36Ijm3lB1S#bQG%o&|Q~TO*kD)NH%dJ?_>B9D##rE(-Bhk=BSGIm|at3aX=AlC8^%Cc7$rbHlkXNx-#OLX3u@%Csr#RI0Zm
mO;c1HqL59Om1;q!ntXhoU;85#=PLir&buGKFFu=F&wl}o%d#2(
literal 0
HcmV?d00001
From 4e4915a3faf3a6470bd6d8e71678ca216a830a2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 25 Jul 2019 17:09:04 +0800
Subject: [PATCH 5/6] =?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/AppConfig.js | 4 +---
public/react/src/modules/paths/PathDetail/PathDetailIndex.js | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index ddef777d6..12959fd9a 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -10,6 +10,7 @@ broadcastChannelOnmessage('refreshPage', () => {
})
function locationurl(list){
+ debugger
if (window.location.port === "3007") {
} else {
@@ -142,9 +143,6 @@ export function initAxiosInterceptors(props) {
// console.log("401401401")
// }
if (response.data.status === 403) {
- // props.history.replace('/403')
- // 这里会分2个情况,1、刚进入页面发请求返回的403;2、进入页面后,其他用户操作触发请求返回的403;
- // TODO 这里做一个403弹框比较好?
locationurl('/403');
}
diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js
index a72771c39..8f5802c9e 100644
--- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js
+++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js
@@ -146,7 +146,7 @@ class PathDetailIndex extends Component{
if (result.data.status === 403) {
debugger
- window.location.href = "/403";
+ // window.location.href = "/403";
return;
}
@@ -173,7 +173,7 @@ class PathDetailIndex extends Component{
}
if (result.data.status === 403 ) {
debugger
- window.location.href = "/403";
+ // window.location.href = "/403";
return;
}
From d7ed523e9db7246320615cd2c2903dfac9b15d1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 25 Jul 2019 17:12:30 +0800
Subject: [PATCH 6/6] =?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/AppConfig.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 12959fd9a..9c407c82c 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -142,7 +142,7 @@ export function initAxiosInterceptors(props) {
// if(response.data.status === 401){
// console.log("401401401")
// }
- if (response.data.status === 403) {
+ if (response.data.status === 403||response.data.status === "403") {
locationurl('/403');
}