(
        domain,
        app_id,
        xmlns,
        user_ids,
        startdate,
        enddate,
        by_submission_time=True)
return query.run().aggregations.duration_stats.result
Gets the form duration stats for a group of users
Gets the form duration stats for a group of users
Gets the form duration stats for a group of users
def get_form_duration_stats_for_users(
        domain,
        app_id,
        xmlns,
        user_ids,
        startdate,
        enddate,
        by_submission_time=True):
    """Gets the form duration stats for a group of users"""
    date_filter_fn = submitted_filter if by_submission_time else completed_filter

    query = (
        FormES()
        .domain(domain)
        .user_ids_handle_unknown(user_ids)
        .remove_default_filter('has_user')
        .xmlns(xmlns)
        .filter(date_filter_fn(gte=startdate, lt=enddate))
        .aggregation(
            ExtendedStatsAggregation(
                'duration_stats',
                'form.meta.timeStart',
                script=_duration_script(),
            )
        )
        .size(0)
    )

    if app_id:
        query = query.app(app_id)

    return query.run().aggregations.duration_stats.result
def get_form_duration_stats_for_users ( domain , app_id , xmlns , user_ids , startdate , enddate , by_submission_time = True ) : date_filter_fn = submitted_filter if by_submission_time else completed_filter query = ( FormES ( ) . domain ( domain ) . user_ids_handle_unknown ( user_ids ) . remove_default_filter ( 'has_user' ) . xmlns ( xmlns ) . filter ( date_filter_fn ( gte = startdate , lt = enddate ) ) . aggregation ( ExtendedStatsAggregation ( 'duration_stats' , 'form.meta.timeStart' , script = _duration_script ( ) , ) ) . size ( 0 ) ) if app_id : query = query . app ( app_id ) return query . run ( ) . aggregations . duration_stats . result