Skip to content

Commit

Permalink
eald, cabins removal cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
beingmattlevy committed Jul 28, 2024
1 parent 852c3ca commit 8126454
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 234 deletions.
17 changes: 0 additions & 17 deletions app/helpers/ticket_requests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,6 @@ def text_for_status(ticket_request)
end
end

def eald_requested?(ticket_request)
ticket_request.early_arrival_passes.positive? ||
ticket_request.late_departure_passes.positive?
end

# Not perfect, but looks up the email address associated with the request and
# checks if enough EA/LD passes have been purchased with that email address to
# meet or exceed the originally requested amount in the request.
def eald_paid?(ticket_request)
eald_payments = EaldPayment.where(event: ticket_request.event,
email: ticket_request.user.email).to_a
ea_passes = eald_payments.sum(&:early_arrival_passes)
ld_passes = eald_payments.sum(&:late_departure_passes)
ea_passes >= ticket_request.early_arrival_passes &&
ld_passes >= ticket_request.late_departure_passes
end

def price_rules_to_json(event)
event.price_rules.to_h do |price_rule|
[price_rule.trigger_value, price_rule.price.to_i]
Expand Down
22 changes: 11 additions & 11 deletions app/mailers/ticket_request_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ def request_approved(ticket_request)

@payment_url = new_event_ticket_request_payment_url(@event, @ticket_request, @auth_token)

# XXX Clean me up and make Event Addons / Ticket Request
if @event.eald?
@extra_params = {}.tap do |params|
params[:early_arrival_passes] = @ticket_request.early_arrival_passes
params[:late_departure_passes] = @ticket_request.late_departure_passes
params[:email] = @ticket_request.user.email
params[:name] = @ticket_request.user.name
end

@eald_url = new_event_eald_payment_path(@event, @extra_params)
end
# XXX Clean me up and make Event Addons / Ticket Request
# if @event.eald?
# @extra_params = {}.tap do |params|
# params[:early_arrival_passes] = @ticket_request.early_arrival_passes
# params[:late_departure_passes] = @ticket_request.late_departure_passes
# params[:email] = @ticket_request.user.email
# params[:name] = @ticket_request.user.name
# end
#
# @eald_url = new_event_eald_payment_path(@event, @extra_params)
# end

# Return if the authentication token is blank
return if @auth_token.blank?
Expand Down
9 changes: 0 additions & 9 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
# adult_ticket_price :decimal(8, 2)
# allow_donations :boolean default(FALSE), not null
# allow_financial_assistance :boolean default(FALSE), not null
# cabin_price :decimal(8, 2)
# early_arrival_price :decimal(8, 2) default(0.0)
# end_time :datetime
# kid_ticket_price :decimal(8, 2)
# late_departure_price :decimal(8, 2) default(0.0)
# max_adult_tickets_per_request :integer
# max_cabin_requests :integer
# max_cabins_per_request :integer
# max_kid_tickets_per_request :integer
# name :string
# photo :string
Expand Down Expand Up @@ -180,10 +175,6 @@ def ticket_requests_open?
false
end

def eald?
early_arrival_price.positive? || late_departure_price.positive?
end

def to_param
return nil unless persisted?

Expand Down
14 changes: 0 additions & 14 deletions app/views/payment_mailer/payment_received.html.haml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
= render partial: "payments/payment", locals: { payment: @payment }

- if @event.eald?
%p
%b Planning to arrive early or leave late?
%br
:ruby
extra_params = {}
extra_params[:early_arrival_passes] = @ticket_request.early_arrival_passes
extra_params[:late_departure_passes] = @ticket_request.late_departure_passes
extra_params[:email] = @ticket_request.user.email
extra_params[:name] = @ticket_request.user.name
= link_to 'Early Arrival / Late Departure Passes',
new_event_eald_payment_url(@event, extra_params)
must be purchased separately!

%p
Got ticket questions or think something is wrong with your order? We are still
here for you, drop us a line at
Expand Down
15 changes: 0 additions & 15 deletions app/views/payments/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
= render partial: "payment", locals: { payment: @payment }

- if @event.eald?
%p
%b Planning to arrive early or leave late?
%br
:ruby
extra_params = {}
extra_params[:early_arrival_passes] = @ticket_request.early_arrival_passes
extra_params[:late_departure_passes] = @ticket_request.late_departure_passes
extra_params[:email] = @ticket_request.user.email
extra_params[:name] = @ticket_request.user.name
= link_to 'Early Arrival / Late Departure Passes',
new_event_eald_payment_path(@event, extra_params),
target: '_blank'
must be purchased separately!

%p
You can
= link_to 'review your ticket information',
Expand Down
38 changes: 0 additions & 38 deletions app/views/shared/_nav_event.html.haml
Original file line number Diff line number Diff line change
@@ -1,39 +1 @@
-# - active_tab ||= {}
-#
-# -# TODO: when we allow uploading images for the events, we can show it.
-# -# = image_tag image_path('logos/fnf-transparent.png'), class: 'float-end event-preview'
-# .card.event-nav
-# .card-header.bg-dark-subtle
-# .card-img-top
-# %h3.d-inline-block.align-baseline
-# = event.name
-# %h5.d-inline-block.px-xl-5.px-lg-3.p-md-0.p-sm-0.m-0
-# = event.starting
-#
-# .card-body.event-nav
-# .btn-group
-# - if current_user.site_admin? || current_user.manages_event?(event)
-# = link_to event_path(event), class: "btn #{active_tab[:event_show]}" do
-# - if active_tab[:event_show] != "active"
-# %i.icon-arrow-left ←
-# = event.name
-# - else
-# = event.name
-# = link_to edit_event_path(event), class: "btn #{active_tab[:event_edit]}" do
-# Edit Event
-# %i.icon-edit
-#
-#
-# = link_to event_ticket_requests_path(event), class: "btn #{active_tab[:ticket_requests]}" do
-# Ticket Requests
-# %i.icon-inbox
-# = link_to event_eald_payments_path(event), class: "btn #{active_tab[:eald_passes]}" do
-# EA/LD Passes
-# %i.icon-inbox
-# = link_to guest_list_event_path(event), class: "btn #{active_tab[:guest_list]}" do
-# Guest List
-# %i.icon-th-list
-#
-# .vertical-20
= render partial: 'shared/nav_event_tabs', locals: { active_tab: active_tab, event: event }
8 changes: 0 additions & 8 deletions app/views/ticket_request_mailer/request_approved.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
purchase your
= 'ticket'.pluralize(@ticket_request.total_tickets)

-# XXX will re-enable once EALD has been added back
-# - if @event.eald?
-# %p
-# %b Planning to arrive early or leave late?
-# %br
-# = link_to 'Early Arrival / Late Departure Passes', @eald_url
-# must be purchased separately!
%p
Thanks,
%br
Expand Down
22 changes: 11 additions & 11 deletions app/views/ticket_requests/_table_ticket_requests.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@
- if event.active_event_addons?
%td.align-content-center.text-end.optional-medium= ticket_request.active_ticket_request_event_addons_count
- if event.eald?
%td.align-content-center.text-end.optional-medium
#{ticket_request.early_arrival_passes} / #{ticket_request.late_departure_passes}
-# %br
-# - if eald_requested?(ticket_request)
-# - if eald_paid?(ticket_request)
-# ✔︎ EALD Paid
-# - else
-# ✘ Not All EALD Bought
-# - else
-# ✘ Not Requested
-# - if event.eald?
-# %td.align-content-center.text-end.optional-medium
-# #{ticket_request.early_arrival_passes} / #{ticket_request.late_departure_passes}
-# -# %br
-# -# - if eald_requested?(ticket_request)
-# -# - if eald_paid?(ticket_request)
-# -# ✔︎ EALD Paid
-# -# - else
-# -# ✘ Not All EALD Bought
-# -# - else
-# -# ✘ Not Requested
%td.align-content-center.text-end
%span{ class: ('label label-info' if ticket_request.special_price) }
= number_to_currency(ticket_request.price, precision: 0)
Expand Down
20 changes: 0 additions & 20 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@

devise_for :users

# WTF was this for? --@kig
#
# event_id = 9
#
# get('fnf-tickets', controller: :ticket_requests, action: :new, event_id:)
# get('fnf_tickets', controller: :ticket_requests, action: :new, event_id:)
# get('fnftickets', controller: :ticket_requests, action: :new, event_id:)
# get('fnf', controller: :ticket_requests, action: :new, event_id:)
# get('FNF', controller: :ticket_requests, action: :new, event_id:)
# get('FnF', controller: :ticket_requests, action: :new, event_id:)
#
# get('eald', controller: :eald_payments, action: :new, event_id:)

resources :emails, only: :index

resources :events do
Expand Down Expand Up @@ -73,13 +60,6 @@
end
end
end

resources :eald_payments, only: %i[index new create] do
collection do
get :complete
get :download
end
end
end

resources :passwords, only: [] do
Expand Down
65 changes: 1 addition & 64 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,6 @@ CREATE TABLE public.ar_internal_metadata (
);


--
-- Name: eald_payments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.eald_payments (
id bigint NOT NULL,
event_id bigint,
stripe_charge_id character varying NOT NULL,
amount_charged_cents integer NOT NULL,
name character varying(255) NOT NULL,
email character varying(255) NOT NULL,
early_arrival_passes integer DEFAULT 0 NOT NULL,
late_departure_passes integer DEFAULT 0 NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);


--
-- Name: eald_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.eald_payments_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: eald_payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.eald_payments_id_seq OWNED BY public.eald_payments.id;


--
-- Name: event_addons; Type: TABLE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -173,11 +136,8 @@ CREATE TABLE public.events (
updated_at timestamp(6) without time zone NOT NULL,
adult_ticket_price numeric(8,2),
kid_ticket_price numeric(8,2),
cabin_price numeric(8,2),
max_adult_tickets_per_request integer,
max_kid_tickets_per_request integer,
max_cabins_per_request integer,
max_cabin_requests integer,
photo character varying,
tickets_require_approval boolean DEFAULT true NOT NULL,
require_mailing_address boolean DEFAULT false NOT NULL,
Expand All @@ -186,8 +146,6 @@ CREATE TABLE public.events (
ticket_sales_start_time timestamp without time zone,
ticket_sales_end_time timestamp without time zone,
ticket_requests_end_time timestamp without time zone,
early_arrival_price numeric(8,2) DEFAULT 0.0,
late_departure_price numeric(8,2) DEFAULT 0.0,
slug text,
require_role boolean DEFAULT true NOT NULL
);
Expand Down Expand Up @@ -570,13 +528,6 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
ALTER TABLE ONLY public.addons ALTER COLUMN id SET DEFAULT nextval('public.addons_id_seq'::regclass);


--
-- Name: eald_payments id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.eald_payments ALTER COLUMN id SET DEFAULT nextval('public.eald_payments_id_seq'::regclass);


--
-- Name: event_addons id; Type: DEFAULT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -677,14 +628,6 @@ ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);


--
-- Name: eald_payments eald_payments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.eald_payments
ADD CONSTRAINT eald_payments_pkey PRIMARY KEY (id);


--
-- Name: event_addons event_addons_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -789,13 +732,6 @@ ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: index_eald_payments_on_event_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_eald_payments_on_event_id ON public.eald_payments USING btree (event_id);


--
-- Name: index_event_addons_on_addon_id; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -954,6 +890,7 @@ ALTER TABLE ONLY public.ticket_request_event_addons
SET search_path TO "$user", public;

INSERT INTO "schema_migrations" (version) VALUES
('20240728211432'),
('20240718224717'),
('20240710231611'),
('20240523173316'),
Expand Down
5 changes: 0 additions & 5 deletions spec/models/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@
it { is_expected.not_to accept_values_for(:kid_ticket_price, -1) }
end

describe '#cabin_price' do
it { is_expected.to accept_values_for(:cabin_price, nil, '', 0, 50) }
it { is_expected.not_to accept_values_for(:cabin_price, -1) }
end

describe '#max_adult_tickets_per_request' do
it { is_expected.to accept_values_for(:max_adult_tickets_per_request, nil, '', 50) }
it { is_expected.not_to accept_values_for(:max_adult_tickets_per_request, 0, -1) }
Expand Down
22 changes: 0 additions & 22 deletions spec/models/ticket_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,6 @@
end
end

describe '#cabins' do
let(:ticket_request) { build(:ticket_request, cabins:) }

context 'when not present' do
let(:cabins) { nil }

it { is_expected.to be_valid }
end

context 'when not a number' do
let(:cabins) { 'not a number' }

it { is_expected.not_to be_valid }
end

context 'when a number' do
let(:cabins) { 2 }

it { is_expected.to be_valid }
end
end

describe '#notes' do
let(:ticket_request) { build(:ticket_request, notes:) }

Expand Down

0 comments on commit 8126454

Please sign in to comment.