diff --git a/src/commands/finish.ts b/src/commands/finish.ts index c7d8dd0..c64c1dc 100644 --- a/src/commands/finish.ts +++ b/src/commands/finish.ts @@ -75,7 +75,6 @@ const updateTargetprocess = async (targetprocessApi: Targetprocess, request: Fin const notes = getTargetprocessNotes(request, timeEntity); - // Issue #64: If the linked TP entity is a Task *and* its timeRemaining is 0, set the task to 'Done' if (timeEntity.ResourceType === "Task" && request.timeRemaining === 0 && request.tpEntity && diff --git a/src/commands/start.ts b/src/commands/start.ts index b95aff9..f911b10 100644 --- a/src/commands/start.ts +++ b/src/commands/start.ts @@ -16,10 +16,25 @@ export const start = async (packageVersion: string, apiProvider: ApiProvider, da const notes = createNotes(noteInformation, [ details.notes ]); const harvestApi = apiProvider.getHarvestApi(); + const targetprocessApi = apiProvider.getTargetprocessApi(); log.info("Starting Harvest timer..."); try { await harvestApi.startTimeEntry(details.projectId, details.taskId, date, notes, details.hours, details.running); + + if (details.entity && + details.entity.Id && + details.entity.ResourceType === "Task" && + details.entity.EntityState && + details.entity.EntityState.Name && + (details.entity.EntityState.Name.toUpperCase() === "OPEN" || + details.entity.EntityState.Name.toUpperCase() === "DEV READY") && + details.entity.Project && + details.entity.Project.Process && + details.entity.Project.Process.Id) { + + await targetprocessApi.setTaskState(details.entity.Id, "In Progress", details.entity.Project.Process.Id); + } } catch (e) { log.error(e); }