Chapter/Issue level Reviews and Ratings (#3778)

Co-authored-by: Joseph Milazzo <josephmajora@gmail.com>
This commit is contained in:
Fesaa 2025-04-29 18:53:24 +02:00 committed by GitHub
parent 3b8997e46e
commit 4f7625ea77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 5097 additions and 497 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using API.Entities.Enums;
using API.Entities.Interfaces;
using API.Entities.Metadata;
using API.Entities.Person;
using API.Extensions;
using API.Services.Tasks.Scanner.Parser;
@ -125,6 +126,11 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate, IHasCoverImage
public string WebLinks { get; set; } = string.Empty;
public string ISBN { get; set; } = string.Empty;
/// <summary>
/// (Kavita+) Average rating from Kavita+ metadata
/// </summary>
public float AverageExternalRating { get; set; } = 0f;
#region Locks
public bool AgeRatingLocked { get; set; }
@ -160,6 +166,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate, IHasCoverImage
/// </summary>
public ICollection<Genre> Genres { get; set; } = new List<Genre>();
public ICollection<Tag> Tags { get; set; } = new List<Tag>();
public ICollection<AppUserChapterRating> Ratings { get; set; } = [];
public ICollection<AppUserProgress> UserProgress { get; set; }
@ -168,6 +175,9 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate, IHasCoverImage
public Volume Volume { get; set; } = null!;
public int VolumeId { get; set; }
public ICollection<ExternalReview> ExternalReviews { get; set; } = [];
public ICollection<ExternalRating> ExternalRatings { get; set; } = null!;
public void UpdateFrom(ParserInfo info)
{
Files ??= new List<MangaFile>();
@ -192,8 +202,6 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate, IHasCoverImage
/// <returns></returns>
public string GetNumberTitle()
{
// BUG: TODO: On non-english locales, for floats, the range will be 20,5 but the NumberTitle will return 20.5
// Have I fixed this with TryParse CultureInvariant
try
{
if (MinNumber.Is(MaxNumber))