From 2b211412b383477ca527e7147ea42fa74f155deb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 18:44:55 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BC=98=E5=8C=96Model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/challenge.rb | 1 - app/models/shixun.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 8e4d2ae42..adb54fae9 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -1,7 +1,6 @@ class Challenge < ApplicationRecord # difficulty: 关卡难度: 1.简单 2.中等 3.困难 # show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4 - default_scope { order("challenges.position asc") } belongs_to :shixun, :touch => true, counter_cache: true belongs_to :user diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 1839edf93..81b444c0a 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -5,7 +5,7 @@ class Shixun < ApplicationRecord # hide_code: 隐藏代码窗口 # code_hidden: 隐藏代码目录 # task_pass: 跳关 - has_many :challenges, dependent: :destroy + has_many :challenges, -> {order("challenges.position asc")}, dependent: :destroy has_many :challenge_tags, through: :challenges has_many :myshixuns, :dependent => :destroy has_many :shixun_members, dependent: :destroy From 11fb99285a2d4b45effef799addfd7a89d60bbdf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 18:55:15 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index ebce98b62..9e87d3799 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -151,7 +151,7 @@ class ChallengesController < ApplicationController def index uid_logger("identifier: #{params}") - @challenges = Challenge.fields_for_list.where(shixun_id: @shixun.id) + @challenges = @shixun.challenges.fields_for_list @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 @user = current_user From 2804dc2580e0fe58b7ae8ceaa4d2ef217a243140 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 20:34:03 +0800 Subject: [PATCH 03/10] =?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 --- app/controllers/homework_commons_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 7f2519b99..cad3806bf 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1459,6 +1459,7 @@ class HomeworkCommonsController < ApplicationController if game_codes.count > 0 code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length end + logger.info("#####game_codes: #{game_codes}") target = game_codes.count > 0 ? game_codes[0].target_user_id : nil # 作品完成时间 game = challenge.games.find_by(user_id: @user.id) From 9be7563fa267f9ebca43e472858ed9829b259f94 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 20:35:51 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index cad3806bf..3e414726c 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1460,7 +1460,7 @@ class HomeworkCommonsController < ApplicationController code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length end logger.info("#####game_codes: #{game_codes}") - target = game_codes.count > 0 ? game_codes[0].target_user_id : nil + #target = game_codes.count > 0 ? game_codes[0].target_user_id : nil # 作品完成时间 game = challenge.games.find_by(user_id: @user.id) end_time = game.end_time @@ -1468,7 +1468,7 @@ class HomeworkCommonsController < ApplicationController all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f final_score = @student_work.work_challenge_score game, all_score # 抄袭用户 - copy_user = User.find_by_id(game_codes[0].target_user_id) + copy_user = User.find_by_id(game_codes[0].try(:target_user_id)) copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present? # 代码部分 code_list = [] From ee70a023bd48fe0f1814eb92b399e5fa244c3b4b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 20:49:41 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=9F=A5=E9=87=8D=E7=8E=87=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/controllers/homework_commons_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 3e414726c..0f2bf2f9e 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1478,9 +1478,11 @@ class HomeworkCommonsController < ApplicationController code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} end end + copy_user_id = copy_user ? copy_user.id : "--" + copy_username = copy_user ? copy_user.full_name : "--" - {code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score, - all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name), + {code_rate: code_rate, copy_user_id: copy_user_id, end_time: end_time, final_score: final_score, + all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_username, username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, id: challenge.id} end From 846be14bc054a873a05ce5b4080e8a76fd8923ad Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 20:52:09 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 0f2bf2f9e..2dc23dc4e 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1478,9 +1478,10 @@ class HomeworkCommonsController < ApplicationController code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} end end + # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 copy_user_id = copy_user ? copy_user.id : "--" copy_username = copy_user ? copy_user.full_name : "--" - + copy_end_time = copy_end_time ? copy_end_time : "--" {code_rate: code_rate, copy_user_id: copy_user_id, end_time: end_time, final_score: final_score, all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_username, username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, From 3df693cdf6c461a81d367bffa7158fdac4681afd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 21:10:21 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=8A=84=E8=A2=AD=E8=80=85=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 2dc23dc4e..99921b126 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1478,10 +1478,6 @@ class HomeworkCommonsController < ApplicationController code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} end end - # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 - copy_user_id = copy_user ? copy_user.id : "--" - copy_username = copy_user ? copy_user.full_name : "--" - copy_end_time = copy_end_time ? copy_end_time : "--" {code_rate: code_rate, copy_user_id: copy_user_id, end_time: end_time, final_score: final_score, all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_username, username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, From 3d019e07275b8b9c7722339f8e2d08b8516404d7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 12 Aug 2019 21:12:16 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=8A=84=E8=A2=AD=E8=80=85=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 99921b126..c8cf36824 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1478,8 +1478,9 @@ class HomeworkCommonsController < ApplicationController code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} end end - {code_rate: code_rate, copy_user_id: copy_user_id, end_time: end_time, final_score: final_score, - all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_username, + # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 + {code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score, + all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name), username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, id: challenge.id} end From d778481f9d9ab3d1e414020c6df5381aa83c5e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 12 Aug 2019 22:05:22 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/boards/TopicDetail.css | 25 +++--- .../src/modules/courses/boards/TopicDetail.js | 2 +- .../Shixunworkdetails/ShixunCustomsPass.js | 77 ++++++++++--------- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/public/react/src/modules/courses/boards/TopicDetail.css b/public/react/src/modules/courses/boards/TopicDetail.css index de3aeb69b..7500268bf 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.css +++ b/public/react/src/modules/courses/boards/TopicDetail.css @@ -1,12 +1,15 @@ -.edu-class-container { - width: 1200px; - margin: 10px auto 20px; -} -#forum_index_list { - margin-top: 90px; - margin-bottom: 320px; -} - -.uploadBtn { - margin-left: 0px; +.edu-class-container { + width: 1200px; + margin: 10px auto 20px; +} +#forum_index_list { + margin-top: 90px; + margin-bottom: 320px; +} +#yslforum_index_list { + margin-top: 20px; + margin-bottom: 320px; +} +.uploadBtn { + margin-left: 0px; } \ No newline at end of file diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index d60c34461..7d0e6d37d 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -526,7 +526,7 @@ class TopicDetail extends Component { const courseId=this.props.match.params.coursesId; const boardId = this.props.match.params.boardId return ( -
- - {item.username} - 的代码文件 - - - {item.copy_username} - 的代码文件 - -
- -+ + {item.username} + 的代码文件 + + + {item.copy_username} + 的代码文件 + +
+ +
this.goback(1)}
+ href={`/courses/${data&&data.course_id}/shixun_homeworks/${data&&data.homework_common_id}`}
>
- {data&&data.course_name}123
+ {data&&data.course_name}
>
实训作业
diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
index 3fc2d516a..8ffa8a1dd 100644
--- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
+++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
@@ -200,9 +200,9 @@ class ShixunCustomsPass extends Component {
{
data&&data.challenge_list.map((item,key)=>{
- console.log("203challenge_list下面的数据");
- console.log(item);
- console.log(JSON.stringify(item));
+ // console.log("203challenge_list下面的数据");
+ // console.log(item);
+ // console.log(JSON.stringify(item));
return(