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

Method getAllTasks

src/views/StatsView.ts:386–422  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384 }
385
386 private async getAllTasks(): Promise<TaskInfo[]> {
387 const cacheKey = `all-tasks-${JSON.stringify(this.currentFilters)}`;
388
389 // Check cache first
390 if (this.isCacheValid() && this.statsCache.has(cacheKey)) {
391 const cached = this.statsCache.get(cacheKey);
392 if (cached) {
393 return cached;
394 }
395 }
396
397 // Get all tasks from the cache
398 const allTaskPaths = this.plugin.cacheManager.getAllTaskPaths();
399 let tasks: TaskInfo[] = [];
400
401 for (const path of allTaskPaths) {
402 try {
403 const task = await this.plugin.cacheManager.getTaskInfo(path);
404 if (task) {
405 tasks.push(task);
406 }
407 } catch {
408 // Failed to get task info - continue silently
409 }
410 }
411
412 tasks = filterStatsVisibleTasks(tasks);
413
414 // Apply filters
415 tasks = this.applyTaskFilters(tasks);
416
417 // Cache the results
418 this.statsCache.set(cacheKey, tasks);
419 this.lastCacheTime = Date.now();
420
421 return tasks;
422 }
423
424 /**
425 * Apply current filters to task list

Calls 9

isCacheValidMethod · 0.95
applyTaskFiltersMethod · 0.95
filterStatsVisibleTasksFunction · 0.85
hasMethod · 0.80
nowMethod · 0.80
getMethod · 0.65
getAllTaskPathsMethod · 0.65
getTaskInfoMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected