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

Method refreshStats

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

Source from the content-addressed store, hash-verified

353 }
354
355 private async refreshStats() {
356 try {
357 // Clear cache to ensure fresh data
358 this.clearCache();
359
360 const results = await Promise.allSettled([
361 this.updateOverviewStats(),
362 this.updateTodayStats(),
363 this.updateWeekStats(),
364 this.updateMonthStats(),
365 this.updateProjectStats(),
366 ]);
367
368 // Log any failures in development
369 if (process.env.NODE_ENV === "development") {
370 results.forEach((result, index) => {
371 if (result.status === "rejected") {
372 const sections = ["overview", "today", "week", "month", "projects"];
373 tasknotesLogger.warn(`Failed to update ${sections[index]} stats:`, {
374 category: "validation",
375 operation: "update",
376 details: { value: result.reason },
377 });
378 }
379 });
380 }
381 } catch {
382 // Failed to refresh stats - continue silently
383 }
384 }
385
386 private async getAllTasks(): Promise<TaskInfo[]> {
387 const cacheKey = `all-tasks-${JSON.stringify(this.currentFilters)}`;

Callers 2

renderMethod · 0.95
applyFiltersMethod · 0.95

Calls 7

clearCacheMethod · 0.95
updateOverviewStatsMethod · 0.95
updateTodayStatsMethod · 0.95
updateWeekStatsMethod · 0.95
updateMonthStatsMethod · 0.95
updateProjectStatsMethod · 0.95
warnMethod · 0.80

Tested by

no test coverage detected