Simplified CLI interface to use only HTML outputs
This commit is contained in:
parent
b738126bf3
commit
c517878126
@ -185,7 +185,7 @@ class BatchWorker:
|
|||||||
self.l.debug('Using HTML result files for result extraction: %s', htmlResultFiles)
|
self.l.debug('Using HTML result files for result extraction: %s', htmlResultFiles)
|
||||||
|
|
||||||
worker = solo_turnier.worker.Worker()
|
worker = solo_turnier.worker.Worker()
|
||||||
importedData = worker.collectAllData(htmlCandidatesPreview, self.config.importCSVPath(), htmlResultFiles)
|
importedData = worker.collectAllData(htmlCandidatesPreview, htmlResultFiles)
|
||||||
combinedData = worker.combineData(importedData)
|
combinedData = worker.combineData(importedData)
|
||||||
|
|
||||||
consoleOutputtter = solo_turnier.output.ConsoleOutputter()
|
consoleOutputtter = solo_turnier.output.ConsoleOutputter()
|
||||||
|
@ -8,8 +8,7 @@ class Cli:
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--gui', help='Show the GUI', action='store_true')
|
parser.add_argument('--gui', help='Show the GUI', action='store_true')
|
||||||
|
|
||||||
parser.add_argument('-i', '--import-from', help='Set the path to load the TopTurnier exports from', nargs=1, default=['allresults.csv'])
|
parser.add_argument('html', help='The path from where to look for HTML export files', nargs=1, default=['.'])
|
||||||
parser.add_argument('-p', '--html-path', help='The path from where to look for HTML export files', nargs=1, default=['.'])
|
|
||||||
parser.add_argument('-o', '--output', help='Set the output path of the script', nargs=1, default=[None])
|
parser.add_argument('-o', '--output', help='Set the output path of the script', nargs=1, default=[None])
|
||||||
|
|
||||||
parser.add_argument('-v', '--verbose', help='Increase verbosity', action='count', default=0)
|
parser.add_argument('-v', '--verbose', help='Increase verbosity', action='count', default=0)
|
||||||
@ -34,7 +33,7 @@ class Cli:
|
|||||||
return self.__args.gui
|
return self.__args.gui
|
||||||
|
|
||||||
def importHtmlPath(self):
|
def importHtmlPath(self):
|
||||||
return self.__args.html_path[0]
|
return self.__args.html[0]
|
||||||
|
|
||||||
def importCSVPath(self):
|
def importCSVPath(self):
|
||||||
return self.__args.import_from[0]
|
return self.__args.import_from[0]
|
||||||
|
@ -213,11 +213,9 @@ class State4:
|
|||||||
class State3:
|
class State3:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
csvRows: list[CSVResultRow],
|
|
||||||
previewImport: HtmlPreviewImport,
|
previewImport: HtmlPreviewImport,
|
||||||
htmlResults: HtmlCompetitionTotalResults
|
htmlResults: HtmlCompetitionTotalResults
|
||||||
):
|
):
|
||||||
self.csvRows = csvRows
|
|
||||||
self.previewImport = previewImport
|
self.previewImport = previewImport
|
||||||
self.htmlResults = htmlResults
|
self.htmlResults = htmlResults
|
||||||
|
|
||||||
|
@ -396,7 +396,6 @@ class Worker:
|
|||||||
def collectAllData(
|
def collectAllData(
|
||||||
self,
|
self,
|
||||||
htmlCandidatesPreview: list[str],
|
htmlCandidatesPreview: list[str],
|
||||||
csvFile: str,
|
|
||||||
htmlResultsFileNames: list[str]
|
htmlResultsFileNames: list[str]
|
||||||
) -> types.State3:
|
) -> types.State3:
|
||||||
|
|
||||||
@ -410,16 +409,12 @@ class Worker:
|
|||||||
self.l.debug('Total preview imported participants: %s', pformat(previewImport.participants))
|
self.l.debug('Total preview imported participants: %s', pformat(previewImport.participants))
|
||||||
self.l.log(5, 'Total preview results: %s', pformat(previewImport.results))
|
self.l.log(5, 'Total preview results: %s', pformat(previewImport.results))
|
||||||
|
|
||||||
csvReader = solo_turnier.reader.CSVResultReader(csvFile)
|
|
||||||
self.l.info('Loading the total result CSV file %s', csvFile)
|
|
||||||
csvRows = csvReader.extractResult()
|
|
||||||
|
|
||||||
resultExtractor = ResultExtractor()
|
resultExtractor = ResultExtractor()
|
||||||
resultParsers = resultExtractor.getAllParsers(htmlResultsFileNames)
|
resultParsers = resultExtractor.getAllParsers(htmlResultsFileNames)
|
||||||
htmlResults = resultExtractor.extractAllData(resultParsers)
|
htmlResults = resultExtractor.extractAllData(resultParsers)
|
||||||
self.l.info('Overall result data extracted: %s', pformat(htmlResults.results))
|
self.l.info('Overall result data extracted: %s', pformat(htmlResults.results))
|
||||||
|
|
||||||
return types.State3(csvRows, previewImport, htmlResults)
|
return types.State3(previewImport, htmlResults)
|
||||||
|
|
||||||
def combineData(self, importedData: types.State3):
|
def combineData(self, importedData: types.State3):
|
||||||
self.l.info('Starting to build data sets.')
|
self.l.info('Starting to build data sets.')
|
||||||
@ -448,9 +443,9 @@ class Worker:
|
|||||||
self.l.log(5, 'Obtained result %s', resultsOfParticipant)
|
self.l.log(5, 'Obtained result %s', resultsOfParticipant)
|
||||||
results[participant] = resultsOfParticipant
|
results[participant] = resultsOfParticipant
|
||||||
|
|
||||||
self.l.log(5, 'Result before native fixing: %s', pformat(results))
|
self.l.log(5, 'Result before native fixing: %s', (results))
|
||||||
self._fixNativePlaces(dances, results)
|
self._fixNativePlaces(dances, results)
|
||||||
self.l.log(5, 'Result after native fixing: %s', pformat(results))
|
# self.l.log(5, 'Result after native fixing: %s', pformat(results))
|
||||||
|
|
||||||
|
|
||||||
totalResult[group] = types.TotalGroupResult(dances, results)
|
totalResult[group] = types.TotalGroupResult(dances, results)
|
||||||
@ -562,7 +557,7 @@ class Worker:
|
|||||||
if danceResult is None:
|
if danceResult is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.l.log(5, 'Result of dance: %s', danceResult)
|
# self.l.log(5, 'Result of dance: %s', danceResult)
|
||||||
|
|
||||||
if classParser.isABetterThanB(danceResult.nativeClass, class_):
|
if classParser.isABetterThanB(danceResult.nativeClass, class_):
|
||||||
# self.l.log(5, 'Skipping %s as the native class is higher', participant)
|
# self.l.log(5, 'Skipping %s as the native class is higher', participant)
|
||||||
@ -571,7 +566,7 @@ class Worker:
|
|||||||
remainingParticipants.append((danceResult.place, participant.id, participant))
|
remainingParticipants.append((danceResult.place, participant.id, participant))
|
||||||
|
|
||||||
remainingParticipants.sort()
|
remainingParticipants.sort()
|
||||||
self.l.log(5, 'Remaining participants %s', remainingParticipants)
|
# self.l.log(5, 'Remaining participants %s', remainingParticipants)
|
||||||
|
|
||||||
def getAllParticipantsWithSamePlace():
|
def getAllParticipantsWithSamePlace():
|
||||||
first = remainingParticipants.pop(0)
|
first = remainingParticipants.pop(0)
|
||||||
@ -599,10 +594,6 @@ class Worker:
|
|||||||
samePlaced = getAllParticipantsWithSamePlace()
|
samePlaced = getAllParticipantsWithSamePlace()
|
||||||
place = updateNativePlaces(samePlaced, place)
|
place = updateNativePlaces(samePlaced, place)
|
||||||
|
|
||||||
self.l.log(5, '(Partially) fixed places: %s', pformat(data))
|
# self.l.log(5, '(Partially) fixed places: %s', (data))
|
||||||
|
|
||||||
# firstEntry = remainingParticipants[0]
|
|
||||||
# numEntries = places.count(firstEntry[0])
|
|
||||||
# placeTo = place + numEntries - 1
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user