mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: sort node list by lastHeard in database query
This commit is contained in:
parent
ff36b21298
commit
cb7ef639c0
2 changed files with 1 additions and 5 deletions
|
|
@ -25,7 +25,7 @@ interface NodeInfoDao {
|
|||
@Query("SELECT * FROM NodeInfo")
|
||||
fun getNodes(): Flow<List<NodeInfo>>
|
||||
|
||||
@Query("SELECT * FROM NodeInfo ORDER BY CASE WHEN num = (SELECT myNodeNum FROM MyNodeInfo LIMIT 1) THEN 0 ELSE 1 END, num ASC")
|
||||
@Query("SELECT * FROM NodeInfo ORDER BY CASE WHEN num = (SELECT myNodeNum FROM MyNodeInfo LIMIT 1) THEN 0 ELSE 1 END, lastHeard DESC")
|
||||
fun nodeDBbyNum(): Flow<Map<@MapColumn(columnName = "num") Int, NodeInfo>>
|
||||
|
||||
@Query("SELECT * FROM NodeInfo")
|
||||
|
|
|
|||
|
|
@ -222,10 +222,6 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
return
|
||||
}
|
||||
|
||||
if (nodesIn.size > 1) {
|
||||
nodesIn.sortWith(compareByDescending { it.lastHeard }, 1)
|
||||
}
|
||||
|
||||
val previousNodes = nodes
|
||||
|
||||
if (nodesIn.size < previousNodes.size) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue