ソースを参照

Show messages ordered ascending

Foppe Hemminga 6 年 前
コミット
2c48eb5482
1 ファイル変更9 行追加7 行削除
  1. 9 7
      model.py

+ 9 - 7
model.py

@@ -6,13 +6,15 @@ import re
 
 def get_events():
     """Simply retrieve events"""
-    query = """SELECT * FROM events 
-        WHERE timestamp BETWEEN now() - INTERVAL '24 HOURS' AND now()
-        AND (news LIKE '% sent an application to join the Faction.' 
-        OR news LIKE '% left the faction.' 
-        OR news LIKE '% has accepted %'
-        OR news LIKE '% has declined %')
-        ORDER BY timestamp DESC;"""
+    query = """SELECT * FROM
+        (SELECT * FROM events 
+            WHERE timestamp BETWEEN now() - INTERVAL '24 HOURS' AND now()
+            AND (news LIKE '% sent an application to join the Faction.' 
+            OR news LIKE '% left the faction.' 
+            OR news LIKE '% has accepted %'
+            OR news LIKE '% has declined %')
+            ORDER BY timestamp DESC) tmp
+        ORDER BY timestamp;"""
     return query