From 5abd5065fa0a5ccc5a64522d63a8219dd355bd78 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 8 Aug 2019 13:31:43 +0200 Subject: [PATCH] [Store] Fix another query bug --- lib/src/Store.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index d3f8a06..66d2c73 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -340,7 +340,11 @@ class Store { /// Returns a list of events for the given room and sets all participants. Future> getEventList(Room room) async { List> eventRes = await db.rawQuery( - "SELECT * " + " FROM Events " + " WHERE room_id=?" + " GROUP BY id", + "SELECT * " + + " FROM Events " + + " WHERE room_id=?" + + " GROUP BY id " + + " ORDER BY origin_server_ts DESC", [room.id]); List eventList = []; @@ -362,8 +366,7 @@ class Store { " WHERE rooms.membership" + (onlyLeft ? "=" : "!=") + "'leave' " + - " GROUP BY rooms.id " + - " ORDER BY origin_server_ts DESC "); + " GROUP BY rooms.id "); List roomList = []; for (num i = 0; i < res.length; i++) { Room room = await Room.getRoomFromTableRow(res[i], client,