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)
|
||||
|
||||
worker = solo_turnier.worker.Worker()
|
||||
importedData = worker.collectAllData(htmlCandidatesPreview, self.config.importCSVPath(), htmlResultFiles)
|
||||
importedData = worker.collectAllData(htmlCandidatesPreview, htmlResultFiles)
|
||||
combinedData = worker.combineData(importedData)
|
||||
|
||||
consoleOutputtter = solo_turnier.output.ConsoleOutputter()
|
||||
|
@ -8,8 +8,7 @@ class Cli:
|
||||
parser = argparse.ArgumentParser()
|
||||
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('-p', '--html-path', help='The path from where to look for HTML export files', nargs=1, default=['.'])
|
||||
parser.add_argument('html', 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('-v', '--verbose', help='Increase verbosity', action='count', default=0)
|
||||
@ -34,7 +33,7 @@ class Cli:
|
||||
return self.__args.gui
|
||||
|
||||
def importHtmlPath(self):
|
||||
return self.__args.html_path[0]
|
||||
return self.__args.html[0]
|
||||
|
||||
def importCSVPath(self):
|
||||
return self.__args.import_from[0]
|
||||
|
@ -213,11 +213,9 @@ class State4:
|
||||
class State3:
|
||||
def __init__(
|
||||
self,
|
||||
csvRows: list[CSVResultRow],
|
||||
previewImport: HtmlPreviewImport,
|
||||
htmlResults: HtmlCompetitionTotalResults
|
||||
):
|
||||
self.csvRows = csvRows
|
||||
self.previewImport = previewImport
|
||||
self.htmlResults = htmlResults
|
||||
|
||||
|
@ -396,7 +396,6 @@ class Worker:
|
||||
def collectAllData(
|
||||
self,
|
||||
htmlCandidatesPreview: list[str],
|
||||
csvFile: str,
|
||||
htmlResultsFileNames: list[str]
|
||||
) -> types.State3:
|
||||
|
||||
@ -410,16 +409,12 @@ class Worker:
|
||||
self.l.debug('Total preview imported participants: %s', pformat(previewImport.participants))
|
||||
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()
|
||||
resultParsers = resultExtractor.getAllParsers(htmlResultsFileNames)
|
||||
htmlResults = resultExtractor.extractAllData(resultParsers)
|
||||
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):
|
||||
self.l.info('Starting to build data sets.')
|
||||
@ -448,9 +443,9 @@ class Worker:
|
||||
self.l.log(5, 'Obtained result %s', 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.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)
|
||||
@ -562,7 +557,7 @@ class Worker:
|
||||
if danceResult is None:
|
||||
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_):
|
||||
# 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.sort()
|
||||
self.l.log(5, 'Remaining participants %s', remainingParticipants)
|
||||
# self.l.log(5, 'Remaining participants %s', remainingParticipants)
|
||||
|
||||
def getAllParticipantsWithSamePlace():
|
||||
first = remainingParticipants.pop(0)
|
||||
@ -599,10 +594,6 @@ class Worker:
|
||||
samePlaced = getAllParticipantsWithSamePlace()
|
||||
place = updateNativePlaces(samePlaced, place)
|
||||
|
||||
self.l.log(5, '(Partially) fixed places: %s', pformat(data))
|
||||
|
||||
# firstEntry = remainingParticipants[0]
|
||||
# numEntries = places.count(firstEntry[0])
|
||||
# placeTo = place + numEntries - 1
|
||||
# self.l.log(5, '(Partially) fixed places: %s', (data))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user