Add ticket time tracking with reports and entry management.
Support start/stop timer, manual durations, grouped reports, and per-ticket edit/delete of time entries with undo. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,12 +21,13 @@ type Executor interface {
|
||||
|
||||
// History is an undo/redo stack for Command values, optionally persisted to disk.
|
||||
type History struct {
|
||||
mu sync.Mutex
|
||||
undoS []Command
|
||||
redoS []Command
|
||||
path string
|
||||
store ticket.Store
|
||||
max int
|
||||
mu sync.Mutex
|
||||
undoS []Command
|
||||
redoS []Command
|
||||
path string
|
||||
store ticket.Store
|
||||
timeStore ticket.TimeStore
|
||||
max int
|
||||
}
|
||||
|
||||
// NewHistory creates an empty in-memory command history (cap MaxHistory).
|
||||
@@ -36,13 +37,15 @@ func NewHistory() *History {
|
||||
|
||||
// OpenHistory loads a persisted history from path (DataDir/history.json) or
|
||||
// starts empty if the file is missing. Subsequent Do/Undo/Redo write back.
|
||||
func OpenHistory(path string, store ticket.Store) (*History, error) {
|
||||
// timeStore may be nil if time-entry commands are unused.
|
||||
func OpenHistory(path string, store ticket.Store, timeStore ticket.TimeStore) (*History, error) {
|
||||
h := &History{
|
||||
path: path,
|
||||
store: store,
|
||||
max: MaxHistory,
|
||||
path: path,
|
||||
store: store,
|
||||
timeStore: timeStore,
|
||||
max: MaxHistory,
|
||||
}
|
||||
undo, redo, err := loadHistoryFile(path, store)
|
||||
undo, redo, err := loadHistoryFile(path, store, timeStore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user