Testing channel suggestions being ordered by video count.

This commit is contained in:
Roland 2024-04-16 15:48:09 -06:00
parent 4564a99771
commit 2c127a03f5
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
4 changed files with 11 additions and 8 deletions

View file

@ -212,9 +212,9 @@ async def search_channels_by_name(name: str, limit: int = 5, session: Session =
Channel.name.ilike(f'%{name}%'),
Channel.name.ilike(f'%{name_no_spaces}%'),
)) \
.join(Video, Video.channel_id == Channel.id) \
.outerjoin(Video, Video.channel_id == Channel.id) \
.group_by(Channel.id, Channel.name) \
.order_by(desc('video_count')) \
.order_by(desc('video_count'), asc(Channel.name)) \
.limit(limit)
channels = [i[0] for i in stmt]
else: