def add_form_data(self, indicator_config):
        logger.debug('Adding forms submitted stats: %s', indicator_config.date_ranges)
        if indicator_config.include_legacy:
            logger.debug('Adding legacy forms submitted stats: %s', indicator_config.date_ranges)

        for range_name in indicator_config.date_ranges:
            lower, upper = self.date_ranges[range_name]
            results = FormData.objects \
                .values('user_id') \
                .filter(**self._date_filters('time_end', lower, upper)) \
                .filter(
                    domain=self.domain,
                    user_id__in=self.users_needing_data
                )\
                .annotate(count=Count('instance_id'))

            self._add_data(results, '{}_{}'.format(FORMS_SUBMITTED, range_name))

            if indicator_config.include_legacy:
                #  maintained for backwards compatibility
                self._add_data(results, '{}{}'.format(LEGACY_FORMS_SUBMITTED, range_name.title()))

            if self.domain in PER_DOMAIN_FORM_INDICATORS:
                for custom in PER_DOMAIN_FORM_INDICATORS[self.domain]:
                    self.add_custom_form_data(
                        custom['slug'],
                        range_name,
                        custom['xmlns'],
                        custom['type'],
                        lower,
                        upper
                    )
Gets the number of the next available file descriptor.
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/callcenter/indicator_sets.py/CallCenterIndicators.add_form_data--crossover with--dataset/ETHPy150Open BD2KGenomics/toil/src/toil/worker.py/nextOpenDescriptor