Fixed #2, removed initial check for existing entries, adding a separate one
This commit is contained in:
parent
ab78ffcd00
commit
abc041381e
2 changed files with 6 additions and 1 deletions
|
@ -47,7 +47,7 @@ func NewEntry(
|
|||
return Entry{}, err
|
||||
}
|
||||
|
||||
if newEntry.IsFinishedAfterBegan() == false {
|
||||
if id == "" && newEntry.IsFinishedAfterBegan() == false {
|
||||
return Entry{}, errors.New("beginning time of tracking cannot be after finish time")
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,11 @@ var finishCmd = &cobra.Command{
|
|||
}
|
||||
}
|
||||
|
||||
if runningEntry.IsFinishedAfterBegan() == false {
|
||||
fmt.Printf("%s %+v\n", CharError, "beginning time of tracking cannot be after finish time")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
_, err = database.FinishEntry(user, runningEntry)
|
||||
if err != nil {
|
||||
fmt.Printf("%s %+v\n", CharError, err)
|
||||
|
|
Loading…
Reference in a new issue