F: Fixed movie entry not showing up correctly in library page when adding a seen date to it while it is in watchlist.
This commit is contained in:
1 parent
0466082fe8
commit
b799e1cada
4 files changed
+76
-52
No files matched your search
+5
-5
@@ -146,7 +146,7 @@ export class AlternateEntryPageComponent implements OnInit {
|
||||
if (entryRatings) {
|
||||
// TODO show notification
|
||||
this.entry.entryRating = entryRatings;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
@@ -218,7 +218,7 @@ export class AlternateEntryPageComponent implements OnInit {
|
||||
// ? update the watchlist page
|
||||
if (this.entry.watchlist) {
|
||||
this.entry.watchlist = false;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
|
||||
// this.libraryService.refetchEntries().subscribe();
|
||||
}
|
||||
@@ -287,7 +287,7 @@ export class AlternateEntryPageComponent implements OnInit {
|
||||
// console.log(`Entry updated: `, entry);
|
||||
this.entry = entry;
|
||||
this.entry.isInLibrary = true;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(`Error updating entry: `, error);
|
||||
@@ -310,7 +310,7 @@ export class AlternateEntryPageComponent implements OnInit {
|
||||
// console.log(`Entry updated: `, entry);
|
||||
this.entry = entry;
|
||||
this.entry.isInLibrary = true;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(`Error updating entry: `, error);
|
||||
@@ -740,7 +740,7 @@ export class AlternateEntryPageComponent implements OnInit {
|
||||
this.entry.showInCalendar = result.entry.showInCalendar;
|
||||
this.entry.autoSync = result.entry.autoSync;
|
||||
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,16 +79,16 @@ export class EntryPageComponent implements OnInit {
|
||||
this.entry.collections = this.entry.collections.map((c) => {
|
||||
c.mediasCount = c.medias.length;
|
||||
c.selectedBackdrop = this.getCollectionBackdropPath(c);
|
||||
|
||||
c.medias = [];
|
||||
return c;
|
||||
});
|
||||
|
||||
if (this.entry.is_tvseries) {
|
||||
// ? sorting seasons
|
||||
// ! sorting seasons
|
||||
this.entry.seasons = this.entry.seasons.sort((a, b) => {
|
||||
if (b.season_number == 0) b.season_number = 30; // this will make the special season go last
|
||||
if (a.season_number == 0) a.season_number = 30; // this will make the special season go last
|
||||
// ? by changing the season number of 'special' season to 999
|
||||
// ? it will show up as the last season.
|
||||
if (b.season_number == 0) b.season_number = 999; // this will make the special season go last
|
||||
if (a.season_number == 0) a.season_number = 999; // this will make the special season go last
|
||||
|
||||
return a.season_number - b.season_number;
|
||||
});
|
||||
@@ -145,7 +145,7 @@ export class EntryPageComponent implements OnInit {
|
||||
if (entryRatings) {
|
||||
// TODO show notification
|
||||
this.entry.entryRating = entryRatings;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
@@ -179,6 +179,7 @@ export class EntryPageComponent implements OnInit {
|
||||
let watchDate = result.watchDate;
|
||||
let watchedWith = result.watchedWith.split('\n').join(', ');
|
||||
|
||||
// * Update
|
||||
if (entrySeen.id) {
|
||||
const es = {
|
||||
id: entrySeen.id,
|
||||
@@ -186,15 +187,25 @@ export class EntryPageComponent implements OnInit {
|
||||
seen_with: watchedWith,
|
||||
} as EntrySeen;
|
||||
|
||||
// * Update
|
||||
this.entrySeenService.updateEntrySeen(es).subscribe({
|
||||
next: (updatedEntrySeen) => {
|
||||
if (updatedEntrySeen) {
|
||||
// TODO show confirm notification
|
||||
// ? replace the entry-seen object with the updated one
|
||||
for (let i = 0; i < this.entry.entrySeen.length; i++) {
|
||||
if (this.entry.entrySeen[i].id == updatedEntrySeen.id)
|
||||
this.entry.entrySeen[i] = updatedEntrySeen;
|
||||
// TODO show confirm notification
|
||||
// ? replace the entry-seen object with the updated one
|
||||
for (let i = 0; i < this.entry.entrySeen.length; i++) {
|
||||
if (this.entry.entrySeen[i].id == updatedEntrySeen.id) {
|
||||
this.entry.entrySeen[i] = updatedEntrySeen;
|
||||
|
||||
// ? update enrty last_seen & first_seen dates
|
||||
if (this.entry.date_last_seen < entrySeen.date_seen) {
|
||||
this.entry.date_last_seen = entrySeen.date_seen;
|
||||
}
|
||||
|
||||
if (this.entry.date_first_seen > entrySeen.date_seen) {
|
||||
this.entry.date_first_seen = entrySeen.date_seen;
|
||||
}
|
||||
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -215,12 +226,25 @@ export class EntryPageComponent implements OnInit {
|
||||
// ? if the entry was in watch list creating and entry-seen would have removed it
|
||||
// ? from the watchlist, so now we need to refrech libraryService in order to
|
||||
// ? update the watchlist page
|
||||
if (this.entry.watchlist) {
|
||||
this.entry.watchlist = false;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.entry.isInLibrary = true;
|
||||
this.entry.watchlist = false;
|
||||
|
||||
// this.libraryService.refetchEntries().subscribe();
|
||||
// ? update enrty last_seen & first_seen dates
|
||||
if (
|
||||
!this.entry.date_last_seen ||
|
||||
this.entry.date_last_seen < entrySeen.date_seen
|
||||
) {
|
||||
this.entry.date_last_seen = entrySeen.date_seen;
|
||||
}
|
||||
|
||||
if (
|
||||
!this.entry.date_first_seen ||
|
||||
this.entry.date_first_seen > entrySeen.date_seen
|
||||
) {
|
||||
this.entry.date_first_seen = entrySeen.date_seen;
|
||||
}
|
||||
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
@@ -286,7 +310,7 @@ export class EntryPageComponent implements OnInit {
|
||||
// console.log(`Entry updated: `, entry);
|
||||
this.entry.favorit = entry.favorit;
|
||||
this.entry.isInLibrary = true;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(`Error updating entry: `, error);
|
||||
@@ -308,7 +332,7 @@ export class EntryPageComponent implements OnInit {
|
||||
next: (entry) => {
|
||||
this.entry.hidden = entry.hidden;
|
||||
this.entry.isInLibrary = true;
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(`Error updating entry: `, error);
|
||||
@@ -337,11 +361,10 @@ export class EntryPageComponent implements OnInit {
|
||||
this.entry.collections = result.collections.map((c) => {
|
||||
c.mediasCount = c.medias.length;
|
||||
c.selectedBackdrop = this.getCollectionBackdropPath(c);
|
||||
|
||||
c.medias = [];
|
||||
return c;
|
||||
});
|
||||
result.collections;
|
||||
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -738,7 +761,7 @@ export class EntryPageComponent implements OnInit {
|
||||
this.entry.showInCalendar = result.entry.showInCalendar;
|
||||
this.entry.autoSync = result.entry.autoSync;
|
||||
|
||||
this.libraryService.setEntry(this.entry);
|
||||
this.libraryService.updateEntry(this.entry);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user