diff options
author | Teddy Wing | 2017-06-03 17:25:26 +0200 |
---|---|---|
committer | Teddy Wing | 2017-06-03 17:25:26 +0200 |
commit | e8bee60ed342ab4df93bf2fb582706ad7fd42546 (patch) | |
tree | b0115143781eb18d71b2496c04e0bfb1b28432b6 /timetask/time_entry.go | |
parent | 341e22ef6b8290bba8ba43ecddb9f1175b3cafb9 (diff) | |
download | timetasker-e8bee60ed342ab4df93bf2fb582706ad7fd42546.tar.bz2 |
Change `TimeEntry.Time` to a `float64`
I had forgotten that time spent can be a decimal. Make this field a
float and change related code accordingly:
* --time flag
* `NewTimeEntry()` `time` argument
* `buildSubmissionParams()` can't use `strconv.Itoa` as that's an
integer function. Instead we use `FormatFloat`. Truncate time parsing
to two decimal places because to me that seems like enough. Who's
going to say they spent `0.324` hours on something? Also, in order to
be able to properly submit values to TimeTask (at least on the edition
I use), the times must be written in European/French format, with
commas (`,`) as decimal separators. Do a string replace to get this,
as the float formatter will give us a period (`.`) separator.
Diffstat (limited to 'timetask/time_entry.go')
-rw-r--r-- | timetask/time_entry.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/timetask/time_entry.go b/timetask/time_entry.go index ff0ad1f..bb7a741 100644 --- a/timetask/time_entry.go +++ b/timetask/time_entry.go @@ -10,7 +10,7 @@ type TimeEntry struct { Task int WorkType int Date time.Time - Time int + Time float64 Billable bool Description string } @@ -19,7 +19,7 @@ func NewTimeEntry( profile Profile, project Project, date time.Time, - time int, + time float64, description string, ) TimeEntry { return TimeEntry{ |