Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Fixed a bug when updating rating for a series.

Joseph Milazzobdac9e696154
diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.cs
index 580ac29f1..408ad9b86 100644
--- a/API/Controllers/SeriesController.cs
+++ b/API/Controllers/SeriesController.cs
@@ -82,11 +82,14 @@ namespace API.Controllers
userRating.Rating = updateSeriesRatingDto.UserRating;
userRating.Review = updateSeriesRatingDto.UserReview;
userRating.SeriesId = updateSeriesRatingDto.SeriesId;
-
- _unitOfWork.UserRepository.AddRatingTracking(userRating);
- user.Ratings ??= new List<AppUserRating>();
- user.Ratings.Add(userRating);
-
+
+ if (userRating.Id == 0)
+ {
+ user.Ratings ??= new List<AppUserRating>();
+ user.Ratings.Add(userRating);
+ }
+
+ _unitOfWork.UserRepository.Update(user);
if (!await _unitOfWork.Complete()) return BadRequest("There was a critical error.");