From dc3f6b6b229351d9a2d8ab21249a6081a7650824 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Wed, 15 Jan 2025 15:22:15 +0100 Subject: [PATCH] chore: Order expired transfers to the end of the list --- .../database/controllers/TransferController.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt index 5b4fea8a..2c7fdfff 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/controllers/TransferController.kt @@ -199,7 +199,11 @@ class TransferController(private val realmProvider: RealmProvider) { null -> TRUE_PREDICATE else -> "${TransferDB.transferDirectionPropertyName} == '${transferDirection}'" } - return realm.query(directionFilterQuery).sort(TransferDB::createdDateTimestamp.name, Sort.DESCENDING) + return realm + .query(directionFilterQuery) + .sort(TransferDB::createdDateTimestamp.name, Sort.DESCENDING) + .sort(TransferDB::expiredDateTimestamp.name, Sort.DESCENDING) + .sort(TransferDB::downloadCounterCredit.name, Sort.DESCENDING) } } }