From 7baf404cfb4733c6512978dc011090fc0230744b Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 20 Feb 2018 22:59:19 +0100 Subject: Refactoring fetching tournament (teams, leaderboard link etc.) info --- jfr_playoff/matchinfo.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'jfr_playoff/matchinfo.py') diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py index 5aa9d82..e0994a8 100644 --- a/jfr_playoff/matchinfo.py +++ b/jfr_playoff/matchinfo.py @@ -7,6 +7,7 @@ from bs4 import BeautifulSoup as bs import jfr_playoff.sql as p_sql from jfr_playoff.dto import Match, Team +from jfr_playoff.tournamentinfo import TournamentInfo class MatchInfo: @@ -36,22 +37,12 @@ class MatchInfo: self.info.loser_matches = list(set(self.info.loser_matches)) self.info.teams = [] - def __get_link(self, suffix): - try: - row = self.database.fetch( - self.config['database'], p_sql.PREFIX, ()) - if row is not None: - if len(row) > 0: - return row[0] + suffix - except mysql.connector.Error: - return None - return None - def __fetch_match_link(self): if 'link' in self.config: self.info.link = self.config['link'] - elif 'round' in self.config: - self.info.link = self.__get_link( + elif ('round' in self.config) and ('database' in self.config): + event_info = TournamentInfo(self.config, self.database) + self.info.link = event_info.get_results_link( 'runda%d.html' % (self.config['round'])) def __get_predefined_scores(self): -- cgit v1.2.3