Skip to content

Commit 56e20c3

Browse files
authored
fix: order of recentEnvelopes is now deterministic (#791)
The recentEnvelopes are now sorted by number of occurences, date of the transactions and the creation time of the envelope to guarantee the order to be deterministic.
1 parent 5ae8a96 commit 56e20c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/models/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (a *Account) SetRecentEnvelopes(db *gorm.DB) error {
213213
Table("transactions").
214214
Select("envelopes.*, count(*) AS count").
215215
Joins("LEFT JOIN envelopes ON envelopes.id = transactions.envelope_id AND envelopes.deleted_at IS NULL").
216-
Order("count DESC, date(transactions.date) DESC").
216+
Order("count DESC, date(transactions.date) DESC, envelopes.created_at DESC").
217217
Where(&Transaction{
218218
TransactionCreate: TransactionCreate{
219219
DestinationAccountID: a.ID,

0 commit comments

Comments
 (0)