Compare commits

...

2 Commits

Author SHA1 Message Date
Erik Winter ac4311d542 fix recur list 2025-01-05 09:58:15 +01:00
Erik Winter 15b6958248 switch option update cmd 2025-01-05 09:53:56 +01:00
4 changed files with 14 additions and 4 deletions

BIN
dist/plan vendored

Binary file not shown.

View File

@ -56,7 +56,7 @@ func (la ListArgs) Parse(main []string, fields map[string]string) (Command, erro
fields["from"] = today.String()
fields["to"] = today.Add(7).String()
case main[0] == "recur":
fields["recurring"] = "true"
fields["recurrer"] = "true"
// case main[0] == "list":
// fields["from"] = today.String()
// fields["to"] = today.String()

View File

@ -37,10 +37,20 @@ func NewUpdateArgs() UpdateArgs {
}
func (ua UpdateArgs) Parse(main []string, fields map[string]string) (Command, error) {
if len(main) < 2 || main[0] != "update" {
if len(main) < 2 {
return nil, ErrWrongCommand
}
localID, err := strconv.Atoi(main[1])
aliases := []string{"u", "update"}
var localIDStr string
switch {
case slices.Contains(aliases, main[0]):
localIDStr = main[1]
case slices.Contains(aliases, main[1]):
localIDStr = main[0]
default:
return nil, ErrWrongCommand
}
localID, err := strconv.Atoi(localIDStr)
if err != nil {
return nil, fmt.Errorf("not a local id: %v", main[1])
}

View File

@ -71,7 +71,7 @@ func (t *SqliteTask) FindMany(params storage.TaskListParams) ([]item.Task, error
where := make([]string, 0)
var dateNonEmpty bool
if params.HasRecurrer {
where[0] = `recurrer != ''`
where = append(where, `recurrer != ''`)
}
if !params.From.IsZero() {
where = append(where, `date >= ?`)