Misc Stuff (#2917)
Co-authored-by: Robbie Davis <robbie@therobbiedavis.com> Co-authored-by: Fesaa <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
parent
3c9565468a
commit
315a6cca7e
9 changed files with 17 additions and 180 deletions
|
@ -1,6 +1,7 @@
|
|||
using System.Linq;
|
||||
using API.DTOs.Filtering;
|
||||
using API.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Extensions.QueryExtensions.Filtering;
|
||||
#nullable enable
|
||||
|
@ -39,6 +40,7 @@ public static class BookmarkSort
|
|||
SortField.ReadProgress => query.DoOrderBy(s => s.Series.Progress.Where(p => p.SeriesId == s.Series.Id).Select(p => p.LastModified).Max(), sortOptions),
|
||||
SortField.AverageRating => query.DoOrderBy(s => s.Series.ExternalSeriesMetadata.ExternalRatings
|
||||
.Where(p => p.SeriesId == s.Series.Id).Average(p => p.AverageScore), sortOptions),
|
||||
SortField.Random => query.DoOrderBy(s => EF.Functions.Random(), sortOptions),
|
||||
_ => query
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Linq;
|
||||
using API.DTOs.Filtering;
|
||||
using API.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Extensions.QueryExtensions.Filtering;
|
||||
#nullable enable
|
||||
|
@ -35,6 +36,7 @@ public static class SeriesSort
|
|||
.Max(), sortOptions),
|
||||
SortField.AverageRating => query.DoOrderBy(s => s.ExternalSeriesMetadata.ExternalRatings
|
||||
.Where(p => p.SeriesId == s.Id).Average(p => p.AverageScore), sortOptions),
|
||||
SortField.Random => query.DoOrderBy(s => EF.Functions.Random(), sortOptions),
|
||||
_ => query
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue