applied generate_series function to retrieve data by weeks

Removed the zero padding logic and reduced number of queries by using the generate_timeseries function  to retrieve data aggregated by weeks.