Skip to content

Commit

Permalink
feat(website): only necessary progress updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mytlogos committed May 3, 2022
1 parent 15e536c commit 2f54e8f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/website/src/views/MediumDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,23 @@ export default defineComponent({
const newProgress = read ? 1 : 0;
const batchSize = 50;
let updateReleases = [];
if (read) {
updateReleases = this.releases.filter((value) => value.progress < 1);
} else {
updateReleases = this.releases.filter((value) => value.progress >= 1);
}
if (!updateReleases.length) {
this.markToast.message = "No Releases available for marking.";
this.markToast.success = true;
this.markToast.show = true;
return;
}
Promise.allSettled(
batch(this.releases, batchSize).map((releases: MediumRelease[]) => {
batch(updateReleases, batchSize).map((releases: MediumRelease[]) => {
const episodeIds: number[] = releases.map((value) => value.episodeId);
return HttpClient.updateProgress(episodeIds, newProgress);
}),
Expand Down

0 comments on commit 2f54e8f

Please sign in to comment.