diff options
author | emkael <emkael@tlen.pl> | 2018-02-20 22:59:19 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-02-20 22:59:19 +0100 |
commit | 7baf404cfb4733c6512978dc011090fc0230744b (patch) | |
tree | 5a54efd5784af9b340cac91d7158897829b5b960 /jfr_playoff/matchinfo.py | |
parent | a1e9d914e06891a38b18966abd0ce8d8663296ef (diff) |
Refactoring fetching tournament (teams, leaderboard link etc.) info
Diffstat (limited to 'jfr_playoff/matchinfo.py')
-rw-r--r-- | jfr_playoff/matchinfo.py | 17 |
1 files changed, 4 insertions, 13 deletions
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): |