|
|
|
|
|
by jononor
3499 days ago
|
|
Eve is based on pattern-matching and is set-oriented. So all-checked = [#todo completed: true]
would match each of the records with both topic: 'todo' and completed: true. And the following commit block would once per matching record. But what is desired here is one value for all the matching records (an "aggregate" in Eve lingo).Personally I think we would be much better off with a dedicated aggregate function instead of using if/else here.
And count (which is an aggregate function), should have a default value for when no records match. Then could get rid of the if/else there also, and have something like: all-checked = all[#todo completed: true]
none-checked = none[#todo completed: true]
todo-count = count[given: [#todo completed: false], default: 0]
Disclaimer: I'm just an Eve user/contributor |
|