Filter the last week of user actions.

def GetReportData(self, get_report_args, token):
    """Filter the last week of user actions."""
    ret = rdf_report_plugins.ApiReportData(
        representation_type=RepresentationType.STACK_CHART)

    week_duration = rdfvalue.Duration("7d")
    num_weeks = math.ceil(get_report_args.duration.seconds /
                          week_duration.seconds)
    weeks = range(0, num_weeks)
    start_time = get_report_args.start_time
    end_time = start_time + num_weeks * week_duration
    user_activity = collections.defaultdict(lambda: {week: 0 for week in weeks})

    entries = self._LoadUserActivity(
        start_time=get_report_args.start_time, end_time=end_time, token=token)

    for username, timestamp, count in entries:
      week = (timestamp - start_time).seconds // week_duration.seconds
      if week in user_activity[username]:
        user_activity[username][week] += count

    user_activity = sorted(iteritems(user_activity))
    user_activity = [(user, data)
                     for user, data in user_activity
                     if user not in aff4_users.GRRUser.SYSTEM_USERS]

    ret.stack_chart.data = [
        rdf_report_plugins.ApiReportDataSeries2D(
            label=user,
            points=(rdf_report_plugins.ApiReportDataPoint2D(x=x, y=y)
                    for x, y in sorted(data.items())))
        for user, data in user_activity
    ]

    return ret