Skip to content

Commit

Permalink
fix common test
Browse files Browse the repository at this point in the history
  • Loading branch information
yu23ki14 committed Jan 27, 2025
1 parent e4fce05 commit 00e8cef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/birdxplorer_common/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,11 @@ def count_search_results(
post_like_count_from: Union[int, None] = None,
post_repost_count_from: Union[int, None] = None,
post_impression_count_from: Union[int, None] = None,
post_includes_media: bool = True,
post_includes_media: Union[bool, None] = None,
) -> int:
with Session(self.engine) as sess:
query = (
sess.query(NoteRecord)
sess.query(func.count(NoteRecord.note_id))
.outerjoin(PostRecord, NoteRecord.post_id == PostRecord.post_id)
.outerjoin(XUserRecord, PostRecord.user_id == XUserRecord.user_id)
)
Expand Down Expand Up @@ -668,10 +668,10 @@ def count_search_results(
query = query.filter(PostRecord.impression_count >= post_impression_count_from)
if post_includes_media:
query = query.filter(PostRecord.media_details.any())
if post_includes_media is False:
elif post_includes_media is False:
query = query.filter(~PostRecord.media_details.any())

return query.count()
return query.scalar() or 0


def gen_storage(settings: GlobalSettings) -> Storage:
Expand Down

0 comments on commit 00e8cef

Please sign in to comment.