Given a list of addresses, we need to find all matching projects
We iterate on each project, and get the needs list for that project
We aggregate by building a new needs list. We uniquely identify entries by their items and sorted mod values. Two entries are considered to be equal, if they refer to the same item, with the same mods and the same mod values. Then we either create new entries or increment the amount on existing entries, in the resulting needs list
The resulting needs list is not bound to any project.
This is a naive implementation, but simple enough and relies on existing apis. If it turns out to be insufficient in terms of performance, then we can try to find a better implementation.
Also this approach will be the foundation for other aggregations (see #69 , #70 , #71 , #72 )
This PR implements needs aggregation for a set of addresses. This will be the building block for more complex aggregations.
Fixes: https://github.com/distributeaid/toolbox/issues/68
Implementation details:
This is a naive implementation, but simple enough and relies on existing apis. If it turns out to be insufficient in terms of performance, then we can try to find a better implementation.
Also this approach will be the foundation for other aggregations (see #69 , #70 , #71 , #72 )