MCPcopy Index your code
hub / github.com/MALSync/MALSync / syncHandling

Method syncHandling

src/pages-sync/syncPage.ts:580–703  ·  view source on GitHub ↗
(hoverInfo = false, undo = false)

Source from the content-addressed store, hash-verified

578 }
579
580 private syncHandling(hoverInfo = false, undo = false) {
581 let p;
582 if (undo) {
583 p = this.singleObj.undo();
584 } else {
585 p = this.singleObj.sync();
586 }
587
588 return p
589 .then(() => {
590 let message = this.singleObj.getTitle();
591 let split = '<br>';
592 let totalVol = this.singleObj.getTotalVolumes();
593 if (totalVol === 0) totalVol = '?';
594 let totalEp = this.singleObj.getTotalEpisodes();
595 if (totalEp === 0) totalEp = '?';
596 let diffState = this.singleObj.getStateDiff();
597
598 if (!diffState)
599 diffState = {
600 onList: this.singleObj.isOnList(),
601 episode: this.singleObj.getEpisode(),
602 volume: this.singleObj.getVolume(),
603 status: this.singleObj.getStatus(),
604 score: this.singleObj.getScore(),
605 };
606
607 if (typeof diffState.onList === 'undefined') diffState.onList = true;
608
609 if (diffState.onList && diffState.status) {
610 let statusString = '';
611 switch (parseInt(diffState.status)) {
612 case status.Watching:
613 statusString = api.storage.lang(`UI_Status_watching_${this.page.type}`);
614 break;
615 case status.Completed:
616 statusString = api.storage.lang('UI_Status_Completed');
617 break;
618 case status.Onhold:
619 statusString = api.storage.lang('UI_Status_OnHold');
620 break;
621 case status.Dropped:
622 statusString = api.storage.lang('UI_Status_Dropped');
623 break;
624 case status.PlanToWatch:
625 statusString = api.storage.lang(`UI_Status_planTo_${this.page.type}`);
626 break;
627 case status.Rewatching:
628 statusString = api.storage.lang(`UI_Status_Rewatching_${this.page.type}`);
629 break;
630 case status.Considering:
631 statusString = api.storage.lang('UI_Status_Considering');
632 break;
633 default:
634 }
635 message += split + statusString;
636 split = ' | ';
637 }

Callers 3

syncMethod · 0.95
buttonclickMethod · 0.95
fillUIMethod · 0.80

Calls 8

fullNotificationMethod · 0.95
openCorrectionUiMethod · 0.95
fillUIMethod · 0.95
syncMethod · 0.80
langMethod · 0.80
onMethod · 0.80
removeMethod · 0.80
getTitleMethod · 0.45

Tested by

no test coverage detected