(restore_state, report_configs)
return configs_to_sync, extra_configs_on_phone
Filter out any UCRs that are already synced. This can't exist in V1,
        because in V1 we send all reports as one fixture.

        Returns a list of full ReportConfigs to sync and a set of report ids to purge
Filter out any UCRs that are already synced. This can't exist in V1,
        because in V1 we send all reports as one fixture.
Filter out any UCRs that are already synced . This can t exist in V1 because in V1 we send all reports as one fixture .
def _relevant_report_configs(restore_state, report_configs):
        """
        Filter out any UCRs that are already synced. This can't exist in V1,
        because in V1 we send all reports as one fixture.

        Returns a list of full ReportConfigs to sync and a set of report ids to purge
        """
        last_sync_log = restore_state.last_sync_log

        if not last_sync_log or restore_state.overwrite_cache:
            return report_configs, []

        current_sync_log = restore_state.current_sync_log
        now = _utcnow()

        last_ucr_syncs = {
            log.report_uuid: log.datetime
            for log in last_sync_log.last_ucr_sync_times
        }
        configs_to_sync = []

        for config in report_configs:
            if config.uuid not in last_ucr_syncs:
                configs_to_sync.append(config)
                current_sync_log.last_ucr_sync_times.append(
                    UCRSyncLog(report_uuid=config.uuid, datetime=now)
                )
                continue

            last_sync = last_ucr_syncs[config.uuid]
            next_sync = last_sync + timedelta(hours=float(config.sync_delay))

            if now > next_sync:
                configs_to_sync.append(config)
                current_sync_log.last_ucr_sync_times.append(
                    UCRSyncLog(report_uuid=config.uuid, datetime=now)
                )
            else:
                current_sync_log.last_ucr_sync_times.append(
                    UCRSyncLog(report_uuid=config.uuid, datetime=last_sync)
                )

        config_uuids = {config.uuid for config in report_configs}
        extra_configs_on_phone = set(last_ucr_syncs.keys()).difference(config_uuids)

        return configs_to_sync, extra_configs_on_phone
def _relevant_report_configs ( restore_state , report_configs ) : last_sync_log = restore_state . last_sync_log if not last_sync_log or restore_state . overwrite_cache : return report_configs , [ ] current_sync_log = restore_state . current_sync_log now = _utcnow ( ) last_ucr_syncs = { log . report_uuid : log . datetime for log in last_sync_log . last_ucr_sync_times } configs_to_sync = [ ] for config in report_configs : if config . uuid not in last_ucr_syncs : configs_to_sync . append ( config ) current_sync_log . last_ucr_sync_times . append ( UCRSyncLog ( report_uuid = config . uuid , datetime = now ) ) continue last_sync = last_ucr_syncs [ config . uuid ] next_sync = last_sync + timedelta ( hours = float ( config . sync_delay ) ) if now > next_sync : configs_to_sync . append ( config ) current_sync_log . last_ucr_sync_times . append ( UCRSyncLog ( report_uuid = config . uuid , datetime = now ) ) else : current_sync_log . last_ucr_sync_times . append ( UCRSyncLog ( report_uuid = config . uuid , datetime = last_sync ) ) config_uuids = { config . uuid for config in report_configs } extra_configs_on_phone = set ( last_ucr_syncs . keys ( ) ) . difference ( config_uuids ) return configs_to_sync , extra_configs_on_phone