From 1a36e6fb5e3903bf51161ca143a94ccf086e65d2 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Tue, 10 May 2022 10:31:41 -0300 Subject: [PATCH] fix: clone was using start time of the cloned --- CHANGELOG.md | 5 +++++ cmd/clone.go | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a816d9e..7559e6c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `clone` command was using the start time of the copied time entry to close the current one + instead of the start time of new one being created. + ## [v0.36.0] - 2022-05-09 ### Added diff --git a/cmd/clone.go b/cmd/clone.go index a031410f..5d8093a3 100644 --- a/cmd/clone.go +++ b/cmd/clone.go @@ -64,12 +64,12 @@ var cloneCmd = &cobra.Command{ if tec, err = manageEntry( tec, fillTimeEntryWithFlags(cmd.Flags()), - func(tei dto.TimeEntryImpl) (dto.TimeEntryImpl, error) { + func(tec dto.TimeEntryImpl) (dto.TimeEntryImpl, error) { if noClosing { - return tei, nil + return tec, nil } - return tei, validateClosingTimeEntry( + return tec, validateClosingTimeEntry( c, tec.WorkspaceID, tec.UserID, ) }, @@ -77,12 +77,12 @@ var cloneCmd = &cobra.Command{ getPropsInteractiveFn(c, dc), getDatesInteractiveFn(), getValidateTimeEntryFn(c), - func(tei dto.TimeEntryImpl) (dto.TimeEntryImpl, error) { + func(tec dto.TimeEntryImpl) (dto.TimeEntryImpl, error) { if noClosing { - return tei, nil + return tec, nil } - return tei, out(tec, c) + return tec, out(tec, c) }, ); err != nil { return err