Add niceties to time page
This commit is contained in:
@ -31,6 +31,7 @@ type TimeWarrior interface {
|
||||
CancelTracking() error
|
||||
DeleteInterval(id int) error
|
||||
FillInterval(id int) error
|
||||
JoinInterval(id int) error
|
||||
ModifyInterval(interval *Interval, adjust bool) error
|
||||
GetSummary(filter ...string) string
|
||||
GetActive() *Interval
|
||||
@ -232,6 +233,21 @@ func (ts *TimeSquire) FillInterval(id int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ts *TimeSquire) JoinInterval(id int) error {
|
||||
ts.mutex.Lock()
|
||||
defer ts.mutex.Unlock()
|
||||
|
||||
// Join the current interval with the previous one
|
||||
// The previous interval has id+1 (since intervals are ordered newest first)
|
||||
cmd := exec.Command(twBinary, append(ts.defaultArgs, []string{"join", fmt.Sprintf("@%d", id+1), fmt.Sprintf("@%d", id)}...)...)
|
||||
if err := cmd.Run(); err != nil {
|
||||
slog.Error("Failed joining interval:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ts *TimeSquire) ModifyInterval(interval *Interval, adjust bool) error {
|
||||
ts.mutex.Lock()
|
||||
defer ts.mutex.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user