From 92d85591167d20a7b7753ef5ac397795f157405a Mon Sep 17 00:00:00 2001
From: p31729568
Date: Wed, 13 Nov 2019 09:35:22 +0800
Subject: [PATCH 01/34] competition course 2019 rank data
---
.../20191113013258_gcc_course_competition_rank_data.rb | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 db/migrate/20191113013258_gcc_course_competition_rank_data.rb
diff --git a/db/migrate/20191113013258_gcc_course_competition_rank_data.rb b/db/migrate/20191113013258_gcc_course_competition_rank_data.rb
new file mode 100644
index 000000000..344d8061c
--- /dev/null
+++ b/db/migrate/20191113013258_gcc_course_competition_rank_data.rb
@@ -0,0 +1,9 @@
+class GccCourseCompetitionRankData < ActiveRecord::Migration[5.2]
+ def change
+ competition = Competition.find_by(identifier: 'gcc-course-2019')
+ stage = competition.competition_stages.first
+ return if competition.blank? || stage.blank?
+
+ competition.competition_scores.update_all(competition_stage_id: stage.id)
+ end
+end
From 0caae866a35dd2e6e9b049b46d2ba850de72d92e Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 10:18:26 +0800
Subject: [PATCH 02/34] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A1=AB=E7=A9=BA?=
=?UTF-8?q?=E9=A2=98=E7=9A=84=E5=A4=9A=E7=A9=BA=E7=9A=84=E6=AD=A3=E7=A1=AE?=
=?UTF-8?q?=E7=8E=87=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 82 +++++++++++++++++++++++++++------
1 file changed, 68 insertions(+), 14 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index ea58ddb55..f5a1e0709 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -185,29 +185,83 @@ module ExercisesHelper
standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
all_user_count = 0
- null_stand_choice.each_with_index do |s,index|
- user_count = 0
- if ex_ordered #有序排列
+
+ if ex_ordered
+ null_stand_choice.each_with_index do |s,index|
+ user_count = 0
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
- else
- null_stand_text = null_stand_text.uniq
- s_choice_text = null_stand_text[index]
- user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
+ # if ex_ordered #有序排列,或者有重复答案的时候,不按无序排列
+ #
+ # else
+ # # null_stand_text = null_stand_text.uniq
+ # s_choice_text = null_stand_text[index]
+ # user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
+ # end
+
+ answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
+ answer_option = {
+ :choice_position => index+1,
+ :choice_text => s_choice_text,
+ :choice_users_count => user_count,
+ :choice_percent => answer_percent.round(2).to_s,
+ :right_answer => true
+ }
+ question_answer_infos.push(answer_option)
+ all_user_count += user_count
+ standard_answer_count += 1
end
+ else
+ cycled_stand = {}
+ null_stand_text.each_with_index do |stand, index|
+ user_count = 0
+ if cycled_stand.length > 0 && cycled_stand.keys.include?(stand)
+ cycled_stand.store(stand, cycled_stand["#{stand}"])
+ user_count = cycled_stand["#{stand}"]
+ calculate_user_count = 0
+ else
+ user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.size
+ cycled_stand.store(stand, user_count)
+ calculate_user_count = user_count
+ end
- answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
- answer_option = {
+ answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
+ answer_option = {
:choice_position => index+1,
- :choice_text => s_choice_text,
+ :choice_text => stand,
:choice_users_count => user_count,
:choice_percent => answer_percent.round(2).to_s,
:right_answer => true
- }
- question_answer_infos.push(answer_option)
- all_user_count += user_count
- standard_answer_count += 1
+ }
+ question_answer_infos.push(answer_option)
+ all_user_count += calculate_user_count
+ standard_answer_count += 1
+ end
end
+
+ # null_stand_choice.each_with_index do |s,index|
+ # user_count = 0
+ # if ex_ordered #有序排列,或者有重复答案的时候,不按无序排列
+ # s_choice_text = null_stand_text[index]
+ # user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
+ # else
+ # # null_stand_text = null_stand_text.uniq
+ # s_choice_text = null_stand_text[index]
+ # user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
+ # end
+ #
+ # answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
+ # answer_option = {
+ # :choice_position => index+1,
+ # :choice_text => s_choice_text,
+ # :choice_users_count => user_count,
+ # :choice_percent => answer_percent.round(2).to_s,
+ # :right_answer => true
+ # }
+ # question_answer_infos.push(answer_option)
+ # all_user_count += user_count
+ # standard_answer_count += 1
+ # end
answer_user_score = all_user_count * each_null_score
percent = (ex_total_score == 0.0 ? 0.0 : (answer_user_score / ex_total_score.to_f).round(3) * 100) #正确率
From 7338ad6e24ae330faa655eb19d7e0eac65b8bbf7 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 10:21:28 +0800
Subject: [PATCH 03/34] =?UTF-8?q?=E5=88=A0=E9=99=A4exercise=5Fhelper?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E6=B3=A8=E9=87=8A=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index f5a1e0709..f457ce257 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -238,30 +238,6 @@ module ExercisesHelper
standard_answer_count += 1
end
end
-
- # null_stand_choice.each_with_index do |s,index|
- # user_count = 0
- # if ex_ordered #有序排列,或者有重复答案的时候,不按无序排列
- # s_choice_text = null_stand_text[index]
- # user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
- # else
- # # null_stand_text = null_stand_text.uniq
- # s_choice_text = null_stand_text[index]
- # user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
- # end
- #
- # answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
- # answer_option = {
- # :choice_position => index+1,
- # :choice_text => s_choice_text,
- # :choice_users_count => user_count,
- # :choice_percent => answer_percent.round(2).to_s,
- # :right_answer => true
- # }
- # question_answer_infos.push(answer_option)
- # all_user_count += user_count
- # standard_answer_count += 1
- # end
answer_user_score = all_user_count * each_null_score
percent = (ex_total_score == 0.0 ? 0.0 : (answer_user_score / ex_total_score.to_f).round(3) * 100) #正确率
From d13ec1b18570a6013d87e08e94b24eda99e3527c Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 11:41:44 +0800
Subject: [PATCH 04/34] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E5=A1=AB=E7=A9=BA?=
=?UTF-8?q?=E9=A2=98=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index f457ce257..adce7a5ac 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -511,17 +511,28 @@ module ExercisesHelper
end
end
else
- st_answer_text = standard_answer_array.pluck(:answer_text).reject(&:blank?).map{|a| a.strip.downcase}
+ st_answer_text = standard_answer_array.pluck(:answer_text).reject(&:blank?).map{|a| a.strip.downcase}.uniq
answers_content.each do |u|
u_answer_text = u.answer_text.strip.downcase
- if st_answer_text.include?(u_answer_text) #只要标准答案包含用户的答案,就有分数。同时,下一次循环时,就会删除该标准答案。防止用户的相同答案获分
- u.update_column("score",q_score_2)
- score2 = score2 + q_score_2
- st_answer_text.delete(u_answer_text)
+ if st_answer_text.size == 1
+ if st_answer_text.first == u
+ u.update_column("score",q_score_2)
+ score2 = score2 + q_score_2
+ else
+ u.update_column('score',-1.0)
+ score2 += 0.0
+ end
else
- u.update_column('score',-1.0)
- score2 += 0.0
+ if st_answer_text.include?(u_answer_text) #只要标准答案包含用户的答案,就有分数。同时,下一次循环时,就会删除该标准答案。防止用户的相同答案获分
+ u.update_column("score",q_score_2)
+ score2 = score2 + q_score_2
+ st_answer_text.delete(u_answer_text)
+ else
+ u.update_column('score',-1.0)
+ score2 += 0.0
+ end
end
+
end
end
else
From 49c27a00173a1ddabb88733a8c8220384a3075c2 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 14:15:09 +0800
Subject: [PATCH 05/34] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AF=95=E5=8D=B7?=
=?UTF-8?q?=E7=9A=84=E7=A9=BA=E7=99=BD=E6=A0=87=E5=87=86=E7=AD=94=E6=A1=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index adce7a5ac..f2208e751 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -181,7 +181,7 @@ module ExercisesHelper
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id).uniq #一个exercise_choice_id可能对应多个answer_text
- null_stand_text = null_standard_answer.pluck(:answer_text)
+ null_stand_text = null_standard_answer.pluck(:answer_text).reject(&:blank?)
standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
all_user_count = 0
@@ -191,13 +191,6 @@ module ExercisesHelper
user_count = 0
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
- # if ex_ordered #有序排列,或者有重复答案的时候,不按无序排列
- #
- # else
- # # null_stand_text = null_stand_text.uniq
- # s_choice_text = null_stand_text[index]
- # user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
- # end
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
From 59edc4eab80259e58e3a8bc671f5fad780be3689 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 14:31:59 +0800
Subject: [PATCH 06/34] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A1=AB=E7=A9=BA?=
=?UTF-8?q?=E9=A2=98=E7=9A=84=E6=9C=89=E5=BA=8F=E6=8E=92=E5=BA=8F=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index f2208e751..ae15b0ba3 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -180,7 +180,7 @@ module ExercisesHelper
elsif ex.question_type == Exercise::COMPLETION #填空题
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
- null_stand_choice = null_standard_answer.pluck(:exercise_choice_id).uniq #一个exercise_choice_id可能对应多个answer_text
+ null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
null_stand_text = null_standard_answer.pluck(:answer_text).reject(&:blank?)
standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
@@ -191,7 +191,6 @@ module ExercisesHelper
user_count = 0
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
-
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
:choice_position => index+1,
From 25de4363ef03a799c116277a52fc4141ae7ee99c Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 15:28:34 +0800
Subject: [PATCH 07/34] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E5=A1=AB?=
=?UTF-8?q?=E7=A9=BA=E9=A2=98=E7=9A=84=E7=BB=9F=E8=AE=A1=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index ae15b0ba3..57c4c1aae 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -120,21 +120,7 @@ module ExercisesHelper
if ex.question_type > Exercise::COMPLETION #当为主观题和实训题时,
ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分
percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率
-
end
-
- # if ex.question_type != Exercise::MULTIPLE
- # ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分
- # percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率
- # else
- # multiple_score = 0
- # user_ids.each do |user_id|
- # ex_answer_score = ex_answers.select{|answer| answer.user_id == user_id}&.first&.score.to_f
- # multiple_score += ex_answer_score
- # end
- # percent = (ex_total_score == 0.0 ? 0.0 : (multiple_score / ex_total_score.to_f).round(3) * 100) #正确率
- # end
-
question_answer_infos = []
if ex.question_type <= Exercise::JUDGMENT #选择题和判断题
ex_choices = ex.exercise_choices
@@ -178,19 +164,22 @@ module ExercisesHelper
question_answer_infos.push(answer_option)
end
elsif ex.question_type == Exercise::COMPLETION #填空题
+ effictive_users_count = effictive_users.pluck(:user_id).uniq.size
+
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
- null_stand_text = null_standard_answer.pluck(:answer_text).reject(&:blank?)
+ null_stand_text = null_standard_answer.pluck(:answer_text)
standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
all_user_count = 0
if ex_ordered
null_stand_choice.each_with_index do |s,index|
- user_count = 0
s_choice_text = null_stand_text[index]
- user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
+ user_count = 0
+ user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.pluck(:user_id).uniq.size
+ # user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
:choice_position => index+1,
@@ -212,7 +201,7 @@ module ExercisesHelper
user_count = cycled_stand["#{stand}"]
calculate_user_count = 0
else
- user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.size
+ user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
cycled_stand.store(stand, user_count)
calculate_user_count = user_count
end
From 29afe02630781fc034e2223441f06257fe975849 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 15:42:25 +0800
Subject: [PATCH 08/34] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E5=A1=AB=E7=A9=BA=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index 57c4c1aae..6d95f7c6f 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -178,7 +178,7 @@ module ExercisesHelper
null_stand_choice.each_with_index do |s,index|
s_choice_text = null_stand_text[index]
user_count = 0
- user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.pluck(:user_id).uniq.size
+ user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.distinct.size
# user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
@@ -193,18 +193,21 @@ module ExercisesHelper
standard_answer_count += 1
end
else
- cycled_stand = {}
- null_stand_text.each_with_index do |stand, index|
+ # cycled_stand = {}
+ null_stand_text.uniq.each_with_index do |stand, index|
user_count = 0
- if cycled_stand.length > 0 && cycled_stand.keys.include?(stand)
- cycled_stand.store(stand, cycled_stand["#{stand}"])
- user_count = cycled_stand["#{stand}"]
- calculate_user_count = 0
- else
- user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
- cycled_stand.store(stand, user_count)
- calculate_user_count = user_count
- end
+ # if cycled_stand.length > 0 && cycled_stand.keys.include?(stand)
+ # cycled_stand.store(stand, cycled_stand["#{stand}"])
+ # user_count = cycled_stand["#{stand}"]
+ # calculate_user_count = 0
+ # else
+ # user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
+ # cycled_stand.store(stand, user_count)
+ # calculate_user_count = user_count
+ # end
+ user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.distinct.size
+ # cycled_stand.store(stand, user_count)
+ # calculate_user_count = user_count
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
@@ -215,7 +218,7 @@ module ExercisesHelper
:right_answer => true
}
question_answer_infos.push(answer_option)
- all_user_count += calculate_user_count
+ all_user_count += user_count
standard_answer_count += 1
end
end
From 55b0127f114754367516c5794b02f1858e90b203 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 15:43:51 +0800
Subject: [PATCH 09/34] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E5=A1=AB=E7=A9=BA=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index 6d95f7c6f..0229755e2 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -178,7 +178,7 @@ module ExercisesHelper
null_stand_choice.each_with_index do |s,index|
s_choice_text = null_stand_text[index]
user_count = 0
- user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.distinct.size
+ user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.pluck(:user_id).uniq.size
# user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
@@ -205,7 +205,7 @@ module ExercisesHelper
# cycled_stand.store(stand, user_count)
# calculate_user_count = user_count
# end
- user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.distinct.size
+ user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
# cycled_stand.store(stand, user_count)
# calculate_user_count = user_count
From a81d7e660962726e2eb778b912e4bb0b17af846f Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 16:02:00 +0800
Subject: [PATCH 10/34] =?UTF-8?q?=E5=A4=9A=E7=A9=BA=E5=A1=AB=E7=A9=BA?=
=?UTF-8?q?=E9=A2=98=E7=9A=84=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index 0229755e2..3301330b5 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -165,7 +165,6 @@ module ExercisesHelper
end
elsif ex.question_type == Exercise::COMPLETION #填空题
effictive_users_count = effictive_users.pluck(:user_id).uniq.size
-
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
@@ -178,7 +177,7 @@ module ExercisesHelper
null_stand_choice.each_with_index do |s,index|
s_choice_text = null_stand_text[index]
user_count = 0
- user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.pluck(:user_id).uniq.size
+ user_count = user_count + effictive_users.where("exercise_choice_id = ? and answer_text = ?",s,s_choice_text).pluck(:user_id).uniq.size
# user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
@@ -196,19 +195,7 @@ module ExercisesHelper
# cycled_stand = {}
null_stand_text.uniq.each_with_index do |stand, index|
user_count = 0
- # if cycled_stand.length > 0 && cycled_stand.keys.include?(stand)
- # cycled_stand.store(stand, cycled_stand["#{stand}"])
- # user_count = cycled_stand["#{stand}"]
- # calculate_user_count = 0
- # else
- # user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
- # cycled_stand.store(stand, user_count)
- # calculate_user_count = user_count
- # end
- user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
- # cycled_stand.store(stand, user_count)
- # calculate_user_count = user_count
-
+ user_count = user_count + effictive_users.where("answer_text = ?",stand).pluck(:user_id).uniq.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
:choice_position => index+1,
@@ -227,7 +214,7 @@ module ExercisesHelper
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
- user_wrong_count = (effictive_users_count - all_user_count)
+ user_wrong_count = effictive_users.where("score < 0").size
if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)
From 9af4d4144e0538bb5649a50cdfc4506571611ea7 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 16:04:28 +0800
Subject: [PATCH 11/34] xx
---
app/helpers/exercises_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index 3301330b5..13ab4706c 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -214,7 +214,7 @@ module ExercisesHelper
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
- user_wrong_count = effictive_users.where("score < 0").size
+ user_wrong_count = effictive_users.where("score < 0").pluck(:user_id).uniq.size
if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)
From c7c605a2a6aa186af893c192a953473278ed19cf Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 16:19:44 +0800
Subject: [PATCH 12/34] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E7=AD=94?=
=?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index 13ab4706c..b5168344d 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -213,8 +213,9 @@ module ExercisesHelper
percent = (ex_total_score == 0.0 ? 0.0 : (answer_user_score / ex_total_score.to_f).round(3) * 100) #正确率
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
-
- user_wrong_count = effictive_users.where("score < 0").pluck(:user_id).uniq.size
+ user_right_count = effictive_users.where("score > 0.0").pluck(:user_id).uniq.size
+ user_wrong_counts = effictive_users.where("score < 0.0").pluck(:user_id).uniq.size
+ user_wrong_count = user_wrong_counts - user_right_count
if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)
From 0edc8490321e17d7577bc712920d029da445015e Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 16:22:35 +0800
Subject: [PATCH 13/34] xx
---
app/helpers/exercises_helper.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index b5168344d..bacb95309 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -213,9 +213,9 @@ module ExercisesHelper
percent = (ex_total_score == 0.0 ? 0.0 : (answer_user_score / ex_total_score.to_f).round(3) * 100) #正确率
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
- user_right_count = effictive_users.where("score > 0.0").pluck(:user_id).uniq.size
- user_wrong_counts = effictive_users.where("score < 0.0").pluck(:user_id).uniq.size
- user_wrong_count = user_wrong_counts - user_right_count
+ user_right_count = effictive_users.where("score > 0.0").pluck(:user_id).uniq
+ user_wrong_counts = effictive_users.where("score < 0.0").pluck(:user_id).uniq
+ user_wrong_count = (user_wrong_counts - user_right_count).size
if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)
From 41eef4c543acc2a8da2809b9eda2ce7a80cd6f01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 13 Nov 2019 16:32:47 +0800
Subject: [PATCH 14/34] =?UTF-8?q?=E9=BB=91=E5=AE=A2=E6=9D=BE=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E7=82=B9=E5=87=BB=E5=B1=95=E5=BC=80=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/osshackathon/Osshackathon.js | 23 +++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js
index bf2fdd306..834a6f413 100644
--- a/public/react/src/modules/osshackathon/Osshackathon.js
+++ b/public/react/src/modules/osshackathon/Osshackathon.js
@@ -20,6 +20,7 @@ class Osshackathon extends Component {
hackathonedit:false,
Osshackathonmodeltype:false,
spinning:false,
+ opentitletype:true
}
}
@@ -218,8 +219,14 @@ class Osshackathon extends Component {
search:e.target.value
})
}
+
+ opentitle=()=>{
+ this.setState({
+ opentitletype:false
+ })
+ }
render() {
- let {page,data,hackathonedit}=this.state;
+ let {page,data,hackathonedit,opentitletype}=this.state;
return (
@@ -288,11 +295,23 @@ class Osshackathon extends Component {
{hackathonedit===true?"":}
+ {opentitletype===true?:""}
{hackathonedit===true?"":
{data&&data.hackathon.description===null?"":
}
}
+ {opentitletype===true?this.opentitle()} className={"pointer"}>展开阅读全文:""}
+
{hackathonedit===true?this.getosshackathonlist()}
hidehackathonedit={()=>this.hidehackathonedit()}
@@ -305,7 +324,7 @@ class Osshackathon extends Component {
{...this.props}
{...this.state}
/>:""}
- {this.props.user&&this.props.user.admin===true?
+ {this.props.user&&this.props.user.admin===true?
From af89b0d051bfff4f6f80c66f058b3992922b7701 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 16:52:14 +0800
Subject: [PATCH 15/34] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E7=BB=9F?=
=?UTF-8?q?=E8=AE=A1=E7=BB=93=E6=9E=9C=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/polls_helper.rb | 2 +-
app/views/polls/commit_result.json.jbuilder | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb
index 03210fccd..866d28254 100644
--- a/app/helpers/polls_helper.rb
+++ b/app/helpers/polls_helper.rb
@@ -13,7 +13,7 @@ module PollsHelper
end
def poll_votes_count(votes,user_ids)
- votes.find_current_vote("user_id",user_ids.uniq).reject(&:blank?).size
+ votes.find_current_vote("user_id",user_ids.uniq).pluck(:user_id).uniq.reject(&:blank?).size
end
#公用tab页的相关信息
diff --git a/app/views/polls/commit_result.json.jbuilder b/app/views/polls/commit_result.json.jbuilder
index 795d609a7..f5e983acf 100644
--- a/app/views/polls/commit_result.json.jbuilder
+++ b/app/views/polls/commit_result.json.jbuilder
@@ -14,7 +14,7 @@ if @poll_questions_count > 0
json.array! @poll_questions do |question|
json.partial! "polls/commit_answers_result", question: question,
answers:question.poll_answers,
- question_votes:question.poll_votes.where(user_id:@poll_commit_ids) #问题的全部答案
+ question_votes: question.poll_votes.where(user_id:@poll_commit_ids) #问题的全部答案
end
end
else
From 27d363713effe5b8b40ee82a685e2bdead98a914 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Wed, 13 Nov 2019 16:52:31 +0800
Subject: [PATCH 16/34] fix
---
app/controllers/cooperative/base_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/cooperative/base_controller.rb b/app/controllers/cooperative/base_controller.rb
index 5ab08582d..556cd7aa9 100644
--- a/app/controllers/cooperative/base_controller.rb
+++ b/app/controllers/cooperative/base_controller.rb
@@ -16,7 +16,7 @@ class Cooperative::BaseController < ApplicationController
private
def current_laboratory
- @_current_laboratory ||= Laboratory.find_by_subdomain('hut' || request.subdomain)
+ @_current_laboratory ||= Laboratory.find_by_subdomain(request.subdomain)
end
def current_setting_or_default(name)
From 51f0ee88b1e088807c25e9c6804a85cf3bff9ab8 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Wed, 13 Nov 2019 17:00:11 +0800
Subject: [PATCH 17/34] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=AD=94=E9=A2=98?=
=?UTF-8?q?=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/poll/PollDetailTabFirst.js | 14 +++++++-------
.../react/src/modules/courses/poll/pollStyle.css | 4 +++-
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/public/react/src/modules/courses/poll/PollDetailTabFirst.js b/public/react/src/modules/courses/poll/PollDetailTabFirst.js
index 07b9ee197..052382067 100644
--- a/public/react/src/modules/courses/poll/PollDetailTabFirst.js
+++ b/public/react/src/modules/courses/poll/PollDetailTabFirst.js
@@ -246,13 +246,13 @@ class PollDetailTabFirst extends Component{
dataIndex: 'No',
key: 'No',
className:"edu-txt-center",
- width:110
+ width:120
}, {
title: '姓名',
dataIndex: 'name',
key: 'name',
className:"edu-txt-center",
- width:160
+ width:170
}, {
title: '学号',
dataIndex: 'StudentNo',
@@ -269,11 +269,11 @@ class PollDetailTabFirst extends Component{
title: '分班',
key: 'classes',
dataIndex: 'classes',
- width:160,
+ width:220,
className:poll_types && poll_types.groups_count > 0 ? "edu-txt-center":"edu-txt-center none",
render:(classes,item,index)=>{
return(
- item.classes ? {item.classes} : --
+ item.classes ? {item.classes} : --
)
}
}, {
@@ -281,7 +281,7 @@ class PollDetailTabFirst extends Component{
dataIndex: 'status',
key: 'status',
className:"edu-txt-center",
- width:160,
+ width:170,
render:(status,item,index)=>{
return(
item.status == 1 ?按时提交:未提交
@@ -292,7 +292,7 @@ class PollDetailTabFirst extends Component{
dataIndex: 'time',
key: 'time',
className:"edu-txt-center",
- width:160,
+ width:170,
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
@@ -395,7 +395,7 @@ class PollDetailTabFirst extends Component{
{/* */}
{/*}*/}
}
-
+
{
data && data.length > 0 ?
:
diff --git a/public/react/src/modules/courses/poll/pollStyle.css b/public/react/src/modules/courses/poll/pollStyle.css
index 414d36ab1..5a5e9f76f 100644
--- a/public/react/src/modules/courses/poll/pollStyle.css
+++ b/public/react/src/modules/courses/poll/pollStyle.css
@@ -338,7 +338,9 @@ textarea:read-only{
border:1px solid #FF0000;
border-radius: 5px;
}
-
+.pollResultList .ant-table-thead > tr > th,.pollResultList .ant-table-tbody > tr > td{
+ padding:15px 6px;
+}
/* 试卷 */
.setScoreInput{
width: 60px!important;height: 30px!important;box-sizing: border-box;
From 055cb1d8647622e1673b0f30124a5e39d5fe2bee Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 13 Nov 2019 17:08:57 +0800
Subject: [PATCH 18/34] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=A1=AB=E7=A9=BA?=
=?UTF-8?q?=E9=A2=98=E5=88=A0=E9=99=A4=E7=AD=94=E6=A1=88=E5=90=8E=E7=BB=9F?=
=?UTF-8?q?=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/exercises_helper.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index bacb95309..33d61d203 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -164,7 +164,7 @@ module ExercisesHelper
question_answer_infos.push(answer_option)
end
elsif ex.question_type == Exercise::COMPLETION #填空题
- effictive_users_count = effictive_users.pluck(:user_id).uniq.size
+ effictive_users_count = effictive_users.where("answer_text is not null").pluck(:user_id).uniq.size
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
@@ -214,7 +214,7 @@ module ExercisesHelper
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
user_right_count = effictive_users.where("score > 0.0").pluck(:user_id).uniq
- user_wrong_counts = effictive_users.where("score < 0.0").pluck(:user_id).uniq
+ user_wrong_counts = effictive_users.where("score < 0.0 and answer_text is not null").pluck(:user_id).uniq
user_wrong_count = (user_wrong_counts - user_right_count).size
if effictive_users_count > 0 && user_wrong_count >= 0
From 62594b13e4edd97d5660311c0fbe1f09b4d79d50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 13 Nov 2019 17:16:03 +0800
Subject: [PATCH 19/34] =?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/modules/home/shixunsHome.js | 19 +++++++------
public/react/src/modules/tpm/NewHeader.js | 24 ++++++++++++++---
.../src/modules/user/usersInfo/InfosBanner.js | 27 ++++++++++++++++---
3 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js
index ab51853ed..873461600 100644
--- a/public/react/src/modules/home/shixunsHome.js
+++ b/public/react/src/modules/home/shixunsHome.js
@@ -118,21 +118,24 @@ class ShixunsHome extends Component {
let shixuntype=false;
let pathstype=false;
if(this.props&&this.props.mygetHelmetapi!=null){
- console.log(this.props.mygetHelmetapi.navbar)
let shixun="/shixuns";
let paths="/paths";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
var reg = RegExp(item.link);
if(shixun.match(reg)){
- shixuntype=true
+ if(item.hidden===true){
+ shixuntype=true
+ }
}
if(paths.match(reg)){
- pathstype=true
+ if(item.hidden===true){
+ pathstype=true
+ }
}
})
+ }
- }
return (
{this.state.updata===undefined?"":
{/*实训路径*/}
- {pathstype===true?
+ {pathstype===true?"":
实践课程
TRAINING COURSE
@@ -308,10 +311,10 @@ class ShixunsHome extends Component {
}
-
:""}
+
}
{/*精选实训 改为 开发社区*/}
- {shixuntype===true?
+ {shixuntype===true?"":
实训项目
DEVELOPMENT COMMUNITY
@@ -403,7 +406,7 @@ class ShixunsHome extends Component {
-
:""}
+
}
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index 4de133b39..870e651e8 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -875,8 +875,26 @@ submittojoinclass=(value)=>{
// console.log("NewHeadergetHelmetapi432423423423");
// console.log(mygetHelmetapi2);
// console.log("NewHeadermygetHelmetapi123123123123");
- // console.log(mygetHelmetapi2);
+ let shixuntype=false;
+ let pathstype=false;
+ if(this.props&&this.props.mygetHelmetapi!=null){
+ let shixun="/shixuns";
+ let paths="/paths";
+ this.props.mygetHelmetapi.navbar.map((item,key)=>{
+ var reg = RegExp(item.link);
+ if(shixun.match(reg)){
+ if(item.hidden===true){
+ shixuntype=true
+ }
+ }
+ if(paths.match(reg)){
+ if(item.hidden===true){
+ pathstype=true
+ }
+ }
+ })
+ }
return (