Sort posts before selecting one by number
authorAlex Schroeder <alex@gnu.org>
Thu, 15 Aug 2019 09:52:39 +0000 (11:52 +0200)
committerAlex Schroeder <alex@gnu.org>
Thu, 15 Aug 2019 09:52:39 +0000 (11:52 +0200)
jan-pona-mute.py

index c24b126f223a54427c1852429a4d6deb14e51669..7b7e1151e4b88f3304cd3f0bd02dfb570f04a57e 100755 (executable)
@@ -318,7 +318,8 @@ post again."""
                     self.show(notification)
                     self.load(notification.about())
                 elif self.numbers_refer_to == 'home':
-                    self.post = self.home[n-1]
+                    posts = sorted(self.home, key=lambda x: x.data()["created_at"])
+                    self.post = posts[n-1]
                 else:
                     print("Internal error: not sure what numbers '%s' refer to." % self.numbers_refer_to)
                     return