Allow broadcasts which have no created_at to be compared

This adds to the `__le__` method on the `BroadcastMessage` class to
allow two BroadcastMessages with no `updated_at` to be compared.
Previously, the method expected at least one message to have
`updated_at` set, but this is not necessarily the case.
This commit is contained in:
Katie Smith
2021-02-09 09:32:07 +00:00
parent 2bedcd79cc
commit c9234bcf72

View File

@@ -49,6 +49,8 @@ class BroadcastMessage(JSONModel):
return self.updated_at < other.created_at
if not self.updated_at and other.updated_at:
return self.created_at < other.updated_at
if not self.updated_at and not other.updated_at:
return self.created_at < other.created_at
return self.updated_at < other.updated_at
@classmethod