Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend public result spreadsheet builder #496

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/spreadsheet/config_public.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ class ConfigPublic
attribute :judge_list, :boolean
attribute :orgcom_head, :boolean
attribute :orgcom_secretary, :boolean
attribute :appeal_head, :boolean
end
end
9 changes: 8 additions & 1 deletion app/services/spreadsheet/public.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Public < Spreadsheet::Base
SIGNATURE = '___________'.freeze

def initialize contest, config
super contest
super(contest)
@config = config
end

Expand Down Expand Up @@ -61,6 +61,7 @@ def build
add_judge_list_if_required sheet, judges, judges_style
add_orgcom_head_if_required sheet, judges_style
add_orgcom_secretary_if_required sheet, judges_style
add_appeal_head_if_required sheet, judges_style

# Set only after all data, otherwise will be ignored
sheet.column_widths(*column_widths)
Expand Down Expand Up @@ -113,5 +114,11 @@ def add_orgcom_secretary_if_required sheet, style_options

sheet.add_row ['', 'Секретар оргкомітету', SIGNATURE, @contest.secretary_of_organizing_committee], style: style_options
end

def add_appeal_head_if_required sheet, style_options
return unless @config.appeal_head

sheet.add_row ['', 'Голова апеляційної комісії', SIGNATURE, @contest.head_of_appeal_commission], style: style_options
end
end
end
9 changes: 9 additions & 0 deletions app/views/admin/spreadsheet_public.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@
</div>
</div>

<div class="control-group row mb-3">
<%= f.label :appeal_head, 'Голова апеляційної комісії', class: 'col-sm-2 col-form-label text-md-end' %>
<div class="col-sm-10">
<div class="col-form-label">
<%= f.check_box :appeal_head, class: 'form-check-input' %>
</div>
</div>
</div>

<div class="form-actions row justify-content-end my-3">
<div class="col-sm-10">
<%= f.button type: :submit, class: 'btn btn-primary' do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddHeadOfAppealCommissionToContests < ActiveRecord::Migration[7.0]
def change
add_column :contests, :head_of_appeal_commission, :string, null: false, default: ''
end
end
6 changes: 4 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ CREATE TABLE public.contests (
statistic_open boolean DEFAULT false NOT NULL,
main_judge character varying DEFAULT ''::character varying NOT NULL,
head_of_organizing_committee character varying DEFAULT ''::character varying NOT NULL,
secretary_of_organizing_committee character varying DEFAULT ''::character varying NOT NULL
secretary_of_organizing_committee character varying DEFAULT ''::character varying NOT NULL,
head_of_appeal_commission character varying DEFAULT ''::character varying NOT NULL
);


Expand Down Expand Up @@ -924,6 +925,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20230902145308'),
('20230902145309'),
('20230930203405'),
('20231110173126');
('20231110173126'),
('20240203172343');