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

Production < staging #3042

Merged
merged 2 commits into from
Aug 19, 2024
Merged
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
23 changes: 13 additions & 10 deletions app/form_pointers/latest_year_generator.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
module LatestYearGenerator
def calculate_last_year(form_answer, day, month)
# Conditional latest year
# If from 7th of September to December -> then previous year
# If from January to 6th of September -> then current year
#

@form_answer_award_year = form_answer.award_year.year if @form_answer_award_year.blank?

if form_answer.financial_year_changeable? || (month.to_i == 9 && day.to_i > 6) || month.to_i > 9
@form_answer_award_year - 2
if form_answer.document["most_recent_financial_year"]
@form_answer_award_year = form_answer.document["most_recent_financial_year"].to_i
else
@form_answer_award_year - 1
# Conditional latest year
# If from 7th of September to December -> then previous year
# If from January to 6th of September -> then current year
#
@form_answer_award_year = form_answer.award_year.year if @form_answer_award_year.blank?

if form_answer.financial_year_changeable? || (month.to_i == 9 && day.to_i > 6) || month.to_i > 9
@form_answer_award_year - 2
else
@form_answer_award_year - 1
end
end
end
end
Loading