def totals(cls, interval):
 time_points = get_time_points(interval)
 q = Session.query(cls.date, sum(cls.pageview_count).label('sum')).filter((cls.interval == interval)).filter(cls.date.in_(time_points)).filter(cls.codename.startswith(Link._type_prefix)).group_by(cls.date).order_by(desc(cls.date))
 return fill_gaps(time_points, q, 'sum')

def totals ( cls , interval ) : time_points = get_time_points ( interval ) q = Session . query ( cls . date , sum ( cls . pageview_count ) . label ( 'sum' ) ) . filter ( ( cls . interval == interval ) ) . filter ( cls . date . in_ ( time_points ) ) . filter ( cls . codename . startswith ( Link . _type_prefix ) ) . group_by ( cls . date ) . order_by ( desc ( cls . date ) ) return fill_gaps ( time_points , q , 'sum' )
aggregate sitewide totals for self-serve promotion traffic .