Skip to content

Commit

Permalink
use new reminders controller + remove old version
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Nov 19, 2024
1 parent 1aa044e commit 0b24f49
Show file tree
Hide file tree
Showing 27 changed files with 121 additions and 635 deletions.

This file was deleted.

This file was deleted.

9 changes: 7 additions & 2 deletions app/controllers/reminders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ class RemindersController < BasePublicController
def show
@form = form_from_slug

render view_file
if @form.set_reminder_from_claim
redirect_to independent_reminder_path(journey: journey::ROUTING_NAME, slug: "confirmation")
else
render view_file
end
end

def update
Expand Down Expand Up @@ -70,7 +74,8 @@ def form_from_slug
form_class_from_slug.new(
journey_session:,
journey:,
params:
params:,
session:
)
end
end

This file was deleted.

This file was deleted.

40 changes: 33 additions & 7 deletions app/forms/reminders/confirmation_form.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
module Reminders
class ConfirmationForm < Form
def reminder
@reminder ||= Reminder.find_by(
full_name: journey_session.answers.reminder_full_name,
email_address: journey_session.answers.reminder_email_address,
email_verified: true,
itt_academic_year: next_academic_year.to_s
)
@reminder ||= if submitted_claim
Reminder.find_by(
full_name: submitted_claim.full_name,
email_address: submitted_claim.email_address,
email_verified: true,
itt_subject: itt_subject_for_submitted_claim,
itt_academic_year: next_academic_year.to_s
)
else
Reminder.find_by(
full_name: journey_session.answers.reminder_full_name,
email_address: journey_session.answers.reminder_email_address,
email_verified: true,
itt_subject:,
itt_academic_year: next_academic_year.to_s
)
end
end

def set_reminder_from_claim
end

private

def itt_subject
journey_session.answers.eligible_itt_subject
end

def itt_subject_for_submitted_claim
submitted_claim.eligible_itt_subject
end

def submitted_claim
Claim.find_by(id: session["submitted_claim_id"])
end

def next_academic_year
AcademicYear.next
journey.configuration.current_academic_year + 1
end
end
end
Loading

0 comments on commit 0b24f49

Please sign in to comment.