Misc Fixes (#2155)
* Fixed default token key not being long enough and Kavita auto-generating * When scheduling nightly backup job, make it run at 2am to ensure everything else has ran. * Made the overlay system work better on mobile. In order to do this, had to implement my own copy button. * Tweaked the code to ensure we clear the selection doing anything and clicking off the overlay clears more reliably. * Cleaned up the overlay code * Added the ability to view the series that a rating is representing. Requires Kavita+ deployment. * When calculating overall average rating of server, if only review is yours, don't include it. When calculating overall average rating of server, scale to percentage (* 20) to match all other rating scales. * Fixed side nav on mobile without donate link not fully covering the height of the screen * Only trigger the task conversion warning on Media screen if you've touched the appropriate control. * Fixed a bug where bookmark directory wasn't able to be changed. * Fixed a bug where see More wouldn't show if there were just characters due to missing that check. * Fixed a typo in documentation * If a chapter has a range 1-6 and is fully read, when calculating highest chapter for Scrobbling, use the 6.
This commit is contained in:
parent
9e04276dfd
commit
52d19642f9
17 changed files with 121 additions and 52 deletions
|
|
@ -137,7 +137,7 @@ public interface ISeriesRepository
|
|||
Task<IList<SeriesMetadataDto>> GetSeriesMetadataForIds(IEnumerable<int> seriesIds);
|
||||
Task<IList<Series>> GetAllWithCoversInDifferentEncoding(EncodeFormat encodeFormat, bool customOnly = true);
|
||||
Task<SeriesDto?> GetSeriesDtoByNamesAndMetadataIdsForUser(int userId, IEnumerable<string> names, LibraryType libraryType, string aniListUrl, string malUrl);
|
||||
Task<int> GetAverageUserRating(int seriesId);
|
||||
Task<int> GetAverageUserRating(int seriesId, int userId);
|
||||
Task RemoveFromOnDeck(int seriesId, int userId);
|
||||
Task ClearOnDeckRemoval(int seriesId, int userId);
|
||||
}
|
||||
|
|
@ -1682,12 +1682,19 @@ public class SeriesRepository : ISeriesRepository
|
|||
/// Returns the Average rating for all users within Kavita instance
|
||||
/// </summary>
|
||||
/// <param name="seriesId"></param>
|
||||
public async Task<int> GetAverageUserRating(int seriesId)
|
||||
public async Task<int> GetAverageUserRating(int seriesId, int userId)
|
||||
{
|
||||
// If there is 0 or 1 rating and that rating is you, return 0 back
|
||||
var countOfRatingsThatAreUser = await _context.AppUserRating
|
||||
.Where(r => r.SeriesId == seriesId).CountAsync(u => u.AppUserId == userId);
|
||||
if (countOfRatingsThatAreUser == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var avg = (await _context.AppUserRating
|
||||
.Where(r => r.SeriesId == seriesId)
|
||||
.AverageAsync(r => (int?) r.Rating));
|
||||
return avg.HasValue ? (int) avg.Value : 0;
|
||||
return avg.HasValue ? (int) (avg.Value * 20) : 0;
|
||||
}
|
||||
|
||||
public async Task RemoveFromOnDeck(int seriesId, int userId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue