group_by_day_of_week rewritten