Per user personal ratings (#1820)
* Change personal ratings to be saved per user * Only copy ratings to users with existing progress records
This commit is contained in:
+1
-1
@@ -239,7 +239,7 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return [{id: status, name: getReadStatusName(status)}];
|
||||
}, 'id', 'name'),
|
||||
personalRating: this.getFilterStream((book: Book) => getRatingRangeFilters10(book.metadata?.personalRating!), 'id', 'name', 'sortIndex'),
|
||||
personalRating: this.getFilterStream((book: Book) => getRatingRangeFilters10(book.personalRating!), 'id', 'name', 'sortIndex'),
|
||||
publishedDate: this.getFilterStream(extractPublishedYearFilter, 'id', 'name'),
|
||||
matchScore: this.getFilterStream((book: Book) => getMatchScoreRangeFilters(book.metadataMatchScore), 'id', 'name', 'sortIndex'),
|
||||
mood: this.getFilterStream(
|
||||
|
||||
@@ -93,7 +93,7 @@ export class SideBarFilter implements BookFilter {
|
||||
case 'hardcoverRating':
|
||||
return filterValues.some(range => isRatingInRange(book.metadata?.hardcoverRating, range));
|
||||
case 'personalRating':
|
||||
return filterValues.some(range => isRatingInRange10(book.metadata?.personalRating, range));
|
||||
return filterValues.some(range => isRatingInRange10(book.personalRating, range));
|
||||
case 'publishedDate':
|
||||
const bookYear = book.metadata?.publishedDate
|
||||
? new Date(book.metadata.publishedDate).getFullYear()
|
||||
|
||||
@@ -10,6 +10,7 @@ export class BookSorter {
|
||||
{ label: 'Author', field: 'author', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Author + Series', field: 'authorSeries', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Last Read', field: 'lastReadTime', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Personal Rating', field: 'personalRating', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Added On', field: 'addedOn', direction: SortDirection.ASCENDING },
|
||||
{ label: 'File Size', field: 'fileSizeKb', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Locked', field: 'locked', direction: SortDirection.ASCENDING },
|
||||
|
||||
@@ -41,6 +41,7 @@ export interface Book extends FileInfo {
|
||||
koboProgress?: KoboProgress;
|
||||
seriesCount?: number | null;
|
||||
metadataMatchScore?: number | null;
|
||||
personalRating?: number | null;
|
||||
readStatus?: ReadStatus;
|
||||
dateFinished?: string;
|
||||
libraryPath?: { id: number };
|
||||
@@ -98,7 +99,6 @@ export interface BookMetadata {
|
||||
goodreadsReviewCount?: number | null;
|
||||
hardcoverRating?: number | null;
|
||||
hardcoverReviewCount?: number | null;
|
||||
personalRating?: number | null;
|
||||
coverUpdatedOn?: string;
|
||||
authors?: string[];
|
||||
categories?: string[];
|
||||
@@ -125,7 +125,6 @@ export interface BookMetadata {
|
||||
googleIdLocked?: boolean;
|
||||
pageCountLocked?: boolean;
|
||||
languageLocked?: boolean;
|
||||
personalRatingLocked?: boolean;
|
||||
amazonRatingLocked?: boolean;
|
||||
amazonReviewCountLocked?: boolean;
|
||||
goodreadsRatingLocked?: boolean;
|
||||
@@ -166,7 +165,6 @@ export interface MetadataClearFlags {
|
||||
goodreadsReviewCount?: boolean;
|
||||
hardcoverRating?: boolean;
|
||||
hardcoverReviewCount?: boolean;
|
||||
personalRating?: boolean;
|
||||
authors?: boolean;
|
||||
categories?: boolean;
|
||||
moods?: boolean;
|
||||
|
||||
@@ -531,6 +531,22 @@ export class BookService {
|
||||
);
|
||||
}
|
||||
|
||||
resetPersonalRating(bookIds: number | number[]): Observable<Book[]> {
|
||||
const ids = Array.isArray(bookIds) ? bookIds : [bookIds];
|
||||
return this.http.post<Book[]>(`${this.url}/reset-personal-rating`, ids).pipe(
|
||||
tap(updatedBooks => updatedBooks.forEach(book => this.handleBookUpdate(book)))
|
||||
);
|
||||
}
|
||||
|
||||
updatePersonalRating(bookIds: number | number[], rating: number): Observable<Book[]> {
|
||||
const ids = Array.isArray(bookIds) ? bookIds : [bookIds];
|
||||
return this.http.put<Book[]>(`${this.url}/personal-rating`, {ids, rating}).pipe(
|
||||
tap(updatedBooks => {
|
||||
updatedBooks.forEach(updatedBook => this.handleBookUpdate(updatedBook));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
consolidateMetadata(metadataType: 'authors' | 'categories' | 'moods' | 'tags' | 'series' | 'publishers' | 'languages', targetValues: string[], valuesToMerge: string[]): Observable<any> {
|
||||
const payload = {metadataType, targetValues, valuesToMerge};
|
||||
return this.http.post(`${this.url}/metadata/manage/consolidate`, payload).pipe(
|
||||
|
||||
@@ -79,7 +79,7 @@ export class SortService {
|
||||
publisher: (book) => book.metadata?.publisher || null,
|
||||
pageCount: (book) => book.metadata?.pageCount || null,
|
||||
rating: (book) => book.metadata?.rating || null,
|
||||
personalRating: (book) => book.metadata?.personalRating || null,
|
||||
personalRating: (book) => book.personalRating || null,
|
||||
reviewCount: (book) => book.metadata?.reviewCount || null,
|
||||
amazonRating: (book) => book.metadata?.amazonRating || null,
|
||||
amazonReviewCount: (book) => book.metadata?.amazonReviewCount || null,
|
||||
|
||||
Reference in New Issue
Block a user