From a6d88c6a6f0eea73c592c61a07457cc2124c93fe Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 13 Aug 2019 15:20:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E9=87=91=E8=AF=BE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 8 ++++++++ app/models/subject.rb | 2 +- app/views/managements/_subject_list.html.erb | 17 +++++++++++++++-- .../excellent_subject_setting.js.erb | 0 config/routes.rb | 1 + .../20190813070926_add_excellent_to_subject.rb | 5 +++++ 6 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 app/views/managements/excellent_subject_setting.js.erb create mode 100644 db/migrate/20190813070926_add_excellent_to_subject.rb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index d946c12b..cc896ef2 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2360,6 +2360,14 @@ end end end + # 实践课程的金课设置 + def excellent_subject_setting + if params[:subject_id] + subject = Subject.find params[:subject_id] + subject.update_attributes(:excellent => !subject.excellent) + end + end + # 已发布实训路径首页显示 def subject_homepage_show if params[:subject_id] diff --git a/app/models/subject.rb b/app/models/subject.rb index 819d446c..77db603a 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -10,7 +10,7 @@ class Subject < ActiveRecord::Base belongs_to :major # score_count 只能适合在首页使用 attr_accessible :description, :name, :status, :visits, :user_id, :course_list_id, :major_id, :learning_notes, :introduction, - :homepage_show, :score_count, :publish_time, :updated_at + :homepage_show, :score_count, :publish_time, :updated_at, :excellent has_many :stages, :dependent => :destroy, :order => "stages.position ASC" has_many :stage_shixuns, :dependent => :destroy diff --git a/app/views/managements/_subject_list.html.erb b/app/views/managements/_subject_list.html.erb index 40a3b0c4..3299af10 100644 --- a/app/views/managements/_subject_list.html.erb +++ b/app/views/managements/_subject_list.html.erb @@ -3,7 +3,7 @@ ID - 实训套件名称 + 实训套件名称 阶段 技术体系 等级体系 @@ -75,6 +75,10 @@ value="<%= c_shixun.id %>" <%= c_shixun.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="homepage_show_<%= c_shixun.id %>"> + + value="<%= c_shixun.id %>" <%= c_shixun.excellent ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="excellent_<%= c_shixun.id %>"> + + <% end %> @@ -131,7 +135,16 @@ type: 'post', dateType: "script" }); - }) + }); + $("input[name='excellent']").click(function(){ + var subject_id = $(this).val(); + $.ajax({ + url:"<%= excellent_subject_setting_managements_path %>", + data: {subject_id: subject_id}, + type: 'post', + dateType: "script" + }); + }); }); function select_repertoire(subject_id, rep_id){ $.ajax({ diff --git a/app/views/managements/excellent_subject_setting.js.erb b/app/views/managements/excellent_subject_setting.js.erb new file mode 100644 index 00000000..e69de29b diff --git a/config/routes.rb b/config/routes.rb index 2524e928..22ea0bc4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -626,6 +626,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 post 'update_shixun_code_hidden' get 'update_shixun_excute_time' post 'subject_homepage_show' + post 'excellent_subject_setting' post 'support_shixun' post 'add_course' match 'add_major',:via=>[:get,:post] diff --git a/db/migrate/20190813070926_add_excellent_to_subject.rb b/db/migrate/20190813070926_add_excellent_to_subject.rb new file mode 100644 index 00000000..6da01be3 --- /dev/null +++ b/db/migrate/20190813070926_add_excellent_to_subject.rb @@ -0,0 +1,5 @@ +class AddExcellentToSubject < ActiveRecord::Migration + def change + add_column :subjects, :excellent, :boolean, :default => false + end +end From 403c8332f8ba36e881210305375254b046b45563 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 14 Aug 2019 10:28:45 +0800 Subject: [PATCH 2/3] competition show page --- .../_gq_second_code_competition.html.erb | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index bc54e485..1af1cf52 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -73,6 +73,21 @@ link_url: 'https://keras.io/layers/about-keras-layers/' }] ] + extra_data = [ + { + name: 'C++项目', + description: "本项目的paddle/fluid/operators/optimizers目录中包含了常见的优化器(如,Momentum,Adam等等)的c++实现。", + task: '标注../fluid/operators/optimizers/目录下的所有代码文件', + link_name: '官方,优化器', + link_url: 'https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_guides/low_level/optimizer.html' + },{ + name: 'Python项目', + description: "本项目的python/paddle/fluid/layers/nn.py中包含了神经网络中大量常见层和操作符的python实现,如fc、conv、gru等等。", + task: '标注../paddle/fluid/layers/nn.py代码文件', + link_name: '官方,nn', + link_url: 'https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_cn/layers_cn/nn_cn.html' + } + ] %> <% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %> @@ -97,9 +112,9 @@ 标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>

-