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

Method getStats

src/api/TasksController.ts:485–503  ·  view source on GitHub ↗
(req: HTTPRequestLike, res: HTTPResponseLike)

Source from the content-addressed store, hash-verified

483
484 @Get("/api/stats")
485 async getStats(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> {
486 try {
487 const allTasks = await this.cacheManager.getAllTasks();
488 const fullStats = this.taskStatsService.getStats(allTasks);
489
490 const stats = {
491 total: fullStats.total,
492 completed: fullStats.completed,
493 active: fullStats.active,
494 overdue: fullStats.overdue,
495 archived: fullStats.archived,
496 withTimeTracking: fullStats.withTimeEntries,
497 };
498
499 this.sendResponse(res, 200, this.successResponse(stats));
500 } catch (error: unknown) {
501 this.sendResponse(res, 500, this.errorResponse(this.getErrorMessage(error)));
502 }
503 }
504}

Callers 3

getTaskStatsMethod · 0.45
cleanupPluginRuntimeFunction · 0.45

Calls 5

sendResponseMethod · 0.80
successResponseMethod · 0.80
errorResponseMethod · 0.80
getAllTasksMethod · 0.45
getErrorMessageMethod · 0.45

Tested by

no test coverage detected