Skip to content

Commit

Permalink
Fix the get_first() query to actually return only one message
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Bompard <[email protected]>
  • Loading branch information
abompard committed May 24, 2024
1 parent 03a6706 commit 6920969
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datanommer.models/datanommer/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def grep(
def get_first(cls, *, order="asc", **kwargs):
"""Get the first message matching the regular grep filters."""
query = cls.make_query(**kwargs)
query = query.order_by(getattr(Message.timestamp, order)())
query = query.order_by(getattr(Message.timestamp, order)()).limit(1)
return session.scalars(query).first()


Expand Down
1 change: 1 addition & 0 deletions datanommer.models/news/+get_first.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the `get_first()` query to actually return only one message

0 comments on commit 6920969

Please sign in to comment.