<s> import datetime <EOL> from user_metrics . models import MetricWeek <EOL> def week_for_date ( date ) : <EOL> return date - datetime . timedelta ( days = date . weekday ( ) ) <EOL> def total_weeks_aggregated ( ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> first_week = MetricWeek . objects . all ( ) . order_by ( '<STR_LIT>' ) [ <NUM_LIT:0> ] . date_up <EOL> except IndexError : <EOL> first_week = week_for_date ( datetime . date . today ( ) ) <EOL> return ( datetime . date . today ( ) - first_week ) . days / <NUM_LIT:7> </s>
