new: make activated profile always in top

This commit is contained in:
Hiddify
2024-01-31 10:02:02 +01:00
parent e13b4b269a
commit 3d3a190014

View File

@@ -76,7 +76,10 @@ class ProfileDao extends DatabaseAccessor<AppDatabase>
}) { }) {
return (profileEntries.select() return (profileEntries.select()
..orderBy( ..orderBy(
[ [(tbl) => OrderingTerm(
expression: tbl.active,
mode: OrderingMode.desc,
),
(tbl) { (tbl) {
final trafficRatio = (tbl.download + tbl.upload) / tbl.total; final trafficRatio = (tbl.download + tbl.upload) / tbl.total;
final isExpired = final isExpired =
@@ -90,8 +93,9 @@ class ProfileDao extends DatabaseAccessor<AppDatabase>
}, },
switch (sort) { switch (sort) {
ProfilesSort.name => (tbl) => OrderingTerm( ProfilesSort.name => (tbl) => OrderingTerm(
expression: tbl.name, expression: tbl.name,
mode: orderMap[sortMode]!, mode: orderMap[sortMode]!,
), ),
ProfilesSort.lastUpdate => (tbl) => OrderingTerm( ProfilesSort.lastUpdate => (tbl) => OrderingTerm(
expression: tbl.lastUpdate, expression: tbl.lastUpdate,