예제 #1
0
    def csv_fox_tournament(self,
                           tournament,
                           games_download=False,
                           stats_download=False):
        fox_manager = csvWriter.FoxGamesManager(tournament)
        if games_download:
            fox_manager.download_games_html()
        fox_manager.get_fox_games()
        if stats_download:
            fox_manager.download_statistics_html()
        fox_manager.get_csv_statistics()

        writer = csvWriter.CsvWriter(tournament, False)
        writer.delete_filename_path()
        writer.write_csv(fox_manager.get_fox_games())
        self.assertTrue(os.path.isfile(writer.get_filename_path()))

        reader = csvReader.CsvReader(csvReader.CsvReader.TOURNAMENT)
        reader.read_file(writer.get_filename_path())

        writer = csvWriter.CsvWriter(tournament, True)
        writer.delete_filename_path()
        writer.write_csv(fox_manager.get_csv_statistics())
        self.assertTrue(os.path.isfile(writer.get_filename_path()))

        reader = csvReader.CsvReader(csvReader.CsvReader.NTS_STATISTIC)
        reader.read_file(writer.get_filename_path())
예제 #2
0
 def test_nts_2016(self):
     file_path = "./player/data_files/csv/TGames_NTS_2016_MXO.csv"
     reader = csvReader.CsvReader(csvReader.CsvReader.TOURNAMENT)
     reader.read_file(file_path)
     file_path = "./player/data_files/csv/NTS-2016-player-statistics.csv"
     reader = csvReader.CsvReader(csvReader.CsvReader.NTS_STATISTIC)
     reader.read_file(file_path)
예제 #3
0
 def Atest_NTS_stats(self):
     management.call_command('loaddata',
                             './player/data_files/player.dumpdata.json',
                             verbosity=0)
     filename = csvdata.CSV_FILES + 'NTS-player-statistics.csv'
     reader = csvReader.CsvReader(csvReader.CsvReader.NTS_STATISTIC)
     reader.read_file(filename)
예제 #4
0
    def _test_fit_stats_Euros_2014(self, tournament):
        csvWriter.FitGamesManager.download_stats_html()
        manager = csvWriter.FitGamesManager(tournament)
        stats = manager.get_csv_stats()

        writer = csvWriter.CsvWriter(tournament, True, True)
        writer.delete_filename_path()
        writer.write_csv(stats)
        reader = csvReader.CsvReader(csvReader.CsvReader.FIT_STATISTIC)
        reader.read_file(writer.get_filename_path())
예제 #5
0
    def csv_fit_euros_2016_stats(self, tournament, download=False):
        manager = csvWriter.FitGamesManager(tournament)
        manager.get_fit_games()
        stats = manager.get_csv_stats_euros_2016(download)

        writer = csvWriter.CsvWriter(tournament, True, True)
        writer.delete_filename_path()
        writer.write_csv(stats)

        reader = csvReader.CsvReader(csvReader.CsvReader.NTS_STATISTIC)
        reader.read_file(writer.get_filename_path())
예제 #6
0
    def csv_fit_tournament(self, tournament, download=False):
        manager = csvWriter.FitGamesManager(tournament)
        if download:
            manager.download_games_html()

        writer = csvWriter.CsvWriter(tournament, False, True)
        writer.delete_filename_path()
        writer.write_csv(manager.get_fit_games())

        reader = csvReader.CsvReader(csvReader.CsvReader.TOURNAMENT)
        reader.read_file(writer.get_filename_path())
예제 #7
0
    def handle(self, *args, **options):
        csv_type = options['type']
        file_path = options['file_path'][0]

        self.stdout.write(self.style.SUCCESS('Read csv file: "%s"' %
                                             file_path))

        if csv_type == 'stats_game':
            reader = csvReader.CsvReader(csvReader.CsvReader.NTS_STATISTIC)
            reader.read_file(file_path)
        elif csv_type == 'stats_tournament':
            reader = csvReader.CsvReader(csvReader.CsvReader.FIT_STATISTIC)
            reader.read_file(file_path)
        elif csv_type == 'games':
            reader = csvReader.CsvReader(csvReader.CsvReader.TOURNAMENT)
            reader.read_file(file_path)
        elif csv_type == 'padel':
            reader = csvReader.CsvReader(csvReader.CsvReader.PADEL_GAME)
            reader.read_file(file_path)
        elif csv_type == 'phases':
            reader = csvReader.CsvReader(csvReader.CsvReader.PHASE)
            reader.read_file(file_path)
        elif csv_type == 'person':
            reader = csvReader.CsvReader(csvReader.CsvReader.PERSON)
            reader.read_file(file_path)
        else:
            raise Exception('Argument %s not supported.' % csv_type)

        self.stdout.write(
            self.style.SUCCESS('Successfully read csv file: "%s"' % file_path))
예제 #8
0
 def test_padel_results_2016(self):
     file = './player/data_files/csv/Padel_Tournament_Results.csv'
     reader = csvReader.CsvReader(csvReader.CsvReader.PADEL_GAME)
     reader.read_file(file)
예제 #9
0
 def test_padel_hamburg_2016(self):
     file = './player/data_files/csv/PADEL_HAMBURG_2016.csv'
     reader = csvReader.CsvReader(csvReader.CsvReader.PADEL_GAME)
     reader.read_file(file)
예제 #10
0
 def setUp(self):
     # pass
     reader = csvReader.CsvReader(csvReader.CsvReader.PHASE)
     reader.read_file('./player/data_files/csv/TPhases.csv')