1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-10 04:02:17 +00:00

Fix average ratings for peewee pre-3.15.4

This commit is contained in:
Alban Féron 2022-12-31 17:40:19 +01:00
parent e51abfe80f
commit f6b859d11f
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165

View File

@ -127,7 +127,7 @@ class Folder(PathMixin, _Model):
pass pass
avgRating = ( avgRating = (
RatingFolder.select(fn.avg(RatingFolder.rating)) RatingFolder.select(fn.avg(RatingFolder.rating, coerce=False))
.where(RatingFolder.rated == self) .where(RatingFolder.rated == self)
.scalar() .scalar()
) )
@ -343,7 +343,7 @@ class Track(PathMixin, _Model):
pass pass
avgRating = ( avgRating = (
RatingTrack.select(fn.avg(RatingTrack.rating)) RatingTrack.select(fn.avg(RatingTrack.rating, coerce=False))
.where(RatingTrack.rated == self) .where(RatingTrack.rated == self)
.scalar() .scalar()
) )