# -*- coding: utf-8 -*-

from ppms.migration import SQLPacket, MaxVersionDependency, PacketCategory


class ChangeDisplayRecordsMessage(SQLPacket):
    '''Change status bar message which displays the number of found records to include non-visible records, too'''
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 12982

    UPDATE_MESSAGE = """UPDATE DT435 SET DI001549 = 'Anzahl Datensätze: %d (%d verarbeitet)' WHERE DI001538 = 6279 AND DI001550 = 'DE'"""

    def get_dependencies(self):
        return (MaxVersionDependency('39.5.6'), )

    def fix(self, runner):
        if self.modify_and_log(self.UPDATE_MESSAGE):
            return self.success()

        return self.fail()