非实训模式的竞赛,将排行榜的设置删除所有子阶段,还保留1个tab,保存报系统错误

dev_auth
cxt 5 years ago
parent 92c7f7836b
commit 2a20b82e26

@ -10,13 +10,15 @@ class Admins::CompetitionStageCreateService < ApplicationService
ActiveRecord::Base.transaction do
stage = CompetitionStage.create!(competition_id: competition.id, name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100).round(2))
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
unless params[:stage].blank?
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
end
end
end

@ -13,13 +13,15 @@ class Admins::CompetitionStageUpdateService < ApplicationService
stage.competition_stage_sections.destroy_all
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
unless params[:stage].blank?
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
end
end
end

@ -360,7 +360,7 @@
</div><span class=" mt-2">%</span>
<div class="flex-1">
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20 add-task-sub">新增子阶段</a>
<% if stage.max_end_time > Time.now %>
<% if stage.max_end_time && stage.max_end_time > Time.now %>
<%= agree_link '发送短信提醒', send_message_admins_competition_competition_stage_path(@competition, stage, element: ".send-message-#{stage.id}"),
class: 'btn btn-outline-primary ml20', 'data-confirm': '确认执行发送短信操作?' %>
<% end %>
@ -492,6 +492,7 @@
</div>
<% end %>
<% end %>
<div class="error my-2 danger text-danger"></div>
</div>
</div>
</div>

Loading…
Cancel
Save