updating Countries column

This commit is contained in:
frankknoll
2023-04-02 10:37:19 +02:00
parent 0d55399a87
commit f76e3909f9
1028 changed files with 1124 additions and 1254 deletions

View File

@@ -0,0 +1,25 @@
from CountriesMerger import CountriesMerger
from CountriesByBatchcodeProvider import getCountriesByBatchcodeBeforeDeletion
from BatchCodeTableFactory import BatchCodeTableFactory
class BatchCodeTableHavingGuessedCountriesFactory:
def __init__(self, batchCodeTableFactoryDelegate):
self.batchCodeTableFactoryDelegate = batchCodeTableFactoryDelegate
self.countriesByBatchcodeBeforeDeletion = getCountriesByBatchcodeBeforeDeletion()
def createGlobalBatchCodeTable(self, countriesAsList = False):
batchCodeTable = self.batchCodeTableFactoryDelegate.createGlobalBatchCodeTable(countriesAsList = True)
self._guessCountries(batchCodeTable, countriesAsList)
return batchCodeTable
def createBatchCodeTableByCountry(self, country, countriesAsList = False):
batchCodeTable = self.batchCodeTableFactoryDelegate.createBatchCodeTableByCountry(country, countriesAsList = True)
self._guessCountries(batchCodeTable, countriesAsList)
return batchCodeTable
def _guessCountries(self, batchCodeTable, countriesAsList):
batchCodeTable['Countries'] = CountriesMerger.mergeSrcIntoDst(
dst = batchCodeTable['Countries'],
src = self.countriesByBatchcodeBeforeDeletion['Countries'])
BatchCodeTableFactory._convertCountries(batchCodeTable, countriesAsList)