Feature/timelines aggregations performance

See commits. Fixes [`#2372`](https://www.openproject.org/work_packages/2372).