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

Function startTimeTrackingForTask

src/cli/helpers/timeTracking.ts:12–31  ·  view source on GitHub ↗
(
	plugin: TaskNotesPlugin,
	task: TaskInfo,
	description?: string
)

Source from the content-addressed store, hash-verified

10}
11
12export async function startTimeTrackingForTask(
13 plugin: TaskNotesPlugin,
14 task: TaskInfo,
15 description?: string
16): Promise<TaskInfo> {
17 let updatedTask = await plugin.taskService.startTimeTracking(task);
18
19 const trimmedDescription = description?.trim();
20 if (trimmedDescription && updatedTask.timeEntries && updatedTask.timeEntries.length > 0) {
21 const latestEntry = updatedTask.timeEntries[updatedTask.timeEntries.length - 1];
22 if (latestEntry && !latestEntry.endTime) {
23 latestEntry.description = trimmedDescription;
24 updatedTask = await plugin.taskService.updateTask(updatedTask, {
25 timeEntries: updatedTask.timeEntries,
26 });
27 }
28 }
29
30 return updatedTask;
31}
32
33export async function resolveTaskForStopTimeTracking(
34 plugin: TaskNotesPlugin,

Callers 1

handlerFunction · 0.90

Calls 2

updateTaskMethod · 0.65
startTimeTrackingMethod · 0.45

Tested by

no test coverage detected