Skip to content

Commit

Permalink
fix: refactor the condition
Browse files Browse the repository at this point in the history
  • Loading branch information
kiremitrov123 committed Mar 6, 2023
1 parent 88946a4 commit d69bfed
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/services/inplayer.account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,10 @@ export const updatePersonalShelves: UpdatePersonalShelves = async (payload) => {

try {
history.forEach(async (history) => {
if (externalData?.history?.length) {
externalData?.history?.forEach(async (historyStore) => {
if (historyStore.mediaid === history.mediaid && historyStore.progress !== history.progress) {
await InPlayer.Account.updateWatchHistory(history.mediaid, history.progress);
}
});
}
if (!currentWatchHistoryIds?.includes(history.mediaid)) {
if (
!currentWatchHistoryIds?.includes(history.mediaid) ||
externalData?.history?.some((e) => e.mediaid == history.mediaid && e.progress != history.progress)
) {
await InPlayer.Account.updateWatchHistory(history.mediaid, history.progress);
}
});
Expand Down

0 comments on commit d69bfed

Please sign in to comment.