- 报名要求
+
+ 报名模式和要求:
-
- <%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %>
+
+ <%= radio_button_tag(:team_mode, 0, !@competition.team_mode, class: 'form-radio-input') %>
+
@@ -242,10 +243,8 @@
+ <%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %>
diff --git a/db/migrate/20191106093140_add_team_mode_to_competitions.rb b/db/migrate/20191106093140_add_team_mode_to_competitions.rb
new file mode 100644
index 000000000..c38fe4e05
--- /dev/null
+++ b/db/migrate/20191106093140_add_team_mode_to_competitions.rb
@@ -0,0 +1,6 @@
+class AddTeamModeToCompetitions < ActiveRecord::Migration[5.2]
+ def change
+ add_column :competitions, :team_mode, :boolean, default: 0
+ add_column :competition_staffs, :category_name, :string
+ end
+end
diff --git a/db/migrate/20191106093832_migrate_competition_team_mode.rb b/db/migrate/20191106093832_migrate_competition_team_mode.rb
new file mode 100644
index 000000000..860f13c35
--- /dev/null
+++ b/db/migrate/20191106093832_migrate_competition_team_mode.rb
@@ -0,0 +1,7 @@
+class MigrateCompetitionTeamMode < ActiveRecord::Migration[5.2]
+ def change
+ Competition.all.each do |competition|
+ competition.update_attributes!(team_mode: 1) unless (competition.competition_staffs.sum(:maximum).to_i == 1 || (competition.competition_staffs.nil? && competition.max_num == 1))
+ end
+ end
+end