Stat Polish (#1775)

* SeriesGroup tag can now have comma separated value to allow a series to be a part of multiple collections.

* Added a missing unit test

* Refactored how collection tags are created to work in the scan loop reliably.

* Added a unit test for RemoveTagsWithoutSeries

* Fixed a bug in reading list title generation to avoid Volume 0 if the underlying file had a title set. Fixed a misconfigured unit test.

* On User stats page, don't show the user selector on reading history, despite if youre an admin. Cleaned up how we show days with 0 reading events to be more clear.

* Refactored the name of a component to reflect what it does

* Removed plugin not using

* Fix an issue where coalescing a key in epub might have multiple html files ending with the key. In this case, let's take the first.

* Added PikaPods to the Readme

* Tried to fix layout shift for charts, but need Robbie's help

* Chart styling

# Added:
- Added: Added styling to force charts into their respective containers.

# Removed:
- Removed: Removed code blocking charts from being visible on mobile.

* Merge conflict

---------

Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo 2023-02-04 02:53:21 -08:00 committed by GitHub
parent c60fdcf6e0
commit cad897015c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 258 additions and 214 deletions

View file

@ -63,19 +63,6 @@ public class StatisticService : IStatisticService
.Where(p => libraryIds.Contains(p.LibraryId))
.SumAsync(p => p.PagesRead);
// var ids = await _context.AppUserProgresses
// .Where(p => p.AppUserId == userId)
// .Where(p => libraryIds.Contains(p.LibraryId))
// .Where(p => p.PagesRead > 0)
// .Select(p => new {p.ChapterId, p.SeriesId})
// .ToListAsync();
//var chapterIds = ids.Select(id => id.ChapterId);
// var timeSpentReading = await _context.Chapter
// .Where(c => chapterIds.Contains(c.Id))
// .SumAsync(c => c.AvgHoursToRead);
var timeSpentReading = await TimeSpentReadingForUsersAsync(new List<int>() {userId}, libraryIds);
var totalWordsRead = (long) Math.Round(await _context.AppUserProgresses
@ -364,12 +351,12 @@ public class StatisticService : IStatisticService
if (days > 0)
{
var date = DateTime.Now.AddDays(days * -1);
query = query.Where(x => x.appUserProgresses.LastModified >= date && x.appUserProgresses.Created >= date);
query = query.Where(x => x.appUserProgresses.LastModified >= date);
}
var results = await query.GroupBy(x => new
{
Day = x.appUserProgresses.Created.Date,
Day = x.appUserProgresses.LastModified.Date,
x.series.Format
})
.Select(g => new PagesReadOnADayCount<DateTime>
@ -389,7 +376,25 @@ public class StatisticService : IStatisticService
if (results.Any(d => d.Value == date)) continue;
results.Add(new PagesReadOnADayCount<DateTime>()
{
Format = MangaFormat.Unknown,
Format = MangaFormat.Archive,
Value = date,
Count = 0
});
results.Add(new PagesReadOnADayCount<DateTime>()
{
Format = MangaFormat.Epub,
Value = date,
Count = 0
});
results.Add(new PagesReadOnADayCount<DateTime>()
{
Format = MangaFormat.Pdf,
Value = date,
Count = 0
});
results.Add(new PagesReadOnADayCount<DateTime>()
{
Format = MangaFormat.Image,
Value = date,
Count = 0
});