'Add username, user ID, facility name, and facility ID to responses'

def alter_list_data_to_serialize(self, request, to_be_serialized):

    for bundle in to_be_serialized['objects']:
        user_id = bundle.data['user'].data['id']
        user = self._facility_users.get(user_id)
        bundle.data['username'] = user.username
        bundle.data['user_id'] = user.id
        bundle.data['facility_name'] = user.facility.name
        bundle.data['facility_id'] = user.facility.id
        bundle.data['is_teacher'] = user.is_teacher
        attempt_logs = AttemptLog.objects.filter(user=user, exercise_id=bundle.data['exercise_id'], context_type__in=['playlist', 'exercise'])
        bundle.data['timestamp_first'] = ((attempt_logs.count() and attempt_logs.aggregate(Min('timestamp'))['timestamp__min']) or None)
        bundle.data['timestamp_last'] = ((attempt_logs.count() and attempt_logs.aggregate(Max('timestamp'))['timestamp__max']) or None)
        bundle.data['part1_answered'] = AttemptLog.objects.filter(user=user, exercise_id=bundle.data['exercise_id'], context_type__in=['playlist', 'exercise']).count()
        bundle.data['part1_correct'] = AttemptLog.objects.filter(user=user, exercise_id=bundle.data['exercise_id'], correct=True, context_type__in=['playlist', 'exercise']).count()
        bundle.data['part2_attempted'] = AttemptLog.objects.filter(user=user, exercise_id=bundle.data['exercise_id'], context_type__in=['exercise_fixedblock', 'playlist_fixedblock']).count()
        bundle.data['part2_correct'] = AttemptLog.objects.filter(user=user, exercise_id=bundle.data['exercise_id'], correct=True, context_type__in=['exercise_fixedblock', 'playlist_fixedblock']).count()
        bundle.data.pop('user')
    return to_be_serialized
