fix: bug on aggregation interval calculation and add unittest for aggregation webservice