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:
Thinking about it, it is possible that this proposal would not work, because in the nothing-matches cases then the function would not be executed at all... But maybe this could work, by widening the matching pattern.
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:
Disclaimer: I'm just an Eve user/contributor