From 8b42018d40b20c391b1eaa4b5f55c1c76a58c396 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 24 May 2019 16:13:06 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E6=95=99=E5=AD=A6=E5=9B=A2=E9=98=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_subject_members.html.erb | 59 ++++++++++---------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/app/views/subjects/_subject_members.html.erb b/app/views/subjects/_subject_members.html.erb index 87c518c7..b2665099 100644 --- a/app/views/subjects/_subject_members.html.erb +++ b/app/views/subjects/_subject_members.html.erb @@ -4,48 +4,47 @@
-

+

<%= image_tag(url_to_avatar(member.user), :width =>"80", :height => "80", :class => "radius", :alt=>"头像") %> +
+

<%= member.user.try(:show_name) %>

+
+

+ + <%= member.user.identity == "学生" ? "" : member.user.identity %> +

+ +
+
- + - + <% if User.current.admin? && member.role != 1 %> + + + + <% end %> - <% if User.current.admin? && member.role != 1 %> - - - - <% end %> + <% if User.current.member_of_subject?(@subject) && member.position > 1 %> + + + + <% end %> - <% if User.current.member_of_subject?(@subject) && member.position > 1 %> - - - - <% end %> + <% if User.current.member_of_subject?(@subject) && member.position < @subject.subject_members.size %> + + + + <% end %> - <% if User.current.member_of_subject?(@subject) && member.position < @subject.subject_members.size %> - - - - <% end %> + - +
-

-
-

<%= member.user.try(:show_name) %>

-
-

- - <%= member.user.identity == "学生" ? "" : member.user.identity %> -

- -
-
<% end %> <% end %> \ No newline at end of file From 5885568599a4312df918ad8bf0bfad91aacbb5d1 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 16:22:09 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/MainContent.js | 98 ++++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index ff9f753d..f5f66abf 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -74,55 +74,55 @@ class MainContent extends Component { */}
-
-
-
-
- - {/* 选择题或编程题 */} - {/* readRepoTimeout 如果读取代码超时,显示重新加载按钮,重新拉取代码 */} - { - st === 0 - ? - readRepoTimeout === true ? : - - -
- -
-
- : - } - - {/* */} -
-
- {/*
*/} -
-
- {/* 测试结果、评测信息区域 */} - { loading ? - : - st === 0 - ? - : - } -
-
-
-
-
- -
- -
+
+
+
+
+ + {/* 选择题或编程题 */} + {/* readRepoTimeout 如果读取代码超时,显示重新加载按钮,重新拉取代码 */} + { + st === 0 + ? + readRepoTimeout === true ?
+ 代码加载失败, this.props.fetchRepositoryCode(this.props, null, null, true)}>重试 +
: + + +
+ +
+
+ : + } + + {/* */} +
+
+ {/*
*/} +
+
+ {/* 测试结果、评测信息区域 */} + { loading ? + : + st === 0 + ? + : + } +
+
+
+
+ + +
+ +
From e5e9b1a04b1bc2518b04c0054f6c0151a4af9d97 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 24 May 2019 16:54:37 +0800 Subject: [PATCH 03/18] fix get nav data api --- app/controllers/ec_major_schools_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/ec_major_schools_controller.rb b/app/controllers/ec_major_schools_controller.rb index c47899f6..445ce70f 100644 --- a/app/controllers/ec_major_schools_controller.rb +++ b/app/controllers/ec_major_schools_controller.rb @@ -122,7 +122,7 @@ class EcMajorSchoolsController < ApplicationController requirement_vs_objective_url: "#{requirement_vs_objective_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}", requirement_vs_standard: "#{requirement_vs_standard_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}", requirement_vs_courses: "#{requirement_vs_courses_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}", - students_url: student_lists_ec_major_schools_ec_years_path(@year, ec_major_school_id: @year.ec_major_school_id), + students_url: student_lists_ec_major_school_ec_year_path(@year, ec_major_school_id: @year.ec_major_school_id), go_back_url: ec_major_school_path(major), ec_course_support_setting_url: ec_course_support_setting_url, ec_course_reach_setting_url: ec_course_reach_setting_url, From 165dd898d45b6d334ae909903d7424c1d17e4316 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 17:03:41 +0800 Subject: [PATCH 04/18] showIframeContent --- public/react/src/modules/page/MainContent.js | 31 ++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index f5f66abf..b0f8c593 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -17,14 +17,17 @@ import Button from 'material-ui/Button'; import './tpiPage.css'; import './tpiPageForMobile.css'; const $ = window.$; +const showIframeContent = window.location.search.indexOf('enc=1') != -1; class MainContent extends Component { componentDidMount() { // ios下图标位置有问题 - setTimeout(()=>{ - if (window.$('.b-label>.resize-helper').position().top < 100) { - window.$('.b-label>.resize-helper').css('top', '200px') - } - }, 4000) + if (!showIframeContent) { + setTimeout(()=>{ + if (window.$('.b-label>.resize-helper').position().top < 100) { + window.$('.b-label>.resize-helper').css('top', '200px') + } + }, 4000) + } $("body").css("padding-right","0px!important") } onResizeButtonClick = () => { @@ -45,7 +48,6 @@ class MainContent extends Component { } else { games_repository_contents_style = {overflow: 'hidden', height: '445px'} } - return (
@@ -65,6 +67,21 @@ class MainContent extends Component {
+ {/* + iframe模式下需要这两个样式来调整 + .page--body { z-index: 9999; } + .resize-helper { top: 10px } + */} + + { showIframeContent ? : + {/* 旧版本、评测等待提示--更新提示块*/} {/*
@@ -123,6 +140,8 @@ class MainContent extends Component {
+ + }
From cfed9da95e023e69e72878307f7edf987cd0024a Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 17:11:40 +0800 Subject: [PATCH 05/18] b --- app/views/common/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/common/index.html.erb b/app/views/common/index.html.erb index 82b976cb..6e2b93b5 100644 --- a/app/views/common/index.html.erb +++ b/app/views/common/index.html.erb @@ -1 +1 @@ -Educoder
\ No newline at end of file +Educoder
\ No newline at end of file From fb353c39ab1658d562658a8c8d4053d20b24e4d9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 17:22:36 +0800 Subject: [PATCH 06/18] vnc --- public/react/src/modules/page/MainContent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index b0f8c593..9f4b9fd4 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -17,7 +17,7 @@ import Button from 'material-ui/Button'; import './tpiPage.css'; import './tpiPageForMobile.css'; const $ = window.$; -const showIframeContent = window.location.search.indexOf('enc=1') != -1; +const showIframeContent = window.location.search.indexOf('vnc=1') != -1; class MainContent extends Component { componentDidMount() { // ios下图标位置有问题 From 38fe8a2f9e453dc495f693cec397e6bf0d47581c Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 24 May 2019 17:29:54 +0800 Subject: [PATCH 07/18] fix copy ec year issue --- app/services/copy_ec_year_service.rb | 41 ++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/app/services/copy_ec_year_service.rb b/app/services/copy_ec_year_service.rb index 7ad46c5f..cbbcd5f1 100644 --- a/app/services/copy_ec_year_service.rb +++ b/app/services/copy_ec_year_service.rb @@ -226,6 +226,8 @@ to_relate.ec_course_target_id = course_target_map[relate.ec_course_target_id] to_relate.ec_course_evaluation_subitem_id = course_target_map[relate.ec_course_evaluation_subitem_id] to_relate.save! + + achievement_evaluation_relates_map[relate.id] = to_relate.id end end @@ -258,14 +260,16 @@ end def copy_year_students! - students = from_year.ec_year_students.includes(:ec_student_achievements) + students = from_year.ec_year_students.includes(:ec_student_achievements, :ec_course_student_scores, :ec_student_score_targets) students.each do |student| to_student = to_year.ec_year_students.new - to_student.attributes = student.attributes.except('id', 'ec_year_id', 'created_at', 'updated') + to_student.attributes = student.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at') to_student.save! copy_student_achievements!(student, to_student) + copy_course_student_scores!(student, to_student) + copy_student_score_targets!(student, to_student) end end @@ -280,6 +284,31 @@ end end + def copy_course_student_scores!(student, to_student) + student.ec_course_student_scores.each do |score| + to_score = to_student.ec_course_student_scores.new + to_score.attributes = score.attributes.except('id', 'ec_year_student_id', 'ec_course_id', 'created_at', 'updated_at') + to_score.ec_course_id = course_map[score.ec_course_id] + to_score.save! + + course_student_score_map[score.id] = to_score.id + end + end + + def copy_student_score_targets!(student, to_student) + student.ec_student_score_targets.each do |target| + to_target = to_student.ec_student_score_targets.new + to_target.attributes = target.attributes.except('id', 'ec_course_id', 'ec_course_student_score_id', + 'ec_course_target_id', 'ec_year_student_id', 'eaer_id', + 'created_at', 'updated_at') + to_target.ec_course_id = course_map[target.ec_course_id] + to_target.ec_course_student_score_id = course_student_score_map[target.ec_course_student_score_id] + to_target.ec_course_target_id = course_target_map[target.ec_course_target_id] + to_target.eaer_id = achievement_evaluation_relates_map[target.eaer_id] + to_target.save! + end + end + def graduation_requirement_map @_graduation_requirement_map ||= {} end @@ -300,7 +329,15 @@ @_course_evaluation_subitem_map ||= {} end + def achievement_evaluation_relates_map + @_achievement_evaluation_relates_map ||= {} + end + def course_target_map @_course_target_map ||= {} end + + def course_student_score_map + @_course_student_score_map ||= {} + end end \ No newline at end of file From 9f88f9bf3743943b7da8b506eefc072fa1f9ac9c Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 17:40:42 +0800 Subject: [PATCH 08/18] https --- public/react/src/modules/page/MainContent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index 9f4b9fd4..afd0d2d9 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -80,7 +80,7 @@ class MainContent extends Component { .page--body { z-index: ${showIframeContent ? '9999': '1'} ; } .b-label>.resize-helper { top: ${showIframeContent ? '10px': '50%'} } `} - { showIframeContent ? : + { showIframeContent ? : {/* 旧版本、评测等待提示--更新提示块*/} {/*
From f2bde62acddeeaa8c231daa18dc7f8cf80651670 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:03:17 +0800 Subject: [PATCH 09/18] md --- app/views/layouts/base_ec.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/base_ec.html.erb b/app/views/layouts/base_ec.html.erb index 0e1c6279..d8c45746 100644 --- a/app/views/layouts/base_ec.html.erb +++ b/app/views/layouts/base_ec.html.erb @@ -9,7 +9,9 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty' %> + <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> + <%= stylesheet_link_tag '/editormd/css/editormd.min.css' %> + <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty', '/editormd/editormd.min.js' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-popup','css/edu-common','educoder/edu-main','educoder/edu-all', "css/edu-public", 'css/ketang', 'css/common', 'css/taskstyle', 'css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome', 'css/edu-tooltipster', 'educoder/magic-check','/assets/iconfont/iconfont.css' %> <%= call_hook :view_layouts_base_html_head %> From add56f399bec74970e10edb6b824f7ab43512572 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:05:30 +0800 Subject: [PATCH 10/18] md --- app/views/layouts/base_ec.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_ec.html.erb b/app/views/layouts/base_ec.html.erb index d8c45746..306d3785 100644 --- a/app/views/layouts/base_ec.html.erb +++ b/app/views/layouts/base_ec.html.erb @@ -11,7 +11,7 @@ <%= heads_for_theme %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <%= stylesheet_link_tag '/editormd/css/editormd.min.css' %> - <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty', '/editormd/editormd.min.js' %> + <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty', '/editormd/editormd.min.js', '/editormd/lib/marked.min.js' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-popup','css/edu-common','educoder/edu-main','educoder/edu-all', "css/edu-public", 'css/ketang', 'css/common', 'css/taskstyle', 'css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome', 'css/edu-tooltipster', 'educoder/magic-check','/assets/iconfont/iconfont.css' %> <%= call_hook :view_layouts_base_html_head %> From 78a2cfb0440eb2f419c67bc113ae63db27f945f6 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:07:31 +0800 Subject: [PATCH 11/18] md --- app/views/layouts/base_ec.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_ec.html.erb b/app/views/layouts/base_ec.html.erb index 306d3785..756d1706 100644 --- a/app/views/layouts/base_ec.html.erb +++ b/app/views/layouts/base_ec.html.erb @@ -11,7 +11,7 @@ <%= heads_for_theme %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <%= stylesheet_link_tag '/editormd/css/editormd.min.css' %> - <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty', '/editormd/editormd.min.js', '/editormd/lib/marked.min.js' %> + <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty', '/editormd/editormd.min.js', '/editormd/lib/marked.min.js', '/editormd/lib/flowchart.min.js', '/editormd/lib/jquery.flowchart.min.js' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-popup','css/edu-common','educoder/edu-main','educoder/edu-all', "css/edu-public", 'css/ketang', 'css/common', 'css/taskstyle', 'css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome', 'css/edu-tooltipster', 'educoder/magic-check','/assets/iconfont/iconfont.css' %> <%= call_hook :view_layouts_base_html_head %> From 0e2dcf12fdfd8ff9e88baea820250ec07dce8d36 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:09:51 +0800 Subject: [PATCH 12/18] md --- app/views/layouts/base_ec.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/base_ec.html.erb b/app/views/layouts/base_ec.html.erb index 756d1706..10113aa8 100644 --- a/app/views/layouts/base_ec.html.erb +++ b/app/views/layouts/base_ec.html.erb @@ -11,7 +11,11 @@ <%= heads_for_theme %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <%= stylesheet_link_tag '/editormd/css/editormd.min.css' %> - <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty', '/editormd/editormd.min.js', '/editormd/lib/marked.min.js', '/editormd/lib/flowchart.min.js', '/editormd/lib/jquery.flowchart.min.js' %> + + <%= javascript_include_tag '/editormd/lib/marked.min.js', '/editormd/lib/prettify.min.js', '/editormd/lib/raphael.min.js', '/editormd/lib/underscore.min.js', '/editormd/lib/sequence-diagram.min.js', + '/editormd/lib/flowchart.min.js', '/editormd/lib/jquery.flowchart.min.js', '/editormd/editormd.js' %> + + <%= javascript_include_tag 'educoder/edu_application', 'educoder/edu_shixun','educoder/edu_shixunCommentsStar','educoder/jquery.raty'%> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-popup','css/edu-common','educoder/edu-main','educoder/edu-all', "css/edu-public", 'css/ketang', 'css/common', 'css/taskstyle', 'css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome', 'css/edu-tooltipster', 'educoder/magic-check','/assets/iconfont/iconfont.css' %> <%= call_hook :view_layouts_base_html_head %> From 95ded6f4caa62674c72ee025531886d8e366af9e Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:11:34 +0800 Subject: [PATCH 13/18] b --- app/views/common/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/common/index.html.erb b/app/views/common/index.html.erb index 6e2b93b5..553fa3db 100644 --- a/app/views/common/index.html.erb +++ b/app/views/common/index.html.erb @@ -1 +1 @@ -Educoder
\ No newline at end of file +Educoder
\ No newline at end of file From a316a9cebf22c9c2716eccd29c7da5842680c283 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:20:49 +0800 Subject: [PATCH 14/18] http --- public/react/src/modules/page/MainContent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index afd0d2d9..9f4b9fd4 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -80,7 +80,7 @@ class MainContent extends Component { .page--body { z-index: ${showIframeContent ? '9999': '1'} ; } .b-label>.resize-helper { top: ${showIframeContent ? '10px': '50%'} } `} - { showIframeContent ? : + { showIframeContent ? : {/* 旧版本、评测等待提示--更新提示块*/} {/*
From af37894dbb321c595912b3931461d8145631c5e7 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:28:17 +0800 Subject: [PATCH 15/18] 7999 --- public/react/src/modules/page/MainContent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index 9f4b9fd4..ee3fcdf9 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -77,7 +77,7 @@ class MainContent extends Component { height: 100%; background: #fff; } - .page--body { z-index: ${showIframeContent ? '9999': '1'} ; } + .page--body { z-index: ${showIframeContent ? '7999': '1'} ; } .b-label>.resize-helper { top: ${showIframeContent ? '10px': '50%'} } `} { showIframeContent ? : From 478b73bbfbb56b1033b720255b2c626023e197b9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 18:30:27 +0800 Subject: [PATCH 16/18] b --- app/views/common/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/common/index.html.erb b/app/views/common/index.html.erb index 553fa3db..5762eefe 100644 --- a/app/views/common/index.html.erb +++ b/app/views/common/index.html.erb @@ -1 +1 @@ -Educoder
\ No newline at end of file +Educoder
\ No newline at end of file From bef79a52c29bf231d29a1e1dc21b367902afc786 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 24 May 2019 18:59:14 +0800 Subject: [PATCH 17/18] fix copy ec year --- app/services/copy_ec_year_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/copy_ec_year_service.rb b/app/services/copy_ec_year_service.rb index cbbcd5f1..15a95ea0 100644 --- a/app/services/copy_ec_year_service.rb +++ b/app/services/copy_ec_year_service.rb @@ -224,7 +224,7 @@ to_relate.attributes = relate.attributes.except('id', 'ec_course_achievement_method_id', 'ec_course_target_id', 'ec_course_evaluation_subitem_id', 'created_at', 'updated_at') to_relate.ec_course_target_id = course_target_map[relate.ec_course_target_id] - to_relate.ec_course_evaluation_subitem_id = course_target_map[relate.ec_course_evaluation_subitem_id] + to_relate.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[relate.ec_course_evaluation_subitem_id] to_relate.save! achievement_evaluation_relates_map[relate.id] = to_relate.id From 27acd561c0c42966b17d4d4e8d9a3b78366662bc Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 24 May 2019 19:11:06 +0800 Subject: [PATCH 18/18] fix copy ec year bug --- app/services/copy_ec_year_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/copy_ec_year_service.rb b/app/services/copy_ec_year_service.rb index 15a95ea0..31bac9f9 100644 --- a/app/services/copy_ec_year_service.rb +++ b/app/services/copy_ec_year_service.rb @@ -224,7 +224,8 @@ to_relate.attributes = relate.attributes.except('id', 'ec_course_achievement_method_id', 'ec_course_target_id', 'ec_course_evaluation_subitem_id', 'created_at', 'updated_at') to_relate.ec_course_target_id = course_target_map[relate.ec_course_target_id] - to_relate.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[relate.ec_course_evaluation_subitem_id] + # 可能不存在,所以为 -1 + to_relate.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[relate.ec_course_evaluation_subitem_id] || -1 to_relate.save! achievement_evaluation_relates_map[relate.id] = to_relate.id