MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / resolveOccurrenceParentTask

Method resolveOccurrenceParentTask

src/services/TaskService.ts:998–1025  ·  view source on GitHub ↗
(occurrenceTask: TaskInfo)

Source from the content-addressed store, hash-verified

996 }
997
998 private async resolveOccurrenceParentTask(occurrenceTask: TaskInfo): Promise<TaskInfo | null> {
999 if (!occurrenceTask.recurrence_parent) {
1000 return null;
1001 }
1002
1003 const linkPath = parseLinkToPath(occurrenceTask.recurrence_parent);
1004 const candidates = new Set<string>([linkPath]);
1005 if (linkPath && !linkPath.endsWith(".md")) {
1006 candidates.add(`${linkPath}.md`);
1007 }
1008
1009 for (const candidate of candidates) {
1010 const task = await this.plugin.cacheManager.getTaskInfo(candidate);
1011 if (task) {
1012 return task;
1013 }
1014 }
1015
1016 const resolved = this.plugin.app.metadataCache.getFirstLinkpathDest?.(
1017 linkPath,
1018 occurrenceTask.path
1019 );
1020 if (resolved instanceof TFile) {
1021 return await this.plugin.cacheManager.getTaskInfo(resolved.path);
1022 }
1023
1024 return null;
1025 }
1026
1027 private buildOccurrenceParentReference(parentTask: TaskInfo): string {
1028 const parentFile = this.plugin.app.vault.getAbstractFileByPath(parentTask.path);

Calls 2

parseLinkToPathFunction · 0.90
getTaskInfoMethod · 0.65

Tested by

no test coverage detected