# -*- coding: utf-8 -*-
from ppms.migration.packet import *

class FixValueRange057914(ChangeDTPPacket):
    '''Fix wrong DI in value range of DI057914.'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 10400

    def fix(self, runner):
        OLD_VAL = 'DI026215<=ATOI(@G296)'
        NEW_VAL = 'DI057914<=ATOI(@G296)'

        record = self.get_record(412, ['057914'], [27352])
        if not self.change_value(record, 'valuerange', OLD_VAL, NEW_VAL):
            return self.fail()

        return self.success()
