Skip to content

Commit 9f93a5d

Browse files
committed
Fixed kill statistics race stats being inverted
1 parent a814a29 commit 9f93a5d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Changelog
66
Due to this library relying on external content, older versions are not guaranteed to work.
77
Try to always use the latest version.
88

9+
.. _v2.2.2:
10+
11+
2.2.2 (2019-08-17)
12+
==================
13+
14+
- Fixed killed by players and palyers kill stats being inverted for ``KillStatistics``
15+
916
.. _v2.2.1:
1017

1118
2.2.1 (2019-08-10)

tests/tests_kill_statistics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ def test_kill_statistics_from_content(self):
2626
self.assertEqual(kill_statistics.players.last_week_killed, 7)
2727
self.assertEqual(kill_statistics.players.last_week_killed, kill_statistics.players.last_week_players_killed)
2828

29+
# demons
30+
demons_entry = kill_statistics.entries["demons"]
31+
self.assertEqual(2071, demons_entry.last_day_killed)
32+
self.assertEqual(1, demons_entry.last_day_players_killed)
33+
self.assertEqual(18484, demons_entry.last_week_killed)
34+
self.assertEqual(8, demons_entry.last_week_players_killed)
35+
2936
def test_kill_statistics_from_content_empty(self):
3037
"""Testing parsing empty kill statistics"""
3138
content = self._load_resource(FILE_KILL_STATISTICS_EMPTY)

tibiapy/kill_statistics.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ def from_content(cls, content):
9292
for i, row in enumerate(rows):
9393
columns_raw = row.find_all('td')
9494
columns = [c.text.replace('\xa0', ' ').strip() for c in columns_raw]
95-
entry = RaceEntry(last_day_killed=int(columns[1]), last_day_players_killed=int(columns[2]),
96-
last_week_killed=int(columns[3]), last_week_players_killed=int(columns[4]))
95+
entry = RaceEntry(last_day_players_killed=int(columns[1]),
96+
last_day_killed=int(columns[2]),
97+
last_week_players_killed=int(columns[3]),
98+
last_week_killed=int(columns[4]), )
9799
if i == len(rows) - 1:
98100
total = entry
99101
else:

0 commit comments

Comments
 (0)