add missing case in entry and fix unit formatting; ref #13
This commit is contained in:
parent
ba824325bc
commit
dcd613622e
2 changed files with 6 additions and 6 deletions
10
z/entry.go
10
z/entry.go
|
@ -107,13 +107,13 @@ func (entry *Entry) GetOutputForTrack(isRunning bool, wasRunning bool) (string)
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
trackDiffNow := now.Sub(entry.Begin)
|
trackDiffNow := now.Sub(entry.Begin)
|
||||||
trackDiffNowOut := time.Time{}.Add(trackDiffNow)
|
durationString := fmtDuration(trackDiffNow)
|
||||||
|
|
||||||
if isRunning == true && wasRunning == false {
|
if isRunning == true && wasRunning == false {
|
||||||
outputPrefix = "began tracking"
|
outputPrefix = "began tracking"
|
||||||
} else if isRunning == true && wasRunning == true {
|
} else if isRunning == true && wasRunning == true {
|
||||||
outputPrefix = "tracking"
|
outputPrefix = "tracking"
|
||||||
outputSuffix = fmt.Sprintf(" for %sh", color.FgLightWhite.Render(trackDiffNowOut.Format("15:04")))
|
outputSuffix = fmt.Sprintf(" for %sh", color.FgLightWhite.Render(durationString))
|
||||||
} else if isRunning == false && wasRunning == false {
|
} else if isRunning == false && wasRunning == false {
|
||||||
outputPrefix = "tracked"
|
outputPrefix = "tracked"
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ func (entry *Entry) GetOutputForFinish() (string) {
|
||||||
trackDiff := entry.Finish.Sub(entry.Begin)
|
trackDiff := entry.Finish.Sub(entry.Begin)
|
||||||
taskDuration := fmtDuration(trackDiff)
|
taskDuration := fmtDuration(trackDiff)
|
||||||
|
|
||||||
outputSuffix = fmt.Sprintf(" for %s h", color.FgLightWhite.Render(taskDuration))
|
outputSuffix = fmt.Sprintf(" for %sh", color.FgLightWhite.Render(taskDuration))
|
||||||
|
|
||||||
if entry.Task != "" && entry.Project != "" {
|
if entry.Task != "" && entry.Project != "" {
|
||||||
return fmt.Sprintf("%s finished tracking %s on %s%s\n", CharFinish, color.FgLightWhite.Render(entry.Task), color.FgLightWhite.Render(entry.Project), outputSuffix)
|
return fmt.Sprintf("%s finished tracking %s on %s%s\n", CharFinish, color.FgLightWhite.Render(entry.Task), color.FgLightWhite.Render(entry.Project), outputSuffix)
|
||||||
|
@ -172,7 +172,7 @@ func (entry *Entry) GetOutput(full bool) (string) {
|
||||||
taskDuration := fmtDuration(trackDiff)
|
taskDuration := fmtDuration(trackDiff)
|
||||||
if full == false {
|
if full == false {
|
||||||
|
|
||||||
output = fmt.Sprintf("%s %s on %s from %s to %s (%s h) %s",
|
output = fmt.Sprintf("%s %s on %s from %s to %s (%sh) %s",
|
||||||
color.FgGray.Render(entry.ID),
|
color.FgGray.Render(entry.ID),
|
||||||
color.FgLightWhite.Render(entry.Task),
|
color.FgLightWhite.Render(entry.Task),
|
||||||
color.FgLightWhite.Render(entry.Project),
|
color.FgLightWhite.Render(entry.Project),
|
||||||
|
@ -182,7 +182,7 @@ func (entry *Entry) GetOutput(full bool) (string) {
|
||||||
color.FgLightYellow.Render(isRunning),
|
color.FgLightYellow.Render(isRunning),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
output = fmt.Sprintf("%s\n %s on %s\n %s h from %s to %s %s\n\n Notes:\n %s\n",
|
output = fmt.Sprintf("%s\n %s on %s\n %sh from %s to %s %s\n\n Notes:\n %s\n",
|
||||||
color.FgGray.Render(entry.ID),
|
color.FgGray.Render(entry.ID),
|
||||||
color.FgLightWhite.Render(entry.Task),
|
color.FgLightWhite.Render(entry.Task),
|
||||||
color.FgLightWhite.Render(entry.Project),
|
color.FgLightWhite.Render(entry.Project),
|
||||||
|
|
Loading…
Reference in a new issue