Beispiel #1
0
 def print_h2h_fixtures(self, count=5, before=datetime.datetime.now()):
     print("H2H FIXTURES")
     last_h2h = self.get_h2h_fixtures(count, before)
     print(FixturesOperation.to_string(last_h2h))
     print(FixturesOperation.stats(last_h2h, self.home_team.team_id), '\n')
     print("H2H FIXTURES H/A")
     last_h_a_h2h = self.get_h2h_h_a_fixtures(count, before)
     print(FixturesOperation.to_string(last_h_a_h2h))
     print(FixturesOperation.stats(last_h_a_h2h, self.home_team.team_id))
Beispiel #2
0
def get_points_goals(fixtures, team_id):
    stats = FixturesOperation.stats(fixtures, team_id)
    matches = stats[0] + stats[1] + stats[2]
    if matches <= 0:
        return 0, 0
    return int(
        (stats[0] - stats[1]) * 100 / matches), int(stats[3] * 100 / matches)
Beispiel #3
0
def test_stats():
    f1 = Fixture(1, datetime.datetime(2015, 5, 3), 'end', 10, 'ABC', 30, 'XYZ',
                 Result(5, 1))

    f2 = Fixture(2, datetime.datetime(2016, 10, 20), 'end', 10, 'ABC', 15,
                 'XYZ', Result(4, 3))

    f3 = Fixture(3, datetime.datetime(2005, 8, 19), 'end', 10, 'ABC', 20,
                 'XYZ', Result(0, 0))

    f4 = Fixture(3, datetime.datetime(2005, 8, 19), 'end', 10, 'ABC', 20,
                 'XYZ', Result(0, 1))

    fixtures = [f3, f1, f2, f4]
    assert FixturesOperation.stats(fixtures, 10) == (2, 1, 1, 4)
Beispiel #4
0
 def print_away_fixtures(self, count=5, before=datetime.datetime.now()):
     print("AWAY FIXTURES:", self.name)
     fixtures = self.get_away_fixtures(count, before)
     print(FixturesOperation.to_string(fixtures))
     print(FixturesOperation.stats(fixtures, self.team_id))