zusätzlich zu self.countriesByBatchcodeBeforeDeletion auch noch mit dem Ergebnis von CountriesByBatchcodeProvider.getCountriesByClickedBatchcode() mergen.

This commit is contained in:
frankknoll
2023-05-30 00:40:09 +02:00
parent cd4b21eda4
commit 7c529bb9b7
67 changed files with 145 additions and 263 deletions

View File

@@ -1,5 +1,5 @@
from CountriesMerger import CountriesMerger
from CountriesByBatchcodeProvider import getCountriesByBatchcodeBeforeDeletion
from CountriesByBatchcodeProvider import getCountriesByBatchcodeBeforeDeletion, getCountriesByClickedBatchcode
from BatchCodeTableFactory import BatchCodeTableFactory
class BatchCodeTableHavingGuessedCountriesFactory:
@@ -7,6 +7,7 @@ class BatchCodeTableHavingGuessedCountriesFactory:
def __init__(self, batchCodeTableFactoryDelegate):
self.batchCodeTableFactoryDelegate = batchCodeTableFactoryDelegate
self.countriesByBatchcodeBeforeDeletion = getCountriesByBatchcodeBeforeDeletion()
self.countriesByClickedBatchcode = getCountriesByClickedBatchcode()
def createGlobalBatchCodeTable(self, countriesAsList = False):
batchCodeTable = self.batchCodeTableFactoryDelegate.createGlobalBatchCodeTable(countriesAsList = True)
@@ -19,8 +20,13 @@ class BatchCodeTableHavingGuessedCountriesFactory:
return batchCodeTable
def _guessCountries(self, batchCodeTable, countriesAsList):
batchCodeTable['Countries'] = CountriesMerger.mergeSrcIntoDst(
dst = batchCodeTable['Countries'],
# FK-TODO: zusätzlich zu self.countriesByBatchcodeBeforeDeletion auch noch mit dem Ergebnis der noch zu implementierenden Funktion CountriesByBatchcodeProvider.getCountriesByClickedBatchcode() mergen.
src = self.countriesByBatchcodeBeforeDeletion['Countries'])
self._mergeCountriesOfSrcIntoDst(
dst = batchCodeTable,
src = self.countriesByBatchcodeBeforeDeletion)
self._mergeCountriesOfSrcIntoDst(
dst = batchCodeTable,
src = self.countriesByClickedBatchcode)
BatchCodeTableFactory._convertCountries(batchCodeTable, countriesAsList)
def _mergeCountriesOfSrcIntoDst(self, dst, src):
dst['Countries'] = CountriesMerger.mergeSrcIntoDst(dst = dst['Countries'], src = src['Countries'])