MCPcopy
hub / github.com/callumalpass/tasknotes / skipMaterializedOccurrence

Method skipMaterializedOccurrence

src/services/TaskService.ts:827–874  ·  view source on GitHub ↗
(
		occurrenceTask: TaskInfo,
		skippedStatus = this.getDefaultSkippedOccurrenceStatus()
	)

Source from the content-addressed store, hash-verified

825 }
826
827 async skipMaterializedOccurrence(
828 occurrenceTask: TaskInfo,
829 skippedStatus = this.getDefaultSkippedOccurrenceStatus()
830 ): Promise<TaskInfo> {
831 const freshOccurrence =
832 (await this.plugin.cacheManager.getTaskInfo(occurrenceTask.path)) || occurrenceTask;
833 const parentTask = await this.resolveOccurrenceParentTask(freshOccurrence);
834 if (!parentTask) {
835 throw new Error("Cannot resolve occurrence parent");
836 }
837
838 const plan = buildMaterializedOccurrenceSkipPlan({
839 occurrenceTask: freshOccurrence,
840 parentTask,
841 skippedStatus,
842 currentTimestamp: getCurrentTimestamp(),
843 maintainDueDateOffsetInRecurring: this.plugin.settings.maintainDueDateOffsetInRecurring,
844 });
845
846 const updatedOccurrence = await this.persistTaskInfoUpdates(
847 freshOccurrence,
848 plan.occurrenceUpdates,
849 "skip-materialized-occurrence"
850 );
851 const updatedParent = await this.persistTaskInfoUpdates(
852 parentTask,
853 plan.parentUpdates,
854 "reconcile-skipped-materialized-occurrence-parent"
855 );
856
857 if (plan.materializeNextDate) {
858 try {
859 await this.materializeOccurrence(updatedParent, plan.materializeNextDate);
860 } catch (materializeError) {
861 tasknotesLogger.warn("Failed to materialize next occurrence after skip:", {
862 category: "persistence",
863 operation: "materialize-next-occurrence-after-skip",
864 details: {
865 parentPath: updatedParent.path,
866 nextDate: plan.materializeNextDate,
867 },
868 error: materializeError,
869 });
870 }
871 }
872
873 return updatedOccurrence;
874 }
875
876 async unskipMaterializedOccurrence(occurrenceTask: TaskInfo): Promise<TaskInfo> {
877 const freshOccurrence =

Callers 1

Calls 7

materializeOccurrenceMethod · 0.95
getCurrentTimestampFunction · 0.90
warnMethod · 0.80
getTaskInfoMethod · 0.65

Tested by

no test coverage detected