diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb
index 647be129..2f88d634 100644
--- a/app/controllers/trainings_controller.rb
+++ b/app/controllers/trainings_controller.rb
@@ -109,6 +109,7 @@ class TrainingsController < ApplicationController
@training.training_type = @training_type
if @training_type == 3
@training.research_field = params[:research_field].reject(&:blank?).uniq.join(",")
+ @training.training_category = params[:training_category]
end
@training.openid = session[:wechat_open_id]
@training.save!
@@ -298,9 +299,6 @@ class TrainingsController < ApplicationController
end
end
-
- private
-
def js_function_call
begin
yield if block_given?
diff --git a/app/models/training.rb b/app/models/training.rb
index a5794de2..7c1333be 100644
--- a/app/models/training.rb
+++ b/app/models/training.rb
@@ -21,4 +21,8 @@ class Training < ActiveRecord::Base
pay? && training_payinfo.payed?
end
+ def research_field_include?(str)
+ research_field.present? && research_field.split(',').include?(str)
+ end
+
end
diff --git a/app/views/trainings/enroll.html.erb b/app/views/trainings/enroll.html.erb
index e926ed75..3acb9c3f 100644
--- a/app/views/trainings/enroll.html.erb
+++ b/app/views/trainings/enroll.html.erb
@@ -164,21 +164,21 @@
大数据方向
-
+
人工智能方向
-
+
大数据+人工智能方向
-
+
@@ -187,49 +187,49 @@
机器学习/深度学习
- id="check_1" class="magic-checkbox">
+ id="check_1" class="magic-checkbox">
计算机结构与组成
- id="check_2" class="magic-checkbox">
+ id="check_2" class="magic-checkbox">
计算机系统
- id="check_3" class="magic-checkbox">
+ id="check_3" class="magic-checkbox">
计算机软件技术和应用
- id="check_4" class="magic-checkbox">
+ id="check_4" class="magic-checkbox">
计算机理论
- id="check_5" class="magic-checkbox">
+ id="check_5" class="magic-checkbox">
计算机应用与学科交叉
- id="check_6" class="magic-checkbox">
+ id="check_6" class="magic-checkbox">
其他
- id="check_7" class="magic-checkbox">
+ id="check_7" class="magic-checkbox">
diff --git a/db/migrate/20190613013623_add_reseach_field_to_trainings.rb b/db/migrate/20190613013623_add_reseach_field_to_trainings.rb
new file mode 100644
index 00000000..5354d13a
--- /dev/null
+++ b/db/migrate/20190613013623_add_reseach_field_to_trainings.rb
@@ -0,0 +1,5 @@
+class AddReseachFieldToTrainings < ActiveRecord::Migration
+ def change
+ add_column :trainings, :research_field, :string
+ end
+end
diff --git a/db/migrate/20190613063745_add_training_category_to_trainings.rb b/db/migrate/20190613063745_add_training_category_to_trainings.rb
new file mode 100644
index 00000000..f304a27d
--- /dev/null
+++ b/db/migrate/20190613063745_add_training_category_to_trainings.rb
@@ -0,0 +1,5 @@
+class AddTrainingCategoryToTrainings < ActiveRecord::Migration
+ def change
+ add_column :trainings, :training_category, :string
+ end
+end