(self, queryset, indicator_name, transformer=None)
Given a QuerySet containing values for an indicator add them to the data set.
        If any user ID's are missing from the QuerySet set the value
        of the indicator for those users to a default value (self,no_value).

        QuerySet expected to contain the following columns:
        *  user_id:  ID of the user.
        *  count:    The value of the indicator for the user.

        :param queryset:        The QuerySet containing the calculated indicator data.
        :param indicator_name:  The name of the indicator.
        :param transformer:     Function to apply to each value before adding it to the dataset.
Given a QuerySet containing values for an indicator add them to the data set.
        If any user ID's are missing from the QuerySet set the value
        of the indicator for those users to a default value (self,no_value).
Given a QuerySet containing values for an indicator add them to the data set . If any user ID s are missing from the QuerySet set the value of the indicator for those users to a default value ( self no_value ) .
def _add_data(self, queryset, indicator_name, transformer=None):
        """
        Given a QuerySet containing values for an indicator add them to the data set.
        If any user ID's are missing from the QuerySet set the value
        of the indicator for those users to a default value (self,no_value).

        QuerySet expected to contain the following columns:
        *  user_id:  ID of the user.
        *  count:    The value of the indicator for the user.

        :param queryset:        The QuerySet containing the calculated indicator data.
        :param indicator_name:  The name of the indicator.
        :param transformer:     Function to apply to each value before adding it to the dataset.
        """
        seen_users = set()

        for row in queryset:
            user_id = row['user_id']
            val = transformer(row['count']) if transformer else row['count']
            self.data[user_id][indicator_name] = val
            seen_users.add(user_id)

        # add data for user_ids with no data
        unseen_users = self.users_needing_data - seen_users
        for user_id in unseen_users:
            self.data[user_id].setdefault(indicator_name, self.no_value)
def _add_data ( self , queryset , indicator_name , transformer = None ) : seen_users = set ( ) for row in queryset : user_id = row [ 'user_id' ] val = transformer ( row [ 'count' ] ) if transformer else row [ 'count' ] self . data [ user_id ] [ indicator_name ] = val seen_users . add ( user_id ) # add data for user_ids with no data unseen_users = self . users_needing_data - seen_users for user_id in unseen_users : self . data [ user_id ] . setdefault ( indicator_name , self . no_value )