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

Use new reminders controller + remove old version #3413

Merged
merged 2 commits into from
Nov 25, 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

This file was deleted.

This file was deleted.

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

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

def update
@form = form_from_slug

if @form.valid?
redirect_to independent_reminder_path(
redirect_to reminder_path(
journey: journey::ROUTING_NAME,
slug: navigator.next_slug
)
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