From c8f178f8a7222e86d07bb52b5055c840a4f4bbbb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 24 May 2019 09:29:10 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index c60a9959..5c77ebf2 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -297,6 +297,7 @@ class ShixunsController < ApplicationController # 首页实训导航点击时,type参数 def index + logger.info("##########humen count : #{session[:user_id].count}") @type = params[:type] @status = [["全部状态", 0], ["已发布", 2], ["未发布", 1], ["已关闭", 3]] @diff = ["全部难度", "初级学员", "中级学员", "高级学员", "顶级学员"] From 5a88a81d0ffbfc738e967744d698a2ca5fdb0434 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 24 May 2019 09:29:12 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 9 +++++++++ app/controllers/myshixuns_controller.rb | 2 +- app/services/games_service.rb | 13 ++++++++----- ...0524005242_add_identifier_to_evaluate_records.rb | 8 ++++++++ 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20190524005242_add_identifier_to_evaluate_records.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7f1383bc..c1c25151 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -132,6 +132,15 @@ class ApplicationController < ActionController::Base end end + DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + # 随机生成字符 + def generates_identifier(container, num) + code = DCODES.sample(num).join + while container.exists?(identifier: code) do + code = DCODES.sample(num).join + end + code + end def ec_public_auth major_school unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 || diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 09626c31..e9b361da 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -523,7 +523,7 @@ class MyshixunsController < ApplicationController end logger.info("#############status: #{status}") logger.info("#############resubmit: #{resubmit}") - record = EvaluateRecord.where(:game_id => game_id).first + record = EvaluateRecord.where(:identifier => params[:sec_key]).first logger.info("training_task_status start#3**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") # status:0表示评测成功 diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 8b5e486d..91645e84 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -347,10 +347,12 @@ class GamesService rev = params[:rev] ? params[:rev] : "master" content_modified = 0 ActiveRecord::Base.transaction do + sec_key = generates_identifier(EvaluateRecord, 10) # params[:evaluate] 实训评测时更新必须给的参数,需要依据该参数做性能统计,其它类型的更新可以跳过 # 自动保存的时候evaluate为0;点评测的时候为1 if params[:evaluate] == 1 - record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id, :game_id => @game.id) + record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id, + :game_id => @game.id, :identifier => sec_key) Rails.logger.warn("##game is is #{@game.id}, record id is #{record.id}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") # @myshixun.student_works.update_all(:update_time => Time.now) if !@myshixun.student_works.blank? student_work_time = format("%.3f", (Time.now.to_f - record.created_at.to_f)).to_f @@ -385,7 +387,7 @@ class GamesService if content != last_content && code_file.blank? raise("update file failed") else - return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified} + return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified, sec_key: record.identifier} end end rescue Exception => e @@ -546,7 +548,7 @@ class GamesService :testCases => "#{testCases}", :resubmit => "#{resubmit}", :times => params[:first].to_i, :podType => shixun.webssh, :containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}", :tpmScript => "#{tpmScript}", :timeLimit => "#{shixun.exec_time}", :content_modified => content_modified, :persistenceName => shixun.identifier, - :isPublished => (shixun.status < 2 ? 0 : 1)} + :isPublished => (shixun.status < 2 ? 0 : 1), :sec_key => params[:sec_key]} # 评测有文件输出的需要特殊传字段 path:表示文件存储的位置 params['file'] = Base64.urlsafe_encode64({:path => "#{game_challenge.picture_path}"}.to_json) if game_challenge.picture_path.present? @@ -569,7 +571,8 @@ class GamesService # ----单测模式end return {:result => "success", :resubmit => resubmit, :ableToCreate => res['ableToCreate'], :waitNum => res['waitNum'], - :waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'], :had_done => game.had_done } + :waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'], + :had_done => game.had_done} rescue Exception => e Rails.logger.error("评测出错,详情:" + e.message) return {:result => 'fail', :contents =>"实训云平台繁忙(繁忙等级:502),请稍后刷新并重试", :position => game_challenge.position, :had_done => game.had_done} @@ -878,7 +881,7 @@ class GamesService mirror_name = shixun.mirror_name # 轮询结束,更新评测耗时 - e_record = EvaluateRecord.where(:game_id => game.id).first + e_record = EvaluateRecord.where(:identifier => params[:sec_key]).first if game_status == 0 || game_status == 2 if e_record front_js = format("%.3f", (Time.now.to_f - e_record.try(:updated_at).to_f)).to_f diff --git a/db/migrate/20190524005242_add_identifier_to_evaluate_records.rb b/db/migrate/20190524005242_add_identifier_to_evaluate_records.rb new file mode 100644 index 00000000..7fe00179 --- /dev/null +++ b/db/migrate/20190524005242_add_identifier_to_evaluate_records.rb @@ -0,0 +1,8 @@ +class AddIdentifierToEvaluateRecords < ActiveRecord::Migration + def change + add_column :evaluate_records, :identifier, :string + add_index :evaluate_records, :identifier, unique: true + remove_index :evaluate_records, :name => :game + remove_index :evaluate_records, :name => :index_evaluate_records_on_user_id + end +end From e72abe4305ee59c0e183f08b7a6243d40e70a35a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 24 May 2019 09:49:40 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 5c77ebf2..c60a9959 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -297,7 +297,6 @@ class ShixunsController < ApplicationController # 首页实训导航点击时,type参数 def index - logger.info("##########humen count : #{session[:user_id].count}") @type = params[:type] @status = [["全部状态", 0], ["已发布", 2], ["未发布", 1], ["已关闭", 3]] @diff = ["全部难度", "初级学员", "中级学员", "高级学员", "顶级学员"] From 88096c807fe139586478eb3c647bb4357c5b8b93 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 24 May 2019 10:19:27 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 42 ++++++++- app/views/student_work/index.html.erb | 104 ++++++++++++++------- config/routes.rb | 1 + 3 files changed, 108 insertions(+), 39 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd9b1bda..df1fdcd6 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController require "base64" helper :attachments helper :files - before_filter :find_homework, :only => [:new, :index, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex, + before_filter :find_homework, :only => [:new, :index, :sonar, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex, :set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project, :search_course_students,:work_canrepeat,:change_project,:relate_myshixun,:shixun_work_export,:import_score,:code_review_results] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :adjust_score, :add_ultimate_score, :praise_student_work, :retry_work, :revise_attachment, :hide_score_detail, :destroy_score, @@ -15,7 +15,7 @@ class StudentWorkController < ApplicationController before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work, :commit_summary, :view_summary] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment, :adjust_score, :add_ultimate_score] - before_filter :require_login, :only => [:index, :show] + before_filter :require_login, :only => [:index, :sonar, :show] if RUBY_PLATFORM =~ /linux/ require 'roo-xls' @@ -493,7 +493,7 @@ class StudentWorkController < ApplicationController render :json => resultObj end - def index + def _index # REDO:分班信息提前查出来,然后循环中根据匹配去取 @is_teacher = User.current.logged? ? (User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) : false @@ -608,6 +608,12 @@ class StudentWorkController < ApplicationController @page = (params['page'] || 1).to_i @student_work_pages = Paginator.new @student_work_count, @limit, @page @offset ||= @student_work_pages.offset + end + + + def index + _index + @stundet_works = paginateHelper @stundet_works, @limit respond_to do |format| format.js @@ -620,6 +626,35 @@ class StudentWorkController < ApplicationController end end + + def sonar + _index + logger.debug "@stundet_works #{@stundet_works}" + + person_list = @stundet_works.map do |work| + o = { + name: "#{work.user.show_real_name}", + uid: "#{work.user.user_extensions.student_id}", + downloadUrl: '' + } + attachment = work.attachments.first + if attachment + o[:downloadUrl] = "https://#{Setting.host_name}/"+download_named_attachment_path(attachment.id, attachment.filename) + end + + o + end + + respond_to do |format| + format.json { + render json: { + homeworkId: @homework.id, + personList: person_list + } + } + end + end + # 查重详情页面的调分 def adjust_review_score if params[:score] && params[:challenge_id] @@ -1842,6 +1877,7 @@ class StudentWorkController < ApplicationController end end + private def hsd_committed_work?(user, homework) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index f48bf0b2..d4352309 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -15,36 +15,37 @@

- <%= link_to @homework.course.name, course_path(@homework.course),:class => "color-grey-9" %> - > <% if @homework.course_homework_category.present? %> - <%= link_to @homework.course_homework_category.name, homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type, :category => @homework.course_homework_category_id), :class => "color-grey-9" %> - <% else %> - <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type),:class => "color-grey-9" %> - <% end %> + <%= link_to @homework.course.name, course_path(@homework.course), :class => "color-grey-9" %> + > + <% if @homework.course_homework_category.present? %> + <%= link_to @homework.course_homework_category.name, homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type, :category => @homework.course_homework_category_id), :class => "color-grey-9" %> + <% else %> + <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type), :class => "color-grey-9" %> + <% end %> > #<%= get_hw_index(@homework, @is_teacher, @homework.homework_type) + 1 %>

@@ -72,11 +73,11 @@ <% end %> <% if @is_teacher && @homework.homework_type == 4 && @homework.homework_group_reviews.count > 0 %> -

  • - - 查重结果 - -
  • +
  • + + 查重结果 + +
  • <% end %>
  • @@ -153,7 +154,7 @@ <% student_works = @homework.student_works.where("work_status != 0") %> <% if @group_teacher %> <% groups = @course.course_groups.where(:id => @member.teacher_course_groups.pluck(:course_group_id)) %> - <% group_students = @course.members.where(:course_group_id => @member.teacher_course_groups.pluck(:course_group_id)).select{|m| m.roles.to_s.include?("Student")} %> + <% group_students = @course.members.where(:course_group_id => @member.teacher_course_groups.pluck(:course_group_id)).select {|m| m.roles.to_s.include?("Student")} %> <% student_works = student_works.where(:user_id => group_students.map(&:user_id)) %> <% else %> <% groups = @course.course_groups %> @@ -198,11 +199,14 @@ 不限 > - + > - + > - +
  • 分班情况: @@ -212,7 +216,8 @@

    <% groups.each do |group| %> > - + <% end %> <% if !@group_teacher %> @@ -241,6 +246,10 @@ <% end %> <% end %> + <% if User.current.admin? %> + 质量检测 + <% end %> +

    @@ -362,8 +371,7 @@ if (!event) { event = window.event; //针对ie浏览器 code = event.keyCode; - } - else { + } else { code = event.keyCode; } if (code == 13) { @@ -416,4 +424,28 @@ pop_box_new(htmlvalue, 452, 163); $("#submit_url").val('<%= import_score_student_work_index_path(:homework => @homework.id) %>'); } + + function sonar() { + $.ajax({ + url: '/student_work/sonar?homework=' + $("#homework_id").val(), + type: 'get', + data: $("#student_work_search_form").serialize(), + success: function (data) { + console.log(data); + //调用sonar + + $.ajax({ + url: 'http://127.0.0.1:8080/api/sonar', + contentType: "application/json; charset=utf-8", + dataType: "json", + type: 'post', + data: JSON.stringify(data), + success: function (data1) { + console.log(data1); + alert('调用完成,请等待处理完成'); + } + }) + } + }) + } diff --git a/config/routes.rb b/config/routes.rb index 082a1d99..d02c1e4e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1247,6 +1247,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'relate_myshixun' get 'shixun_work_export' post 'import_score' + get 'sonar' end end From 407f5615f22797fc133b8033542ea58b839e0a01 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 24 May 2019 10:24:37 +0800 Subject: [PATCH 05/17] =?UTF-8?q?identifier=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 10 ---------- app/services/games_service.rb | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c1c25151..435c71fc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -132,16 +132,6 @@ class ApplicationController < ActionController::Base end end - DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) - # 随机生成字符 - def generates_identifier(container, num) - code = DCODES.sample(num).join - while container.exists?(identifier: code) do - code = DCODES.sample(num).join - end - code - end - def ec_public_auth major_school unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 || major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 || diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 91645e84..b858abe6 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -1039,6 +1039,15 @@ class GamesService end private + DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + # 随机生成字符 + def generates_identifier(container, num) + code = DCODES.sample(num).join + while container.exists?(identifier: code) do + code = DCODES.sample(num).join + end + code + end def format_answer_list games user_info = [] From b920395edef1df514ce9416766820f032aac14d0 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 24 May 2019 10:37:43 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E4=B8=AD=E9=97=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=8E=A5=E5=8F=A3=E6=A0=87=E8=AF=86=E5=AD=98?= =?UTF-8?q?=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 6316446e..7cd18a92 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -493,6 +493,7 @@ class MyshixunsController < ApplicationController return_back_time = format("%.3f", ( t1.to_f - brige_end_time.to_f)).to_f status = jsonTestDetails['status'] game_id = jsonTestDetails['buildID'] + sec_key = jsonTestDetails['sec_key'] logger.info("training_task_status start#1**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") resubmit = jsonTestDetails['resubmit'] outPut = tran_base64_decode64(jsonTestDetails['outPut']) @@ -535,7 +536,7 @@ class MyshixunsController < ApplicationController end logger.info("#############status: #{status}") logger.info("#############resubmit: #{resubmit}") - record = EvaluateRecord.where(:identifier => params[:sec_key]).first + record = EvaluateRecord.where(:identifier => sec_key).first logger.info("training_task_status start#3**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") # status:0表示评测成功 From a31b826039c2d9022c1b0d8a5bb4c79eb69eba02 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 10:51:00 +0800 Subject: [PATCH 07/17] sec_key --- public/react/src/modules/page/MainContentContainer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 01126075..8b60a4c6 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -617,10 +617,10 @@ class MainContentContainer extends Component { // 之前的task_commit方法 gameBuild(fileUpdateResponse, first) { const { st, challenge, output_sets, onRunCodeTestFinish, resetTestSetsExpandedArray, showSnackbar, time_limit } = this.props - const { resubmit, content_modified } = fileUpdateResponse.data; + const { resubmit, content_modified, sec_key } = fileUpdateResponse.data; const timeOut = time_limit; // http://localhost:3000/myshixuns/so5w6iap97/stages/zl6kx8f7vfpo/game_build?first=1&resubmit=GDBEX741_1993 - const game_build_url = `${locationPath}/game_build?first=${first}&resubmit=${resubmit}&content_modified=${content_modified}` + const game_build_url = `${locationPath}/game_build?first=${first}&resubmit=${resubmit}&content_modified=${content_modified}&sec_key=${sec_key}` // var timeOut = parseInt(<%= @myshixun.main_mirror.try(:time_limit) %>); // 超时参数 resetTestSetsExpandedArray() axios.get(game_build_url, { From 80f9ee5ed5d0a359f5a7b6287166e80a97603a56 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 11:08:52 +0800 Subject: [PATCH 08/17] 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 d99476a6..4ffc07d1 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 ae07c1b6df863155303ed836fc90874d0be852b7 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 24 May 2019 12:49:32 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AF=84=E6=B5=8B?= =?UTF-8?q?=E4=B8=8D=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 1 + app/services/games_service.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 7cd18a92..f6854c7a 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -536,6 +536,7 @@ class MyshixunsController < ApplicationController end logger.info("#############status: #{status}") logger.info("#############resubmit: #{resubmit}") + logger.info("sec_key is#############resubmit: #{sec_key}") record = EvaluateRecord.where(:identifier => sec_key).first logger.info("training_task_status start#3**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") diff --git a/app/services/games_service.rb b/app/services/games_service.rb index b858abe6..098311f8 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -347,10 +347,11 @@ class GamesService rev = params[:rev] ? params[:rev] : "master" content_modified = 0 ActiveRecord::Base.transaction do - sec_key = generates_identifier(EvaluateRecord, 10) + # params[:evaluate] 实训评测时更新必须给的参数,需要依据该参数做性能统计,其它类型的更新可以跳过 # 自动保存的时候evaluate为0;点评测的时候为1 if params[:evaluate] == 1 + sec_key = generates_identifier(EvaluateRecord, 10) record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id, :game_id => @game.id, :identifier => sec_key) Rails.logger.warn("##game is is #{@game.id}, record id is #{record.id}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") From fdecb7c53d14fce02f266d1068a3fd2f0b5644e5 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 24 May 2019 12:50:50 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E4=BF=AE=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/games_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 098311f8..2139715e 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -388,7 +388,7 @@ class GamesService if content != last_content && code_file.blank? raise("update file failed") else - return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified, sec_key: record.identifier} + return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified, sec_key: record.try(:identifier)} end end rescue Exception => e From 22f303e4df0b07a5657f0ec6fef8963b79af2892 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 14:14:33 +0800 Subject: [PATCH 11/17] sec_key --- public/react/src/modules/page/MainContentContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 8b60a4c6..b7fcdfa8 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -639,7 +639,7 @@ class MainContentContainer extends Component { let requestTimes = 0; var gameStatusIntervalId = setInterval(()=>{ - let game_status_url = `${locationPath}/game_status?port=${port}&resubmit=${resubmit||""}&time_out=${timeOutFlag}` + let game_status_url = `${locationPath}/game_status?port=${port}&resubmit=${resubmit||""}&time_out=${timeOutFlag}&sec_key=${sec_key}` axios.get(game_status_url, { withCredentials: true, From ce9dc71211f88f30dc054ac8a2ab45a6024468fb Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 14:22:11 +0800 Subject: [PATCH 12/17] 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 4ffc07d1..e102dde8 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 b30d8a6a898642510d93c716ec2805e33054c872 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 24 May 2019 14:51:19 +0800 Subject: [PATCH 13/17] modify create ec year code --- app/controllers/ec_years_controller.rb | 245 +---------------- app/models/ec_graduation_subitem.rb | 3 + app/models/ec_require_sub_vs_standard.rb | 3 + app/models/ec_requirement_vs_objective.rb | 2 + app/models/ec_training_subitem.rb | 1 + app/models/ec_year.rb | 4 + app/models/school.rb | 1 + app/services/copy_ec_year_service.rb | 306 ++++++++++++++++++++++ 8 files changed, 324 insertions(+), 241 deletions(-) create mode 100644 app/services/copy_ec_year_service.rb diff --git a/app/controllers/ec_years_controller.rb b/app/controllers/ec_years_controller.rb index 4661fd7b..c0c9483c 100644 --- a/app/controllers/ec_years_controller.rb +++ b/app/controllers/ec_years_controller.rb @@ -17,18 +17,11 @@ class EcYearsController < ApplicationController # 添加年份 def create @major_school = EcMajorSchool.find(params[:ec_major_school_id]) - ec_years = @major_school.ec_years.pluck(:year) - exist_year = ec_years.include?(params[:year].to_i) - if exist_year + if @major_school.ec_years.exists?(year: params[:year].to_i) @status = -1 else - prev_year = "#{params[:year].to_i - 1}" - prev_ec_year = @major_school.ec_years.where(:year => prev_year).first - if prev_ec_year.blank? - EcYear.create!(:year => params[:year], :ec_major_school_id => @major_school.id) - else - copy_year(prev_ec_year, params[:year]) - end + service = CopyEcYearService.new(@major_school, params[:year].to_i) + service.call @status = 1 end @major_manager = true @@ -246,7 +239,7 @@ class EcYearsController < ApplicationController template_file = EcTemplate.find_by_name "课程列表导入模板" if template_file.present? file = template_file.attachments.first - @file_url = "/attachments/download/#{file.id}/#{file.filename}" + @file_url = '' #"/attachments/download/#{file.id}/#{file.filename}" else @file_url = "javascript:void(0);" end @@ -357,236 +350,6 @@ class EcYearsController < ApplicationController @year = EcYear.find(params[:id]) end - # 复制最新一届下的所有数据. previous_ec_year: 本专业最新一届, new_year: 新建的届别 - def copy_year previous_ec_year, new_year - ActiveRecord::Base.transaction do - begin - # 如果是第一次创建届别,则直接创建 - if previous_ec_year.blank? - raise("没有界别可以复制") - else - logger.info("############previous_ec_year: #{previous_ec_year.id}") - # 多个中间表需要替换的id - egs_record = [] # 记录ec_graduation_subitems的新旧值 例如: [[prev_egs, new_egs], [...]] - egr_record = [] # 记录ec_graduation_requirements的新旧值, 例如: [[prev_egr, new_egr], [...]] - ec_record = [] # 记录ec_courses - ece_record = [] # 记录ec_course_evaluations - eces_record= [] # 记录ec_course_evaluation_subitems - ect_record = [] # 记录ec_course_targets - - # 复制 "届别" - ec_year = EcYear.create!(:year => new_year, - :ec_major_school_id => previous_ec_year.ec_major_school_id, - :calculation_value => previous_ec_year.calculation_value) - - # 复制 "毕业要求" - previous_ec_year.ec_graduation_requirements.try(:each) do |pre_egr| - new_egr = EcGraduationRequirement.new - new_egr.attributes = pre_egr.attributes.dup.except("id", "ec_year_id") - new_egr.ec_year_id = ec_year.id - new_egr.save! - egr_record << [pre_egr.id, new_egr.id] - # 复制 "毕业要求子标点" - pre_egr.ec_graduation_subitems.try(:each) do |pre_egs| - new_egs = EcGraduationSubitem.new - new_egs.attributes = pre_egs.attributes.dup.except("id", "ec_graduation_requirement_id") - new_egs.ec_graduation_requirement_id = new_egr.id - new_egs.save! - # 记录新旧对应关系,为之后的中间表做记录 - egs_record << [pre_egs.id, new_egs.id] - prev_ersvss = EcRequireSubVsStandard.where(:ec_graduation_subitem_id => pre_egs.id) - prev_ersvss.each do |prev_ersvs| - new_ersvss = EcRequireSubVsStandard.new - new_ersvss.attributes = prev_ersvs.attributes.dup.except("id", "ec_graduation_subitem_id") - new_ersvss.ec_graduation_subitem_id = new_egs.id - new_ersvss.save! - end - - end - end - - # 复制 "培养目标" - pre_eto = previous_ec_year.ec_training_objective - if pre_eto.present? - new_eto = EcTrainingObjective.new - new_eto.attributes = pre_eto.attributes.dup.except("id", "ec_year_id") - new_eto.ec_year_id = ec_year.id - new_eto.save! - - # 复制 "培养目标分项" - pre_eto.ec_training_subitems.try(:each) do |pre_ets| - new_ets = EcTrainingSubitem.new - new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id") - new_ets.ec_training_objective_id = new_eto.id - new_ets.save! - - # 复制 "毕业要去 vs 培养目标" - pre_ervsos = EcRequirementVsObjective.where(:ec_training_objective_id => pre_ets.id) - pre_ervsos.each do |ervso| - new_ervso = EcRequirementVsObjective.new - new_ervso.attributes = ervso.attributes.dup.except("id", "ec_training_objective_id", "ec_graduation_requirement_id") - new_ervso.ec_training_objective_id = new_ets.id - new_egr_id = -1 - egr_record.each do |egr_id| - if egr_id[0] == ervso.ec_graduation_requirement_id - new_egr_id = egr_id[1] - end - end - raise("找不对应的毕业要求") if new_egr_id == -1 - new_ervso.ec_graduation_requirement_id = new_egr_id - new_ervso.save! - end - end - end - - # 复制 "课程体系" - previous_ec_year.ec_courses.try(:each) do |pre_ec| - new_ec = EcCourse.create!(name: pre_ec.name, ec_year_id: ec_year.id) - ec_record << [pre_ec.id, new_ec.id] - # 复制 "课程考核标准" - pre_ec.ec_course_evaluations.try(:each) do |pre_ece| - new_ece = EcCourseEvaluation.create!(name: pre_ece.name, - evluation_count: pre_ece.evluation_count, - ec_course_id: new_ec.id, - is_course_type: pre_ece.is_course_type) - ece_record << [pre_ece.id, new_ece.id] - # 复制 "考核分项" - pre_ece.ec_course_evaluation_subitems.try(:each) do |pre_eces| - new_eces = EcCourseEvaluationSubitem.create!(name: pre_eces.name, ec_course_evaluation_id: new_ece.id) - # 记录新旧对应关系,为之后的中间表做记录 - eces_record << [pre_eces.id, new_eces.id] - end - end - - # 复制 "课程目标" - pre_ec.ec_course_targets.try(:each) do |pre_ect| - new_ect = EcCourseTarget.new - new_ect.attributes = pre_ect.attributes.dup.except("id", "ec_course_id") - new_ect.ec_course_id = new_ec.id - new_ect.save! - # 记录新旧对应关系,为之后的中间表做记录 - ect_record << [pre_ect.id, new_ect.id] - # 复制 "课程目标和毕业要求指标点" - pre_ect.ec_graduation_subitem_course_targets.try(:each) do |pre_egsct| - new_egsct = EcGraduationSubitemCourseTarget.new - new_egsct.attributes = pre_egsct.attributes.dup.except("id", "ec_graduation_subitem_id", "ec_course_target_id") - # 寻找对应的new_egs_id - logger.info("############egs_record:#{egs_record}") - logger.info("############ec_graduation_subitem_id: #{pre_egsct.ec_graduation_subitem_id}") - new_egs_id = -1 - egs_record.each do |id| - if id[0] == pre_egsct.ec_graduation_subitem_id - new_egs_id = id[1] - end - end - raise("课程目标和毕业要求指标点找不到对应关系.") if new_egs_id == -1 - new_egsct.ec_graduation_subitem_id = new_egs_id - new_egsct.ec_course_target_id = new_ect.id - new_egsct.save! - end - - # 复制 "课程达成方法" - pre_ect.ec_course_achievement_methods.each do |pre_ecam| - # 寻找对应的 ec_course_id - new_ec_id = -1 - new_ece_id = -1 - new_eces_id = -1 - ec_record.each do |ec_id| - if ec_id[0] == pre_ecam.ec_course_id - new_ec_id = ec_id[1] - end - end - # 寻找对应的ec_course_evaluation_id - ece_record.each do |ece_id| - if ece_id[0] == pre_ecam.ec_course_evaluation_id - new_ece_id = ece_id[1] - end - end - # 寻找对应的ec_course_evaluation_subitem_id - eces_record.each do |eces_id| - if eces_id[0] == pre_ecam.ec_course_evaluation_subitem_id - new_eces_id = eces_id[1] - end - end - - new_ecam = EcCourseAchievementMethod.new - new_ecam.attributes = pre_ecam.attributes.dup.except("id", "ec_course_id", "ec_course_evaluation_id", - "ec_course_evaluation_subitem_id", "ec_course_target_id") - new_ecam.ec_course_id = new_ec_id if new_ec_id != -1 - new_ecam.ec_course_evaluation_id = new_ece_id if new_ece_id != -1 - new_ecam.ec_course_evaluation_subitem_id = new_eces_id if new_eces_id != -1 - new_ecam.ec_course_target_id = new_ect.id - new_ecam.save! - - # 复制 "课程评价达成关系" - pre_ecam.ec_achievement_evaluation_relates.each do |pre_eaer| - new_eaer = EcAchievementEvaluationRelate.new - new_eaer.attributes = pre_eaer.attributes.dup.except("id", "ec_course_achievement_method_id", - "ec_course_evaluation_subitem_id", "ec_course_target_id") - new_eaer.ec_course_achievement_method_id = new_ecam.id - # 寻找对应的 ec_course_evaluation_subitem_id - new_eces_id = -1 - eces_record.each do |eces_id| - if eces_id[0] == pre_eaer.ec_course_evaluation_subitem_id - new_eces_id = eces_id[1] - end - end - new_eaer.ec_course_evaluation_subitem_id = new_eces_id if new_eces_id != -1 - # 寻找对应的 ec_course_target_id - new_ect_id = -1 - ect_record.each do |ect_id| - if ect_id[0] == pre_eaer.ec_course_target_id - new_ect_id = ect_id[1] - end - end - new_eaer.ec_course_target_id = new_ect_id if new_ect_id != -1 - new_eaer.save! - end - end - end - - # 复制 "课程支撑" - pre_ec.ec_course_supports.try(:each) do |pre_ecs| - new_ecs = EcCourseSupport.new - new_ecs.attributes = pre_ecs.attributes.dup.except("id", "ec_course_id") - new_ecs.ec_course_id = new_ec.id - new_ecs.save! - # 复制 "课程vs毕业要求" - pre_ecs.ec_graduation_subitem_courses.try(:each) do |pre_egsc| - new_egs_id = -1 - egs_record.each do |egs_id| - if egs_id[0] == pre_egsc.ec_graduation_subitem_id - new_egs_id = egs_id[1] - end - end - new_egsc = EcGraduationSubitemCourse.new - new_egsc.attributes = pre_egsc.attributes.dup.except("id", "ec_graduation_subitem_id", "ec_course_support_id") - raise("找不到课程vs毕业要求的关联关系!") if new_egs_id == -1 - new_egsc.ec_graduation_subitem_id = new_egs_id - new_egsc.ec_course_support_id = new_ecs.id - new_egsc.save! - end - - end - - # 复制 "成绩等级设置" - pre_ec.ec_score_levels.try(:each) do |pre_esl| - new_esl = EcScoreLevel.new - new_esl.attributes = pre_esl.attributes.dup.except("id", "ec_course_id") - new_esl.ec_course_id = new_ec.id - new_esl.save! - end - - end - end - rescue Exception => e - logger.error("###########error_message: #{e.message}") - raise ActiveRecord::Rollback - end - - end - end - # 导出培养目标excel def export_training_objectives objects xls_report = StringIO.new diff --git a/app/models/ec_graduation_subitem.rb b/app/models/ec_graduation_subitem.rb index b82b0789..12f60091 100644 --- a/app/models/ec_graduation_subitem.rb +++ b/app/models/ec_graduation_subitem.rb @@ -9,4 +9,7 @@ class EcGraduationSubitem < ActiveRecord::Base # 课程目标配置 has_many :ec_course_targets, :through => :ec_graduation_subitem_course_targets has_many :ec_graduation_subitem_course_targets, :dependent => :destroy + + has_many :ec_require_sub_vs_standards + has_many :ec_graduation_standards, through: :ec_require_sub_vs_standards end diff --git a/app/models/ec_require_sub_vs_standard.rb b/app/models/ec_require_sub_vs_standard.rb index a68481e1..0c696a9e 100644 --- a/app/models/ec_require_sub_vs_standard.rb +++ b/app/models/ec_require_sub_vs_standard.rb @@ -1,3 +1,6 @@ class EcRequireSubVsStandard < ActiveRecord::Base attr_accessible :ec_graduation_standard_id, :ec_graduation_subitem_id, :status + + belongs_to :ec_graduation_standard + belongs_to :ec_graduation_subitem end diff --git a/app/models/ec_requirement_vs_objective.rb b/app/models/ec_requirement_vs_objective.rb index 7b17e054..9c2b5878 100644 --- a/app/models/ec_requirement_vs_objective.rb +++ b/app/models/ec_requirement_vs_objective.rb @@ -1,3 +1,5 @@ class EcRequirementVsObjective < ActiveRecord::Base attr_accessible :ec_graduation_requirement_id, :ec_training_objective_id, :status + belongs_to :ec_graduation_requirement + belongs_to :ec_training_subitem end diff --git a/app/models/ec_training_subitem.rb b/app/models/ec_training_subitem.rb index 92edb18b..6f9a4f12 100644 --- a/app/models/ec_training_subitem.rb +++ b/app/models/ec_training_subitem.rb @@ -1,4 +1,5 @@ class EcTrainingSubitem < ActiveRecord::Base belongs_to :ec_training_objective + has_many :ec_requirement_vs_objectives, foreign_key: :ec_training_objective_id end diff --git a/app/models/ec_year.rb b/app/models/ec_year.rb index 83f5f78b..5f9aa00b 100644 --- a/app/models/ec_year.rb +++ b/app/models/ec_year.rb @@ -16,4 +16,8 @@ class EcYear < ActiveRecord::Base # 课堂配置 has_many :ec_courses, :dependent => :destroy acts_as_attachable + + def prev_year + ec_major_school.ec_years.find_by_year(year - 1) + end end diff --git a/app/models/school.rb b/app/models/school.rb index c5018191..8342039e 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -16,6 +16,7 @@ class School < ActiveRecord::Base has_many :ec_majors, :through => :ec_major_schools has_many :ec_major_schools, :dependent => :destroy + has_one :ec_template_major, conditions: 'template_major = 1', class_name: 'EcMajorSchool' has_many :partners, :dependent => :destroy has_many :customers, :dependent => :destroy diff --git a/app/services/copy_ec_year_service.rb b/app/services/copy_ec_year_service.rb new file mode 100644 index 00000000..83073d53 --- /dev/null +++ b/app/services/copy_ec_year_service.rb @@ -0,0 +1,306 @@ + class CopyEcYearService + attr_reader :major_school, :to_year + + def initialize(major_school, year) + @major_school = major_school + @to_year = major_school.ec_years.new(year: year) + end + + def call + if from_year.blank? + to_year.save! + return to_year + end + + # 专业第一次创建届别时,复制示例专业2017届 + ActiveRecord::Base.transaction do + copy_ec_year! + + copy_graduation_requirement! + + copy_training_objective! + + new_major_school? ? copy_template_ec_course! : copy_ec_courses! + end + + to_year + end + + private + + def new_major_school? + @_new_major ||= major_school.ec_years.count.zero? + end + + def from_year + @_from_year ||= new_major_school? ? template_major_year : to_year.prev_year + end + + def template_major_year + EcYear.joins(:ec_major_school).where(ec_major_schools: { template_major: true }).find_by_year('2017') + end + + def copy_ec_year! + to_year.calculation_value = from_year.calculation_value + to_year.save! + end + + def copy_graduation_requirement! + requirements = from_year.ec_graduation_requirements.includes(ec_graduation_subitems: :ec_require_sub_vs_standards) + + requirements.each do |requirement| + to_requirement = to_year.ec_graduation_requirements.new + to_requirement.attributes = requirement.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at') + to_requirement.save! + + # 记录对应关系,创建支撑时使用 + graduation_requirement_map[requirement.id] = to_requirement.id + + copy_graduation_subitems(requirement, to_requirement) + end + end + + def copy_graduation_subitems(requirement, to_requirement) + requirement.ec_graduation_subitems.each do |item| + to_item = to_requirement.ec_graduation_subitems.new + to_item.attributes = item.attributes.except('id', 'ec_graduation_requirement_id', 'created_at', 'updated_at') + to_item.save! + + # 记录对应关系,创建支撑时使用 + graduation_subitem_map[item.id] = to_item.id + + copy_requirement_standard_supports!(item, to_item) + end + end + + def copy_requirement_standard_supports!(graduation_subitem, to_graduation_subitem) + graduation_subitem.ec_require_sub_vs_standards.each do |support| + to_support = to_graduation_subitem.ec_require_sub_vs_standards.new + to_support.attributes = support.attributes.except('id', 'ec_graduation_subitem_id', 'created_at', 'updated_at') + to_support.save! + end + end + + def copy_training_objective! + training_objective = from_year.ec_training_objective + return if training_objective.blank? + + attributes = training_objective.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at') + to_training_objective = to_year.create_ec_training_objective!(attributes) + + copy_training_subitems!(training_objective, to_training_objective) + end + + def copy_training_subitems!(training_objective, to_training_objective) + training_subitems = training_objective.ec_training_subitems.includes(:ec_requirement_vs_objectives) + + training_subitems.each do |item| + to_item = to_training_objective.ec_training_subitems.new + to_item.attributes = item.attributes.except('id', 'ec_training_objective_id', 'created_at', 'updated_at') + to_item.save! + + copy_requirement_vs_objectives!(item, to_item) + end + end + + def copy_requirement_vs_objectives!(training_item, to_training_item) + training_item.ec_requirement_vs_objectives.each do |support| + to_support = to_training_item.ec_requirement_vs_objectives.new(status: support.status) + to_support.ec_graduation_requirement_id = graduation_requirement_map[support.ec_graduation_requirement_id] + to_support.save! + end + end + + def copy_template_ec_course! + course = from_year.ec_courses.includes( + :ec_score_levels, + ec_course_evaluations: :ec_course_evaluation_subitems, + ec_course_targets: :ec_graduation_subitem_course_targets, + ec_course_achievement_methods: :ec_achievement_evaluation_relates, + ec_course_supports: :ec_graduation_subitem_courses + ).find_by_name('数据库原理') + + to_course = to_year.ec_courses.new + to_course.attributes = course.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at') + to_course.save! + + course_map[course.id] = to_course.id + + copy_course_evaluations!(course, to_course) + copy_course_targets!(course, to_course) + copy_course_achievement_methods!(course, to_course) + copy_ec_course_supports!(course, to_course) + copy_score_levels!(course, to_course) + + # 复制示例时需要复制学生和成绩数据 + copy_year_students! + end + + def copy_ec_courses! + courses = from_year.ec_courses.includes( + :ec_score_levels, + ec_course_evaluations: :ec_course_evaluation_subitems, + ec_course_targets: :ec_graduation_subitem_course_targets, + ec_course_achievement_methods: :ec_achievement_evaluation_relates, + ec_course_supports: :ec_graduation_subitem_courses + ) + + courses.each do |course| + to_course = to_year.ec_courses.new + to_course.attributes = course.attributes.except('id', 'ec_year_id', 'created_at', 'updated_at') + to_course.save! + + course_map[course.id] = to_course.id + + copy_course_evaluations!(course, to_course) + copy_course_targets!(course, to_course) + copy_course_achievement_methods!(course, to_course) + copy_ec_course_supports!(course, to_course) + copy_score_levels!(course, to_course) + end + end + + def copy_course_evaluations!(course, to_course) + course.ec_course_evaluations.each do |evaluation| + to_evaluation = to_course.ec_course_evaluations.new + to_evaluation.attributes = evaluation.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at') + to_evaluation.save! + + course_evaluation_map[evaluation.id] = to_evaluation.id + + copy_course_evaluation_subitems!(evaluation, to_evaluation) + end + end + + def copy_course_evaluation_subitems!(evaluation, to_evaluation) + evaluation.ec_course_evaluation_subitems.each do |item| + to_item = to_evaluation.ec_course_evaluation_subitems.new + to_item.attributes = item.attributes.except('id', 'ec_course_evaluation_id', 'created_at', 'updated_at') + to_item.save! + + course_evaluation_subitem_map[item.id] = to_item.id + end + end + + def copy_course_targets!(course, to_course) + course.ec_course_targets.each do |target| + to_target = to_course.ec_course_targets.new + to_target.attributes = target.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at') + to_target.save! + + course_target_map[target.id] = to_target.id + + copy_graduation_subitem_course_targets!(target, to_target) + end + end + + def copy_graduation_subitem_course_targets!(target, to_target) + target.ec_graduation_subitem_course_targets.each do |support| + to_support = to_target.ec_graduation_subitem_course_targets.new + to_support.attributes = support.attributes.except('id', 'ec_graduation_subitem_id', 'created_at', 'updated_at') + to_support.ec_graduation_subitem_id = graduation_subitem_map[support.ec_graduation_subitem_id] + to_support.save! + end + end + + def copy_course_achievement_methods!(course, to_course) + course.ec_course_achievement_methods.each do |from| + to = to_course.ec_course_achievement_methods.new + to.attributes = from.attributes.except('id', 'ec_course_id', 'ec_course_target_id', 'ec_course_evaluation_id', + 'ec_course_evaluation_subitem_id', 'created_at', 'updated_at') + + to.ec_course_target_id = course_target_map[from.ec_course_target_id] + to.ec_course_evaluation_id = course_evaluation_map[from.ec_course_evaluation_id] + to.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[from.ec_course_evaluation_subitem_id] + to.save! + + copy_achievement_evaluation_relates!(from, to) + end + end + + def copy_achievement_evaluation_relates!(method, to_method) + method.ec_achievement_evaluation_relates.each do |relate| + to_relate = to_method.ec_achievement_evaluation_relates.new + 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.save! + end + end + + def copy_ec_course_supports!(course, to_course) + course.ec_course_supports.each do |support| + to_support = to_course.ec_course_supports.new + to_support.attributes = support.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at') + to_support.save! + + copy_graduation_subitem_courses!(support, to_support) + end + end + + def copy_graduation_subitem_courses!(course_support, to_course_support) + course_support.ec_graduation_subitem_courses.each do |item| + to_item = to_course_support.ec_graduation_subitem_courses.new + to_item.attributes = item.attributes.except('id', 'ec_course_support_id', 'ec_graduation_subitem_id', + 'created_at', 'updated_at') + to_item.ec_graduation_subitem_id = graduation_subitem_map[item.ec_graduation_subitem_id] + to_item.save! + end + end + + def copy_score_levels!(course, to_course) + course.ec_score_levels.each do |level| + to_level = to_course.ec_score_levels.new + to_level.attributes = level.attributes.except('id', 'ec_course_id', 'created_at', 'updated_at') + to_level.save! + end + end + + def copy_year_students! + students = from_year.ec_year_students.includes(:ec_student_achievements) + + 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.save! + + copy_student_achievements!(student, to_student) + end + end + + def copy_student_achievements!(student, to_student) + student.ec_student_achievements.each do |achievement| + to_achievement = to_student.ec_student_achievements.new + to_achievement.attributes = achievement.attributes.except('id', 'ec_year_student_id', 'ec_course_evaluation_id', + 'ec_course_evaluation_subitem_id', 'created_at', 'updated_at') + to_achievement.ec_course_evaluation_id = course_evaluation_map[achievement.ec_course_evaluation_id] + to_achievement.ec_course_evaluation_subitem_id = course_evaluation_subitem_map[achievement.ec_course_evaluation_subitem_id] + to_achievement.save! + end + end + + def graduation_requirement_map + @_graduation_requirement_map ||= {} + end + + def graduation_subitem_map + @_graduation_subitem_map ||= {} + end + + def course_map + @_course_map ||= {} + end + + def course_evaluation_map + @_course_evaluation_map ||= {} + end + + def course_evaluation_subitem_map + @_course_evaluation_subitem_map ||= {} + end + + def course_target_map + @_course_target_map ||= {} + end + end \ No newline at end of file From 2a3e7090ae4aa450926abb0ba522cd2e6c97dd1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 24 May 2019 15:04:29 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/common/index.html.erb | 2 +- .../ec_major_schools/_year_list.html.erb | 12 +++---- app/views/ec_major_schools/show.html.erb | 33 +++++++++++-------- app/views/ec_years/ec_course_setting.html.erb | 7 ++-- .../ec_years/graduation_requirement.html.erb | 11 ++++--- .../requirement_vs_objective.html.erb | 11 ++++--- .../ec_years/requirement_vs_standard.html.erb | 11 ++++--- .../ec_years/training_objectives.html.erb | 11 ++++--- app/views/ecs/_ec_top_navigation.html.erb | 8 +++-- app/views/ecs/department.html.erb | 11 ++++--- .../javascripts/educoder/edu_application.js | 16 +++++++++ public/react/.vscode/settings.json | 3 -- public/react/src/App.js | 15 ++++++--- .../ecCompletion_calculation.js | 3 ++ .../ecCourseEvaluations.js | 3 +- .../ecCourseEvaluationsbottom.js | 5 ++- .../ec/ecCourseSupportSetting/index.js | 1 + .../ec/ecCourseSupports/ecCourseSupports.js | 5 ++- .../ecGradeEvaluations/ecGradeEvaluations.js | 2 ++ .../modules/ec/ecStudentList/ecStudentList.js | 10 ++++-- .../react/src/modules/ec/ecTitle/ecTitle.css | 2 +- .../react/src/modules/ec/ecTitle/ecTitle.js | 11 +++++-- .../GraduatesRequirement.js | 14 ++++++-- public/stylesheets/educoder/edu-all.css | 8 ++--- public/stylesheets/educoder/edu-main.css | 9 +++++ 25 files changed, 153 insertions(+), 71 deletions(-) delete mode 100644 public/react/.vscode/settings.json diff --git a/app/views/common/index.html.erb b/app/views/common/index.html.erb index 4ffc07d1..e5922129 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 diff --git a/app/views/ec_major_schools/_year_list.html.erb b/app/views/ec_major_schools/_year_list.html.erb index 45a85d29..1e561782 100644 --- a/app/views/ec_major_schools/_year_list.html.erb +++ b/app/views/ec_major_schools/_year_list.html.erb @@ -15,12 +15,12 @@ <%= graduation_requirements > 0 ? graduation_requirements : @btn_text %> - - <% students = year.ec_year_students.count %> - - <%= students > 0 ? students : @btn_text %> - - + + + + + + <% courses = year.ec_courses.count %> diff --git a/app/views/ec_major_schools/show.html.erb b/app/views/ec_major_schools/show.html.erb index 05b58399..c3e4c924 100644 --- a/app/views/ec_major_schools/show.html.erb +++ b/app/views/ec_major_schools/show.html.erb @@ -4,21 +4,26 @@

    -

    - <%= @major.name %> +

    @@ -31,7 +36,7 @@ 届别 培养目标 毕业要求 - 学生 + 课程体系 课程目标
    (达成情况)
    毕业要求指标点
    (达成情况)
    diff --git a/app/views/ec_years/ec_course_setting.html.erb b/app/views/ec_years/ec_course_setting.html.erb index 865d7733..9a697ba3 100644 --- a/app/views/ec_years/ec_course_setting.html.erb +++ b/app/views/ec_years/ec_course_setting.html.erb @@ -1,9 +1,10 @@
    <%= render :partial => "ecs/ec_top_navigation" %> -

    - 课程体系(<%= @ec_courses.count %>) -

    +
      +
    • 课程体系(<%= @ec_courses.count %>)
    • +

      提供模板支持课程信息导入,亦可直接新增课程;并继续完成每门课程的评估机制配置查看详情

      +

    温馨提醒:请下载课程模板(点击下载),将本届所有参与认证的课程名称导入系统,以便录入教学活动相关数据 <%= file_field_tag 'attachments[dummy][file]', diff --git a/app/views/ec_years/graduation_requirement.html.erb b/app/views/ec_years/graduation_requirement.html.erb index 955f226d..eab92924 100644 --- a/app/views/ec_years/graduation_requirement.html.erb +++ b/app/views/ec_years/graduation_requirement.html.erb @@ -10,12 +10,15 @@

    <%= render :partial => "ecs/ec_top_navigation" %>
    -

    - 毕业要求(及其指标点) +

      +
    • +

      毕业要求(及其指标点)

      +

      请结合本专业特色修改毕业要求文字描述及指标点,需完全覆盖12项通用标准查看详情

      +
    • <% if @template_major || @ec_major_school.template_major %> - <%=link_to "导出毕业要求", graduation_requirement_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id, :format => 'xls'), :class => "fr white-btn edu-blueback-btn" %> + <%=link_to "导出毕业要求", graduation_requirement_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id, :format => 'xls'), :class => "fr white-btn edu-blueback-btn mt25" %> <% end %> -

      +

    指标点 diff --git a/app/views/ec_years/requirement_vs_objective.html.erb b/app/views/ec_years/requirement_vs_objective.html.erb index ad49d552..fc5c9198 100644 --- a/app/views/ec_years/requirement_vs_objective.html.erb +++ b/app/views/ec_years/requirement_vs_objective.html.erb @@ -1,12 +1,15 @@

    <%= render :partial => "ecs/ec_top_navigation" %>
    -

    - 毕业要求对培养目标的支撑 +

      +
    • +

      毕业要求对培养目标的支撑

      +

      用矩阵图的形式说明本专业毕业要求对培养目标的支撑关系,鼠标左键单击单元格即可查看详情

      +
    • <% if @template_major || @ec_major_school.template_major %> - <%=link_to "导出矩阵", requirement_vs_objective_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id, :format => 'xls'), :class => "fr white-btn edu-blueback-btn" %> + <%=link_to "导出矩阵", requirement_vs_objective_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id, :format => 'xls'), :class => "fr white-btn edu-blueback-btn mt25" %> <% end %> -

      +

    表示支撑 diff --git a/app/views/ec_years/requirement_vs_standard.html.erb b/app/views/ec_years/requirement_vs_standard.html.erb index 90c4ecce..64acade8 100644 --- a/app/views/ec_years/requirement_vs_standard.html.erb +++ b/app/views/ec_years/requirement_vs_standard.html.erb @@ -1,12 +1,15 @@

    <%= render :partial => "ecs/ec_top_navigation" %>
    -

    - 毕业要求对通用标准的支撑 +

      +
    • +

      毕业要求对通用标准的支撑

      +

      用矩阵图的形式说明本专业毕业要求对12项通用标准的覆盖关系,鼠标左键单击单元格即可查看详情

      +
    • <% if @template_major || @ec_major_school.template_major %> - <%=link_to "导出矩阵", requirement_vs_standard_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id, :format => 'xls'), :class => "fr white-btn edu-blueback-btn" %> + <%=link_to "导出矩阵", requirement_vs_standard_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id, :format => 'xls'), :class => "fr white-btn edu-blueback-btn mt25" %> <% end %> -

      +

    表示支撑 diff --git a/app/views/ec_years/training_objectives.html.erb b/app/views/ec_years/training_objectives.html.erb index 585e8e22..fb8d860b 100644 --- a/app/views/ec_years/training_objectives.html.erb +++ b/app/views/ec_years/training_objectives.html.erb @@ -2,12 +2,15 @@ <%= render :partial => "ecs/ec_top_navigation" %>

    -

    - 培养目标 +

    <%= render :partial => "training_objective_contents" %>
    diff --git a/app/views/ecs/_ec_top_navigation.html.erb b/app/views/ecs/_ec_top_navigation.html.erb index 56583596..40f3b50e 100644 --- a/app/views/ecs/_ec_top_navigation.html.erb +++ b/app/views/ecs/_ec_top_navigation.html.erb @@ -45,12 +45,16 @@ ">4 " href="<%= requirement_vs_standard_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id) %>">毕业要求 vs 通用标准
  • +
  • "> + ">5 + " href="<%= student_lists_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id) %>">学生 +
  • "> - ">5 + ">6 " href="<%= ec_course_setting_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id) %>">课程体系
  • "> - ">6 + ">7 " href="<%= requirement_vs_courses_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id) %>">课程体系 vs 毕业要求
  • diff --git a/app/views/ecs/department.html.erb b/app/views/ecs/department.html.erb index d31e0726..a072094a 100644 --- a/app/views/ecs/department.html.erb +++ b/app/views/ecs/department.html.erb @@ -19,12 +19,15 @@ <% end %>
    -

    - 专业列表 +

    <%= @obj_count %> diff --git a/public/javascripts/educoder/edu_application.js b/public/javascripts/educoder/edu_application.js index 437fb319..7cce4a21 100644 --- a/public/javascripts/educoder/edu_application.js +++ b/public/javascripts/educoder/edu_application.js @@ -1229,3 +1229,19 @@ $(document).bind('ajaxError', function(event, xhr, settings) { } }); /** tpm实训开启按钮,不允许多次点击 END */ + + +//工程认证各个页面的查看详情弹层 +function elasticLayer(forumId){ + var html='
    ' + + '

    工程教育专业认证【培养目标】' + + '返回

    ' + + '
    ' + $(".newMain").after(html).hide(); + document.body.addEventListener('touchmove',bodyScroll,false); + $('body').css({'position':'fixed',"width":"100%"}); +} +function removeElasticLayer(){ + $(".layerContent").remove(); + $(".newMain").show(); +} diff --git a/public/react/.vscode/settings.json b/public/react/.vscode/settings.json deleted file mode 100644 index 0e0dcd23..00000000 --- a/public/react/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} \ No newline at end of file diff --git a/public/react/src/App.js b/public/react/src/App.js index d0451eaa..9c89cb1b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -125,12 +125,13 @@ const NewContentCareerPathIndex =Loadable({ loader: () => import('./modules/careerPath/managementsCareerPath/New_Content_Career_Path_Index'), loading: Loading, }) - +{/*课程体系对毕业要求的支撑*/} const ecCourseSupports=Loadable({ loader: () => import('./modules/ec/ecCourseSupports/ecCourseSupports'), loading: Loading, }) +//课程体系 const ecCourseEvaluations=Loadable({ loader: () => import('./modules/ec/ecCourseEvaluations/ecCourseEvaluations'), loading: Loading, @@ -141,11 +142,12 @@ const ecGradeEvaluations=Loadable({ loading: Loading, }) +{/*课程目标评价方法*/} const EvaluationMethods=Loadable({ loader: () => import('./modules/ec/ecCourseEvaluations/ecCourseEvaluationsbottom'), loading: Loading, }) - +{/*达成评价详情*/} const EcCompletionCalculation=Loadable({ loader: () => import('./modules/ec/ecCompletion_calculation/ecCompletion_calculation'), loading: Loading, @@ -190,18 +192,21 @@ class App extends Component { - + {/*课程体系对毕业要求的支撑*/} + {/*课程体系*/} - + {/*达成评价详情*/} + {/*课程目标评价方法*/} + @@ -262,7 +267,7 @@ class App extends Component { - + {/*达成评价详情*/} diff --git a/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js b/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js index 01506142..f76e065d 100644 --- a/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js +++ b/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js @@ -432,6 +432,7 @@ class EcCompletionCalculation extends Component {
    课程体系 > {schooldata.ec_course_name} 达成评价详情 {/* 导出培养目标 */} +
    系统根据课程目标、课程考核方式与课程目标评价方法,一键计算评价课程目标的达成情况 window.elasticLayer(3533)}>查看详情
    +
    课程体系 > {schooldata.ec_course_name} +
    请结合本课程的教学情况,修改考核方式、并导入学生的对应考核成绩 window.elasticLayer(3533)}>查看详情
    {/*课程考核方式与数据来源*/} {/* */} {/* 导出培养目标 */} diff --git a/public/react/src/modules/ec/ecCourseEvaluations/ecCourseEvaluationsbottom.js b/public/react/src/modules/ec/ecCourseEvaluations/ecCourseEvaluationsbottom.js index 4f04349f..ac80021d 100644 --- a/public/react/src/modules/ec/ecCourseEvaluations/ecCourseEvaluationsbottom.js +++ b/public/react/src/modules/ec/ecCourseEvaluations/ecCourseEvaluationsbottom.js @@ -703,6 +703,7 @@ class EcCourseEvaluationsbottom extends Component { {/*
    */} @@ -712,7 +713,9 @@ class EcCourseEvaluationsbottom extends Component {

    课程体系 > {schooldata.ec_course_name} - {/*课程考核方式与数据来源*/} +

    请结合本课程的教学情况,修改说明每个课程目标的评价环节和评估方式 window.elasticLayer(3533)}>查看详情
    + + {/*课程考核方式与数据来源*/} {/* */} {/* 导出培养目标 */} diff --git a/public/react/src/modules/ec/ecCourseSupportSetting/index.js b/public/react/src/modules/ec/ecCourseSupportSetting/index.js index ee18e430..82eec19e 100644 --- a/public/react/src/modules/ec/ecCourseSupportSetting/index.js +++ b/public/react/src/modules/ec/ecCourseSupportSetting/index.js @@ -245,6 +245,7 @@ class EcCourseSupportSetting extends Component {
    - 课程体系对毕业要求的支撑 + 课程体系对毕业要求的支撑 {/* 导出培养目标 */} 导出课程体系支撑矩阵 +
    用矩阵图的形式说明本专业课程体系对毕业要求的支撑关系 window.elasticLayer(3534)} >查看详情
    +
    毕业要求指标点({data.subitems_count} diff --git a/public/react/src/modules/ec/ecGradeEvaluations/ecGradeEvaluations.js b/public/react/src/modules/ec/ecGradeEvaluations/ecGradeEvaluations.js index c8598e94..6ae818d9 100644 --- a/public/react/src/modules/ec/ecGradeEvaluations/ecGradeEvaluations.js +++ b/public/react/src/modules/ec/ecGradeEvaluations/ecGradeEvaluations.js @@ -262,6 +262,7 @@ class ecGradeEvaluations extends Component {
    @@ -271,6 +272,7 @@ class ecGradeEvaluations extends Component {

    课程体系 > {schooldata.ec_course_name} + {/*课程考核方式与数据来源*/} {/* */} {/* 导出培养目标 */} diff --git a/public/react/src/modules/ec/ecStudentList/ecStudentList.js b/public/react/src/modules/ec/ecStudentList/ecStudentList.js index 63a56b43..911ee1c2 100644 --- a/public/react/src/modules/ec/ecStudentList/ecStudentList.js +++ b/public/react/src/modules/ec/ecStudentList/ecStudentList.js @@ -23,6 +23,7 @@ class ecStudentList extends Component { schooldata:{}, majorschoollist:undefined, titlemessage:"提示", + ecComponentState:"ecStudentList", visible:false, Modallist:'', Modallisttypes:0, @@ -318,8 +319,9 @@ class ecStudentList extends Component {

    学生列表 @@ -329,9 +331,11 @@ class ecStudentList extends Component {
    学生列表( + className=" font-18 courseSystem">学生列表( {majorschoollist===undefined?"":majorschoollist.total_student} - )
    + ) +
    提供模板支持导入学生信息(请先下载模板) window.elasticLayer(3533)}>查看详情
    +
    {ismanager===false?"": diff --git a/public/react/src/modules/ec/ecTitle/ecTitle.css b/public/react/src/modules/ec/ecTitle/ecTitle.css index 332e6142..c6e612bc 100644 --- a/public/react/src/modules/ec/ecTitle/ecTitle.css +++ b/public/react/src/modules/ec/ecTitle/ecTitle.css @@ -21,7 +21,7 @@ margin-right: 10px; } #traningNav>li>.ecTitles { - line-height: 18px !important; + line-height: 16px !important; } #traningNav>li>.ecTitlefont:hover{ diff --git a/public/react/src/modules/ec/ecTitle/ecTitle.js b/public/react/src/modules/ec/ecTitle/ecTitle.js index 0c6d4e7d..21aec303 100644 --- a/public/react/src/modules/ec/ecTitle/ecTitle.js +++ b/public/react/src/modules/ec/ecTitle/ecTitle.js @@ -21,6 +21,7 @@ class EcTitleCourseEvaluations extends Component { render() { let{schooldata,ecComponentState,ecpaths}=this.state; + return (
    @@ -49,16 +50,20 @@ class EcTitleCourseEvaluations extends Component { 4 毕业要求 vs 通用标准
  • +
  • + 5 + 学生 +
  • - 5 + 6 课程体系
  • - 6 + 7 课程体系 vs 毕业要求
  • - 7 + 8 达成度评价结果
  • {/*
  • */} diff --git a/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js b/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js index 00b72e1e..95545d85 100644 --- a/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js +++ b/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js @@ -599,16 +599,24 @@ class GraduatesRequirement extends Component {
  • +

    毕业要求指标点达成计算

    +

    + 系统根据课程体系与毕业要求的支持关系,以课程的考核与成绩判定方式,一键计算毕业要求的达成度情况 + window.elasticLayer(3530)} class="color-blue">查看详情 +

    + +
  • +

    diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 18438c02..86d852de 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -3089,17 +3089,17 @@ a.singlepublishtwo{ .MajorName > i:hover{color: #4CACFF} /*培养目标*/ #traningNav{margin-bottom: 0px!important;} -#traningNav>li{float: left;padding:0px 30px 30px 30px;font-size: 16px;} +#traningNav>li{float: left;padding:0px 30px 30px 30px;font-size: 15px;} #traningNav>li>a,#traningNav li>i{color: #666!important;position: relative} #traningNav>li.active > a,#traningNav li.active > i{color: #05101A!important;} #traningNav>li.active > a:after{content: '';position: absolute;width: 64px;left: 50%;margin-left: -32px;height: 2px;background-color: #05101A;bottom: -35px;} -#traningNav>li>.ecTitle {width: 20px;height: 20px;border: 1px solid rgba(65, 140, 205, 1);border-radius: 50%;text-align: center; -line-height: 20px;display: inline-block;color: rgba(65, 140, 205, 1) !important;margin-right: 8px;} +#traningNav>li>.ecTitle {width: 16px;height: 16px;border: 1px solid rgba(65, 140, 205, 1);border-radius: 50%;text-align: center; +line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;margin-right: 8px;font-size: 12px} #traningNav>li>.ecTitlefont:hover{color: rgba(65, 140, 205, 1) !important;} .ecimgs{height: 90px;line-height: 90px;box-sizing: border-box;} #traningNav>li>.ecTitlefontFFF{color:#fff!important;} -#traningNav>li>.ecTitleFFF {width: 20px;height: 20px;border: 1px solid #fff;border-radius: 50%;text-align: center;line-height: 20px; +#traningNav>li>.ecTitleFFF {width: 16px;height: 16px;border: 1px solid #fff;border-radius: 50%;text-align: center;line-height: 16px;font-size: 12px; display: inline-block;color: #fff !important;margin-right: 8px;} .traningNavs>li {padding: 0px 10px 30px 12px !important;} .ecimgs1{background: url("/images/educoder/auth/1.png");background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%; diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index d48700a3..266f9b7f 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -903,4 +903,13 @@ html>body #ajax-indicator { position: fixed; } margin-left: 20px; text-indent: 25px; min-height: 100px; +} + + +/*工程认证 各页面公用弹层*/ +.layerContent{ + margin: 0 auto; + padding-bottom: 235px; + min-width: 1200px; + padding-top: 60px; } \ No newline at end of file From b6953aa0388aa5e0b42e4d8dd1307c45b1eec4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 24 May 2019 15:06:23 +0800 Subject: [PATCH 15/17] 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 e102dde8..c17304a5 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 a339b3c4298582b4af3ea45a6e6eb65fde3c0df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 24 May 2019 15:14:36 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9c18050b..7909cb17 100644 --- a/Gemfile +++ b/Gemfile @@ -63,8 +63,8 @@ gem 'elasticsearch-rails' gem 'oauth2' # xlsx -# gem 'axlsx', '3.0.0.pre' -# gem 'axlsx_rails', '0.3.0' +gem 'axlsx', '3.0.0.pre' +gem 'axlsx_rails', '0.3.0' #Ruby 2.2+ has removed test/unit from the core library. if RUBY_VERSION>='2.2' From 98ce08d3c7de8fd44e1e64a5c8ac83dae90f0d9e Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 24 May 2019 15:26:13 +0800 Subject: [PATCH 17/17] =?UTF-8?q?ec=20=E5=BC=B9=E5=87=BA=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascripts/educoder/edu_application.js | 46 +++++++++++++++++-- public/react/public/index.html | 2 + .../GraduatesRequirement.js | 2 +- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/public/javascripts/educoder/edu_application.js b/public/javascripts/educoder/edu_application.js index 7cce4a21..f1caa2c5 100644 --- a/public/javascripts/educoder/edu_application.js +++ b/public/javascripts/educoder/edu_application.js @@ -1233,15 +1233,51 @@ $(document).bind('ajaxError', function(event, xhr, settings) { //工程认证各个页面的查看详情弹层 function elasticLayer(forumId){ + if (window.__memo) { + doElasticLayer(window.__memo, true) + return; + } + if (!forumId) return; + var url = 'https://www.educoder.net/api/v1/memos/' + forumId + $.ajax({ + url: url, + type: 'get', + success: function(res) { + console.log(res) + doElasticLayer(res.memo) + } + }); + + // document.body.addEventListener('touchmove',bodyScroll,false); + // $('body').css({'position':'fixed',"width":"100%"}); +} +function doElasticLayer(memo, rendered){ + if (rendered) { + $(".layerContent").show(); + $(".newMain").hide(); + return; + } + window.__memo = memo + var content = memo.content + var subject = memo.subject var html='
    ' + - '

    工程教育专业认证【培养目标】' + + '

    '+ subject +'' + '返回

    ' + - '
    ' + '
    ' + $(".newMain").after(html).hide(); - document.body.addEventListener('touchmove',bodyScroll,false); - $('body').css({'position':'fixed',"width":"100%"}); + + editormd.markdownToHTML("MDContent", { + htmlDecode: "style,script,iframe", // you can filter tags decode + taskList: true, + tex: true, // 默认不解析 + flowChart: true, // 默认不解析 + sequenceDiagram: true // 默认不解析 + }); } function removeElasticLayer(){ - $(".layerContent").remove(); + $(".layerContent").hide(); $(".newMain").show(); } diff --git a/public/react/public/index.html b/public/react/public/index.html index 71088e5f..e1f4976e 100644 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -107,7 +107,9 @@ + + diff --git a/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js b/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js index a62849f1..ba063757 100644 --- a/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js +++ b/public/react/src/modules/ec/graduatesRequirement/GraduatesRequirement.js @@ -611,7 +611,7 @@ class GraduatesRequirement extends Component {

    毕业要求指标点达成计算

    系统根据课程体系与毕业要求的支持关系,以课程的考核与成绩判定方式,一键计算毕业要求的达成度情况 - window.elasticLayer(3530)} class="color-blue">查看详情 + window.elasticLayer(3535)} class="color-blue">查看详情