Compare commits
No commits in common. "ac4311d5423f0136f4a9d6d7d04d3429375371ee" and "05ad2aa0f08047902f55c0bd2dadacf7f1895b27" have entirely different histories.
ac4311d542
...
05ad2aa0f0
|
@ -56,7 +56,7 @@ func (la ListArgs) Parse(main []string, fields map[string]string) (Command, erro
|
||||||
fields["from"] = today.String()
|
fields["from"] = today.String()
|
||||||
fields["to"] = today.Add(7).String()
|
fields["to"] = today.Add(7).String()
|
||||||
case main[0] == "recur":
|
case main[0] == "recur":
|
||||||
fields["recurrer"] = "true"
|
fields["recurring"] = "true"
|
||||||
// case main[0] == "list":
|
// case main[0] == "list":
|
||||||
// fields["from"] = today.String()
|
// fields["from"] = today.String()
|
||||||
// fields["to"] = today.String()
|
// fields["to"] = today.String()
|
||||||
|
|
|
@ -37,20 +37,10 @@ func NewUpdateArgs() UpdateArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ua UpdateArgs) Parse(main []string, fields map[string]string) (Command, error) {
|
func (ua UpdateArgs) Parse(main []string, fields map[string]string) (Command, error) {
|
||||||
if len(main) < 2 {
|
if len(main) < 2 || main[0] != "update" {
|
||||||
return nil, ErrWrongCommand
|
return nil, ErrWrongCommand
|
||||||
}
|
}
|
||||||
aliases := []string{"u", "update"}
|
localID, err := strconv.Atoi(main[1])
|
||||||
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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("not a local id: %v", main[1])
|
return nil, fmt.Errorf("not a local id: %v", main[1])
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (t *SqliteTask) FindMany(params storage.TaskListParams) ([]item.Task, error
|
||||||
where := make([]string, 0)
|
where := make([]string, 0)
|
||||||
var dateNonEmpty bool
|
var dateNonEmpty bool
|
||||||
if params.HasRecurrer {
|
if params.HasRecurrer {
|
||||||
where = append(where, `recurrer != ''`)
|
where[0] = `recurrer != ''`
|
||||||
}
|
}
|
||||||
if !params.From.IsZero() {
|
if !params.From.IsZero() {
|
||||||
where = append(where, `date >= ?`)
|
where = append(where, `date >= ?`)
|
||||||
|
|
Loading…
Reference in New Issue