(domain, sync_window, sync_cutoff=None, min_case_load=None)
return list(users_synced_in_window)
Return a list of (request_user_id, user_id) tuples that match the criteria:

    - user has synced since ``since_window``
    - user has not synced since ``sync_cutoff``
    - user has a case load > ``min_case_load``
Return a list of (request_user_id, user_id) tuples that match the criteria:
Return a list of ( request_user_id user_id ) tuples that match the criteria :
def get_users_for_priming(domain, sync_window, sync_cutoff=None, min_case_load=None):
    """Return a list of (request_user_id, user_id) tuples that match the criteria:

    - user has synced since ``since_window``
    - user has not synced since ``sync_cutoff``
    - user has a case load > ``min_case_load``
    """
    if sync_cutoff:
        assert sync_window < sync_cutoff, "Sync cutoff time must be within the sync window"

    base_query = (
        SyncLogSQL.objects.values_list("request_user_id", "user_id")
        .filter(
            domain=domain,
            is_formplayer=True,
        ).exclude(auth_type=FORMPLAYER)  # ignore syncs that were done by SMS or by this task
    )

    query = base_query.filter(date__gt=sync_window)
    if min_case_load:
        query = query.filter(case_count__gt=min_case_load)
    users_synced_in_window = set(query.distinct())

    if sync_cutoff:
        users_synced_since_cutoff = set(base_query.filter(date__gt=sync_cutoff).distinct())
        return list(users_synced_in_window - users_synced_since_cutoff)

    return list(users_synced_in_window)
def get_users_for_priming ( domain , sync_window , sync_cutoff = None , min_case_load = None ) : if sync_cutoff : assert sync_window < sync_cutoff , "Sync cutoff time must be within the sync window" base_query = ( SyncLogSQL . objects . values_list ( "request_user_id" , "user_id" ) . filter ( domain = domain , is_formplayer = True , ) . exclude ( auth_type = FORMPLAYER ) # ignore syncs that were done by SMS or by this task ) query = base_query . filter ( date__gt = sync_window ) if min_case_load : query = query . filter ( case_count__gt = min_case_load ) users_synced_in_window = set ( query . distinct ( ) ) if sync_cutoff : users_synced_since_cutoff = set ( base_query . filter ( date__gt = sync_cutoff ) . distinct ( ) ) return list ( users_synced_in_window - users_synced_since_cutoff ) return list ( users_synced_in_window )