Skip to content

Commit

Permalink
Merge pull request #18 from Galarzaa90/dev
Browse files Browse the repository at this point in the history
Fixed kill statistics race stats being inverted
  • Loading branch information
Galarzaa90 authored Aug 17, 2019
2 parents a814a29 + 9f93a5d commit 59350e5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Changelog
Due to this library relying on external content, older versions are not guaranteed to work.
Try to always use the latest version.

.. _v2.2.2:

2.2.2 (2019-08-17)
==================

- Fixed killed by players and palyers kill stats being inverted for ``KillStatistics``

.. _v2.2.1:

2.2.1 (2019-08-10)
Expand Down
7 changes: 7 additions & 0 deletions tests/tests_kill_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def test_kill_statistics_from_content(self):
self.assertEqual(kill_statistics.players.last_week_killed, 7)
self.assertEqual(kill_statistics.players.last_week_killed, kill_statistics.players.last_week_players_killed)

# demons
demons_entry = kill_statistics.entries["demons"]
self.assertEqual(2071, demons_entry.last_day_killed)
self.assertEqual(1, demons_entry.last_day_players_killed)
self.assertEqual(18484, demons_entry.last_week_killed)
self.assertEqual(8, demons_entry.last_week_players_killed)

def test_kill_statistics_from_content_empty(self):
"""Testing parsing empty kill statistics"""
content = self._load_resource(FILE_KILL_STATISTICS_EMPTY)
Expand Down
6 changes: 4 additions & 2 deletions tibiapy/kill_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ def from_content(cls, content):
for i, row in enumerate(rows):
columns_raw = row.find_all('td')
columns = [c.text.replace('\xa0', ' ').strip() for c in columns_raw]
entry = RaceEntry(last_day_killed=int(columns[1]), last_day_players_killed=int(columns[2]),
last_week_killed=int(columns[3]), last_week_players_killed=int(columns[4]))
entry = RaceEntry(last_day_players_killed=int(columns[1]),
last_day_killed=int(columns[2]),
last_week_players_killed=int(columns[3]),
last_week_killed=int(columns[4]), )
if i == len(rows) - 1:
total = entry
else:
Expand Down

0 comments on commit 59350e5

Please sign in to comment.