From afb0a04fe600575b00d551da7dce6a08679ef7b8 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sun, 26 May 2024 22:20:40 +0200 Subject: Working task selection --- model.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'model.go') diff --git a/model.go b/model.go index 93a988c..6eebd60 100644 --- a/model.go +++ b/model.go @@ -12,7 +12,7 @@ type Entry struct { Date Date From *Time To *Time - Tag *string + Tasks map[int]*time.Duration Comment string } @@ -27,8 +27,13 @@ type Date string type Time string -var timeMatch = regexp.MustCompile("\\d\\d:\\d\\d") -var dateMatch = regexp.MustCompile("\\d\\d\\d\\d-\\d\\d-\\d\\d") +type EntrySubDuration string + +var ( + timeMatch = regexp.MustCompile("[0-9]{2}:[0-9]{2}") + dateMatch = regexp.MustCompile("[0-9]{4}-[0-9]{2}-[0-9]{2}") + subDurationMatch = regexp.MustCompile("[0-9]") +) var ( ErrInvalidTime = errors.New("Invalid time string") @@ -41,7 +46,7 @@ func NewEntry(date Date) *Entry { From: nil, Date: date, To: nil, - Tag: nil, + Tasks: map[int]*time.Duration{}, Comment: "", } -- cgit v1.2.3