From 7f4d8c032e4e6be8dc3b05b83256a02f68dbe98c Mon Sep 17 00:00:00 2001 From: DaniBitZesty <84323332+DaniBitZesty@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:07:38 +0100 Subject: [PATCH] .minmax should be called on arrays --- app/models/award_year.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/award_year.rb b/app/models/award_year.rb index 98c1a974b4..3b8ebf02bc 100644 --- a/app/models/award_year.rb +++ b/app/models/award_year.rb @@ -314,8 +314,8 @@ def start_trading_between(from = 0, to = 1, **opts) end_date = Date.new(AwardYear.current.year - 1 - from, month, day) if opts[:minmax] == true - return (start_date..end_date).minmax.map { |d| d.strftime("%d/%m/%Y") } if opts[:format] == true - (start_date..end_date).minmax + return [start_date, end_date].minmax.map { |d| d.strftime("%d/%m/%Y") } if opts[:format] == true + [start_date, end_date] else start_date..end_date end @@ -333,8 +333,8 @@ def fy_date_range_threshold(**opts) to = to.change(year: year) if opts[:minmax] == true - return (from..to).minmax.map { |d| d.strftime("%d/%m/%Y") } if opts[:format] == true - (from..to).minmax + return [from, to].minmax.map { |d| d.strftime("%d/%m/%Y") } if opts[:format] == true + [from, to] else from..to end