MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / groupTasksByTaskListSubProperty

Function groupTasksByTaskListSubProperty

src/bases/taskListGrouping.ts:117–134  ·  view source on GitHub ↗
(
	tasks: readonly TaskInfo[],
	propertyId: string,
	pathToProps: ReadonlyMap<string, Record<string, unknown>>
)

Source from the content-addressed store, hash-verified

115}
116
117export function groupTasksByTaskListSubProperty(
118 tasks: readonly TaskInfo[],
119 propertyId: string,
120 pathToProps: ReadonlyMap<string, Record<string, unknown>>
121): Map<string, TaskInfo[]> {
122 const subGroups = new Map<string, TaskInfo[]>();
123
124 for (const task of tasks) {
125 const props = pathToProps.get(task.path) || {};
126 const subValue = getTaskListPropertyValue(props, propertyId);
127 const subKey = stringifyTaskListGroupValue(subValue);
128 const subTasks = subGroups.get(subKey) || [];
129 subTasks.push(task);
130 subGroups.set(subKey, subTasks);
131 }
132
133 return subGroups;
134}
135
136export function buildTaskListGroupedScopePaths(
137 groups: readonly TaskListGroup[],

Calls 4

getTaskListPropertyValueFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected