Skip to content

Commit

Permalink
Merge pull request #3042 from bitzesty/staging
Browse files Browse the repository at this point in the history
Production < staging
  • Loading branch information
TheDancingClown authored Aug 19, 2024
2 parents 28da16f + d454eb8 commit e43ceff
Showing 1 changed file with 13 additions and 10 deletions.
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

0 comments on commit e43ceff

Please sign in to comment.