From bb9fa56addc52eea96684c318018d8b895347f9c Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Mon, 16 Dec 2024 13:21:30 -0500 Subject: [PATCH] Fix date format validation error (#1551) * Fix date format validation error * Order trades, fix flaky test --- app/helpers/application_helper.rb | 2 +- app/models/account/holding_calculator.rb | 2 +- app/models/family.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8bf3cf28575..24c962df2b3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,7 +4,7 @@ module ApplicationHelper def date_format_options [ [ "DD-MM-YYYY", "%d-%m-%Y" ], - [ "DD.MM.YY", "%d.%m.%Y" ], + [ "DD.MM.YYYY", "%d.%m.%Y" ], [ "MM-DD-YYYY", "%m-%d-%Y" ], [ "YYYY-MM-DD", "%Y-%m-%d" ], [ "DD/MM/YYYY", "%d/%m/%Y" ], diff --git a/app/models/account/holding_calculator.rb b/app/models/account/holding_calculator.rb index b1f6fc2fc44..5f6673deb48 100644 --- a/app/models/account/holding_calculator.rb +++ b/app/models/account/holding_calculator.rb @@ -98,7 +98,7 @@ def gapfill_holdings(holdings) end def trades - @trades ||= account.entries.includes(entryable: :security).account_trades.to_a + @trades ||= account.entries.includes(entryable: :security).account_trades.chronological.to_a end def portfolio_start_date diff --git a/app/models/family.rb b/app/models/family.rb index bae32843561..69ac5eb7ca4 100644 --- a/app/models/family.rb +++ b/app/models/family.rb @@ -1,7 +1,7 @@ class Family < ApplicationRecord include Plaidable, Syncable - DATE_FORMATS = [ "%m-%d-%Y", "%d-%m-%Y", "%Y-%m-%d", "%d/%m/%Y", "%Y/%m/%d", "%m/%d/%Y", "%e/%m/%Y", "%Y.%m.%d" ] + DATE_FORMATS = [ "%m-%d-%Y", "%d.%m.%Y", "%d-%m-%Y", "%Y-%m-%d", "%d/%m/%Y", "%Y/%m/%d", "%m/%d/%Y", "%e/%m/%Y", "%Y.%m.%d" ] include Providable