diff --git a/app/controllers/competitions/competitions_controller.rb b/app/controllers/competitions/competitions_controller.rb index 009c3183f..2c3d00529 100644 --- a/app/controllers/competitions/competitions_controller.rb +++ b/app/controllers/competitions/competitions_controller.rb @@ -69,7 +69,7 @@ class Competitions::CompetitionsController < Competitions::BaseController end def update_md_content - tip_exception("标题和内容不能为空") if params[:name].blank? || params[:content].blank? + tip_exception("内容不能为空") if params[:content].blank? tip_exception("缺少competition_module_id") if params[:competition_module_id].blank? ActiveRecord::Base.transaction do com_module = current_competition.competition_modules.find_by!(id: params[:competition_module_id]) diff --git a/app/views/admins/competition_settings/index.html.erb b/app/views/admins/competition_settings/index.html.erb index c06dc0000..97784ef79 100644 --- a/app/views/admins/competition_settings/index.html.erb +++ b/app/views/admins/competition_settings/index.html.erb @@ -324,7 +324,7 @@
<% if @competition.competition_stages.count > 0 %> - <% @competition.competition_stages.each do |stage| %> + <% @competition.competition_stages.each_with_index do |stage, index| %> <%= form_tag(admins_competition_competition_stage_path(competition_id: @competition.id, id: stage.id), method: :put, class: 'stage_update_form flex-1', remote: true) do %>
@@ -345,42 +345,44 @@ 保存
-
-
- 第1阶段 -
-
- 有效时间: -
- -
- ~ -
- -
- 任务完成要求: -
- -
- / -
- -
- (总任务) - 成绩来源: -
- +
+ <% stage.competition_stage_sections.each_with_index do |section, j| %> +
+ 第<%= j + 1 %>阶段 +
+
+ 有效时间: +
+ <%= text_field_tag 'stage[][start_time]', section.start_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'section_start_time form-control', placeholder: '有效开始时间' %> +
+ ~ +
+ <%= text_field_tag 'stage[][end_time]', section.end_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'section_end_time form-control', placeholder: '有效结束时间' %> +
+ 任务完成要求: +
+ +
+ / +
+ +
+ (总任务) + 成绩来源: +
+ +
+
-
-
- + 删除 -
+
+ <% end %>
<% end %> diff --git a/db/migrate/20191023103633_add_column_to_stage_sections.rb b/db/migrate/20191023103633_add_column_to_stage_sections.rb deleted file mode 100644 index baa1754fa..000000000 --- a/db/migrate/20191023103633_add_column_to_stage_sections.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddColumnToStageSections < ActiveRecord::Migration[5.2] - def change - def change - add_column :competition_stage_sections, :mission_count, :integer, default: 0 - add_column :competition_stage_sections, :score_source, :integer, default: 0 - - add_column :competition_entries, :shixun_identifier, :string - end - end -end diff --git a/db/migrate/20191025012950_add_column_to_stage_sections.rb b/db/migrate/20191025012950_add_column_to_stage_sections.rb new file mode 100644 index 000000000..5eb96aea9 --- /dev/null +++ b/db/migrate/20191025012950_add_column_to_stage_sections.rb @@ -0,0 +1,8 @@ +class AddColumnToStageSections < ActiveRecord::Migration[5.2] + def change + add_column :competition_stage_sections, :mission_count, :integer, default: 0 + add_column :competition_stage_sections, :score_source, :integer, default: 0 + + add_column :competition_entries, :shixun_identifier, :string + end +end