diff --git a/API/Services/BookService.cs b/API/Services/BookService.cs index e6cae0bd7..20fa4b261 100644 --- a/API/Services/BookService.cs +++ b/API/Services/BookService.cs @@ -731,7 +731,7 @@ public class BookService : IBookService if (mappings.ContainsKey(CleanContentKeys(key))) return key; // Fallback to searching for key (bad epub metadata) - var correctedKey = book.Content.Html.Keys.SingleOrDefault(s => s.EndsWith(key)); + var correctedKey = book.Content.Html.Keys.FirstOrDefault(s => s.EndsWith(key)); if (!string.IsNullOrEmpty(correctedKey)) { key = correctedKey; diff --git a/API/Services/StatisticService.cs b/API/Services/StatisticService.cs index e6ace9403..510652cb5 100644 --- a/API/Services/StatisticService.cs +++ b/API/Services/StatisticService.cs @@ -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() {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 @@ -389,7 +376,25 @@ public class StatisticService : IStatisticService if (results.Any(d => d.Value == date)) continue; results.Add(new PagesReadOnADayCount() { - Format = MangaFormat.Unknown, + Format = MangaFormat.Archive, + Value = date, + Count = 0 + }); + results.Add(new PagesReadOnADayCount() + { + Format = MangaFormat.Epub, + Value = date, + Count = 0 + }); + results.Add(new PagesReadOnADayCount() + { + Format = MangaFormat.Pdf, + Value = date, + Count = 0 + }); + results.Add(new PagesReadOnADayCount() + { + Format = MangaFormat.Image, Value = date, Count = 0 }); diff --git a/Kavita.Common/Configuration.cs b/Kavita.Common/Configuration.cs index 0302372d6..0d507559d 100644 --- a/Kavita.Common/Configuration.cs +++ b/Kavita.Common/Configuration.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Linq; using System.Text.Json; using Kavita.Common.EnvironmentInfo; using Microsoft.Extensions.Hosting; diff --git a/README.md b/README.md index acaaf9bcc..4f2883829 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,10 @@ We would like to extend a big thank you to [ -

Day Breakdown

- +
+
+

Day Breakdown

+
- - \ No newline at end of file + + +
\ No newline at end of file diff --git a/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.scss b/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.scss index eb069bb88..3612c7c82 100644 --- a/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.scss +++ b/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.scss @@ -1,3 +1,11 @@ ::ng-deep .dark .ngx-charts text { fill: #a0aabe; +} + +.dashboard-card-content { + width: 100%; + height: 242px; + display: flex; + flex-flow: column; + box-sizing: border-box; } \ No newline at end of file diff --git a/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.ts b/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.ts index 8146632a5..24cd0a583 100644 --- a/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.ts +++ b/UI/Web/src/app/statistics/_components/day-breakdown/day-breakdown.component.ts @@ -16,7 +16,7 @@ export class DayBreakdownComponent implements OnDestroy { private readonly onDestroy = new Subject(); - view: [number, number] = [700, 400]; + view: [number, number] = [0,0]; gradient: boolean = true; showLegend: boolean = true; showLabels: boolean = true; diff --git a/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.html b/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.html index 355da31d2..ee45b0319 100644 --- a/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.html +++ b/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.html @@ -1,71 +1,74 @@ -
-
-

Format - -

-
-
-
-
- - -
-
+
+
+
+

Format + +

+
+
+
+
+ + +
+
+
+ + Not Classified means Kavita has not scanned some files. This occurs on old files existing prior to v0.7. You may need to run a forced scan via Library settings modal. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Extension + + Format + + Total Size + + Total Files +
+ {{item.extension || 'Not Classified'}} + + {{item.format | mangaFormat}} + + {{item.totalSize | bytes}} + + {{item.totalFiles | number:'1.0-0'}} +
Total File Size:{{((rawData$ | async)?.totalFileSize || 0) | bytes}}
+
+
+ +
-Not Classified means Kavita has not scanned some files. This occurs on old files existing prior to v0.7. You may need to run a forced scan via Library settings modal. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Extension - - Format - - Total Size - - Total Files -
- {{item.extension || 'Not Classified'}} - - {{item.format | mangaFormat}} - - {{item.totalSize | bytes}} - - {{item.totalFiles | number:'1.0-0'}} -
Total File Size:{{((rawData$ | async)?.totalFileSize || 0) | bytes}}
-
-
- - diff --git a/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.scss b/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.scss index a77c2a308..dc37ca9e7 100644 --- a/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.scss +++ b/UI/Web/src/app/statistics/_components/file-breakdown-stats/file-breakdown-stats.component.scss @@ -1,4 +1,12 @@ ::ng-deep .advanced-pie-legend { top: unset !important; transform: unset !important; +} + +.dashboard-card-content { + width: 100%; + height: 242px; + display: flex; + flex-flow: column; + box-sizing: border-box; } \ No newline at end of file diff --git a/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.html b/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.html index accf312f4..6c1b125a6 100644 --- a/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.html +++ b/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.html @@ -1,51 +1,54 @@ -
-
-

Publication Status -

-
-
-
-
- - -
-
+
+ +
+
+

Publication Status +

+
+
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Year + + Count +
+ {{item.name}} + + {{item.value | number:'1.0-0'}} +
+
+
- - - - - - - - - - - - - - - - - - - -
- Year - - Count -
- {{item.name}} - - {{item.value | number:'1.0-0'}} -
-
-
- - diff --git a/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.scss b/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.scss index 80c3bef2f..4237557be 100644 --- a/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.scss +++ b/UI/Web/src/app/statistics/_components/publication-status-stats/publication-status-stats.component.scss @@ -1,3 +1,11 @@ ::ng-deep .pie-label { color: var(--body-text-color) !important; +} + +.dashboard-card-content { + width: 100%; + height: 242px; + display: flex; + flex-flow: column; + box-sizing: border-box; } \ No newline at end of file diff --git a/UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.html b/UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.html deleted file mode 100644 index 7534b3a9d..000000000 --- a/UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.html +++ /dev/null @@ -1,52 +0,0 @@ - -
-
-

Top Readers

-
-
-
-
- - -
-
- - -
-
-
-
-
- - - - -
- - No Reading progress - -
\ No newline at end of file diff --git a/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html new file mode 100644 index 000000000..aef4f5868 --- /dev/null +++ b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html @@ -0,0 +1,54 @@ + +
+
+
+

Top Readers

+
+
+
+
+ + +
+
+ + +
+
+
+
+
+ + + + +
+ + No Reading progress + +
+
\ No newline at end of file diff --git a/UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.scss b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.scss similarity index 100% rename from UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.scss rename to UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.scss diff --git a/UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.ts b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.ts similarity index 91% rename from UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.ts rename to UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.ts index 9bfcfc2a6..47cae059a 100644 --- a/UI/Web/src/app/statistics/_components/read-by-day-and/read-by-day-and.component.ts +++ b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.ts @@ -12,17 +12,18 @@ const options: Intl.DateTimeFormatOptions = { month: "short", day: "numeric" }; const mangaFormatPipe = new MangaFormatPipe(); @Component({ - selector: 'app-read-by-day-and', - templateUrl: './read-by-day-and.component.html', - styleUrls: ['./read-by-day-and.component.scss'], + selector: 'app-reading-activity', + templateUrl: './reading-activity.component.html', + styleUrls: ['./reading-activity.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class ReadByDayAndComponent implements OnInit, OnDestroy { +export class ReadingActivityComponent implements OnInit, OnDestroy { /** * Only show for one user */ @Input() userId: number = 0; @Input() isAdmin: boolean = true; + @Input() individualUserMode: boolean = false; view: [number, number] = [0, 400]; formGroup: FormGroup = new FormGroup({ diff --git a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html index ca28fc7a6..c10ab1a5b 100644 --- a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html +++ b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html @@ -92,26 +92,26 @@
-
+
-
-
+
+
-
+
-
+
- +
-
+
diff --git a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.scss b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.scss index c59742f5a..f98cc003d 100644 --- a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.scss +++ b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.scss @@ -7,4 +7,5 @@ overflow-y: auto; overflow-x: hidden; align-items: start; -} \ No newline at end of file +} + diff --git a/UI/Web/src/app/statistics/_components/user-stats/user-stats.component.html b/UI/Web/src/app/statistics/_components/user-stats/user-stats.component.html index b7ac6291c..96b8ef0c8 100644 --- a/UI/Web/src/app/statistics/_components/user-stats/user-stats.component.html +++ b/UI/Web/src/app/statistics/_components/user-stats/user-stats.component.html @@ -9,7 +9,7 @@
- +
diff --git a/UI/Web/src/app/statistics/statistics.module.ts b/UI/Web/src/app/statistics/statistics.module.ts index 54a7ea380..04ecbea08 100644 --- a/UI/Web/src/app/statistics/statistics.module.ts +++ b/UI/Web/src/app/statistics/statistics.module.ts @@ -14,7 +14,7 @@ import { MangaFormatStatsComponent } from './_components/manga-format-stats/mang import { FileBreakdownStatsComponent } from './_components/file-breakdown-stats/file-breakdown-stats.component'; import { PipeModule } from '../pipe/pipe.module'; import { TopReadersComponent } from './_components/top-readers/top-readers.component'; -import { ReadByDayAndComponent } from './_components/read-by-day-and/read-by-day-and.component'; +import { ReadingActivityComponent } from './_components/reading-activity/reading-activity.component'; import { GenericListModalComponent } from './_components/_modals/generic-list-modal/generic-list-modal.component'; import { DayBreakdownComponent } from './_components/day-breakdown/day-breakdown.component'; import { DayOfWeekPipe } from './_pipes/day-of-week.pipe'; @@ -31,7 +31,7 @@ import { DayOfWeekPipe } from './_pipes/day-of-week.pipe'; MangaFormatStatsComponent, FileBreakdownStatsComponent, TopReadersComponent, - ReadByDayAndComponent, + ReadingActivityComponent, GenericListModalComponent, DayBreakdownComponent, DayOfWeekPipe