amazingmarvin / MarvinAPI

API documentation for the Amazing Marvin productivity tool
https://amazingmarvin.com/
92 stars 0 forks source link

Getting weekly stats based on goals #36

Closed aviskase closed 3 years ago

aviskase commented 3 years ago

Hi, I'd like to replicate Archive > Stats view, but with the split by goals instead of categories.

I'm not very familiar with couchdb queries, so I've started with a simple find with selectors done and doneAt. But I have trouble with filtering based on goal. As I understand, the only way to know that the task is in the goal is by g_in_GOALID field. It doesn't look like there is possibility to have a selector "field starting with gin`", am I right? Also, looks like if a task is a part of the project with the goal, the task itself doesn't have this field.

Thus, the algorithm seems to be: 1) Grab all done tasks between two dates 2) For each task check whether it has g_in_* field

Perhaps there is a better way?

amazingmarvin commented 3 years ago

Yes, this is how I would implement this! Alternatively you could make a query for each g_in_* field done between two dates, but my experience with couchdb is that it's easiest to do as much client-side as possible.