Skip to content

Commit 2d58717

Browse files
authored
Merge pull request #11270 from neinteractiveliterature/signup-round-csv-errors
Fix signup round exports; pre-emptively fix some errors that are going to happen tomorrow
2 parents d96574a + 4ccff52 commit 2d58717

5 files changed

Lines changed: 32 additions & 10 deletions

File tree

app/models/ranked_choice_decision.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class RankedChoiceDecision < ApplicationRecord
5151

5252
validates :decision, inclusion: { in: DECISIONS }
5353
validates :reason, inclusion: { in: REASONS, allow_nil: true }
54+
validates :signup_ranked_choice, presence: { unless: ->(record) { record.decision == "skip_user" } }
5455

5556
private
5657

app/presenters/tables/ranked_choice_decisions_table_results_presenter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def generate_csv_cell(decision)
3030
ilike_column_filter :title, association_name: :event
3131

3232
def generate_csv_cell(decision)
33-
decision.event.title
33+
decision.event&.title
3434
end
3535
end
3636

app/services/user_signup_constraints.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ def at_maximum_signups?
4141
def concurrent_signups_for_run(run)
4242
current_signups_including_not_counted.select do |signup|
4343
other_run = signup.run
44-
!other_run.event.can_play_concurrently? && run.overlaps?(other_run)
44+
other_run == run || (!other_run.event.can_play_concurrently? && run.overlaps?(other_run))
4545
end
4646
end
4747

4848
def concurrent_signup_requests_for_run(run)
4949
pending_signup_requests_including_not_counted.select do |signup_request|
5050
other_run = signup_request.target_run
51-
!other_run.event.can_play_concurrently? && run.overlaps?(other_run)
51+
other_run == run || (!other_run.event.can_play_concurrently? && run.overlaps?(other_run))
5252
end
5353
end
5454

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class MakeLotteryNumberIndexDeferrable < ActiveRecord::Migration[8.1]
2+
def up
3+
remove_index :user_con_profiles, %i[convention_id lottery_number], unique: true
4+
execute <<~SQL
5+
ALTER TABLE user_con_profiles
6+
ADD CONSTRAINT index_user_con_profiles_on_convention_id_and_lottery_number
7+
UNIQUE (convention_id, lottery_number)
8+
DEFERRABLE INITIALLY DEFERRED;
9+
SQL
10+
end
11+
12+
def down
13+
execute <<~SQL
14+
ALTER TABLE user_con_profiles
15+
DROP CONSTRAINT index_user_con_profiles_on_convention_id_and_lottery_number;
16+
SQL
17+
add_index :user_con_profiles, %i[convention_id lottery_number], unique: true
18+
end
19+
end

db/structure.sql

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3742,6 +3742,14 @@ ALTER TABLE ONLY public.forms
37423742
ADD CONSTRAINT forms_pkey PRIMARY KEY (id);
37433743

37443744

3745+
--
3746+
-- Name: user_con_profiles index_user_con_profiles_on_convention_id_and_lottery_number; Type: CONSTRAINT; Schema: public; Owner: -
3747+
--
3748+
3749+
ALTER TABLE ONLY public.user_con_profiles
3750+
ADD CONSTRAINT index_user_con_profiles_on_convention_id_and_lottery_number UNIQUE (convention_id, lottery_number) DEFERRABLE INITIALLY DEFERRED;
3751+
3752+
37453753
--
37463754
-- Name: maximum_event_provided_tickets_overrides maximum_event_provided_tickets_overrides_pkey; Type: CONSTRAINT; Schema: public; Owner: -
37473755
--
@@ -5117,13 +5125,6 @@ CREATE INDEX index_user_activity_alerts_on_convention_id ON public.user_activity
51175125
CREATE INDEX index_user_activity_alerts_on_user_id ON public.user_activity_alerts USING btree (user_id);
51185126

51195127

5120-
--
5121-
-- Name: index_user_con_profiles_on_convention_id_and_lottery_number; Type: INDEX; Schema: public; Owner: -
5122-
--
5123-
5124-
CREATE UNIQUE INDEX index_user_con_profiles_on_convention_id_and_lottery_number ON public.user_con_profiles USING btree (convention_id, lottery_number);
5125-
5126-
51275128
--
51285129
-- Name: index_user_con_profiles_on_convention_id_and_user_id; Type: INDEX; Schema: public; Owner: -
51295130
--
@@ -6140,6 +6141,7 @@ ALTER TABLE ONLY public.cms_files_pages
61406141
SET search_path TO "$user", public;
61416142

61426143
INSERT INTO "schema_migrations" (version) VALUES
6144+
('20260409003354'),
61436145
('20260321193050'),
61446146
('20260315200824'),
61456147
('20260315182359'),

0 commit comments

Comments
 (0)