Ejemplo n.º 1
0
def daily_sync():
    start_date = VisionSyncInfo.get_daily_sync_start_date()
    end_date = VisionSyncInfo.get_daily_sync_end_date()
    if start_date:
        logger.info('daily sync. start_date=%s, end_date=%s' % (start_date, end_date))
        sync_record = VisionSyncInfo.new_instance(True, start_date, end_date)
        sync(sync_record, format_date(start_date), format_date(end_date))
Ejemplo n.º 2
0
def daily_sync():
    start_date = VisionSyncInfo.get_daily_sync_start_date()
    end_date = VisionSyncInfo.get_daily_sync_end_date()
    if start_date:
        logger.info('daily sync. start_date=%s, end_date=%s' %
                    (start_date, end_date))
        sync_record = VisionSyncInfo.new_instance(True, start_date, end_date)
        sync(sync_record, format_date(start_date), format_date(end_date))
Ejemplo n.º 3
0
def on_pre_save_system_settings(sender, **kwargs):
    new_sync_start_date = kwargs['instance'].sync_start_date
    new_sync_end_date = kwargs['instance'].sync_end_date

    if new_sync_start_date and new_sync_end_date and new_sync_start_date < new_sync_end_date:
        logger.info('manual sync. start_date=%s, end_date=%s' % (new_sync_start_date, new_sync_end_date))
        sync_record = VisionSyncInfo.new_instance(False, new_sync_start_date, new_sync_end_date)
        run.apply_async(args=[sync_record, format_date(new_sync_start_date), format_date(new_sync_end_date)])
Ejemplo n.º 4
0
def resync_if_manual_sync_fail():
    start_date = VisionSyncInfo.get_manual_sync_start_date()
    end_date = VisionSyncInfo.get_manual_sync_end_date()
    if start_date and VisionSyncInfo.get_last_manual_sync_status() == VisionSyncInfo.STATUS.FAILURE:
        logger.info('resync as manual sync failed. start_date=%s, end_date=%s' % (start_date, end_date))
        sync_record = VisionSyncInfo.new_instance(False, start_date, end_date)
        sync(sync_record, format_date(start_date), format_date(end_date))
        return True
    return False
Ejemplo n.º 5
0
def on_pre_save_system_settings(sender, **kwargs):
    start_date = VisionSyncInfo.get_manual_sync_start_date()
    end_date = VisionSyncInfo.get_manual_sync_end_date()
    new_sync_date = kwargs["instance"].sync_start_date

    if new_sync_date and new_sync_date < datetime.date.today() and (not start_date or new_sync_date < start_date):
        logger.info("manual sync. start_date=%s, end_date=%s" % (new_sync_date, end_date))
        sync_record = VisionSyncInfo.new_instance(False, new_sync_date, end_date)
        run.apply_async(args=[sync_record, format_date(new_sync_date), format_date(end_date)])
Ejemplo n.º 6
0
def resync_if_manual_sync_fail():
    start_date = VisionSyncInfo.get_manual_sync_start_date()
    end_date = VisionSyncInfo.get_manual_sync_end_date()
    if start_date and VisionSyncInfo.get_last_manual_sync_status(
    ) == VisionSyncInfo.STATUS.FAILURE:
        logger.info(
            'resync as manual sync failed. start_date=%s, end_date=%s' %
            (start_date, end_date))
        sync_record = VisionSyncInfo.new_instance(False, start_date, end_date)
        sync(sync_record, format_date(start_date), format_date(end_date))
        return True
    return False
Ejemplo n.º 7
0
def on_pre_save_system_settings(sender, **kwargs):
    start_date = VisionSyncInfo.get_manual_sync_start_date()
    end_date = VisionSyncInfo.get_manual_sync_end_date()
    new_sync_date = kwargs['instance'].sync_start_date

    if new_sync_date and new_sync_date < datetime.date.today() and (
            not start_date or new_sync_date < start_date):
        logger.info('manual sync. start_date=%s, end_date=%s' %
                    (new_sync_date, end_date))
        sync_record = VisionSyncInfo.new_instance(False, new_sync_date,
                                                  end_date)
        run.apply_async(args=[
            sync_record,
            format_date(new_sync_date),
            format_date(end_date)
        ])
Ejemplo n.º 8
0
    def test_should_get_formatted_date(self):
        date = datetime.date(2016, 3, 14)

        self.assertEqual(format_date(date), '14032016')
Ejemplo n.º 9
0
    def test_should_get_formatted_date(self):
        date = datetime.date(2016, 3, 14)

        self.assertEqual(format_date(date), "14032016")