diff options
-rw-r--r-- | main.py | 3 | ||||
-rw-r--r-- | wikibania/ban/Ban.py | 2 |
2 files changed, 2 insertions, 3 deletions
@@ -49,8 +49,7 @@ ban_db_wrapper = BanDBWrapper(ban_db) | |||
49 | # HISTOGRAM | 49 | # HISTOGRAM |
50 | 50 | ||
51 | ban_durations = ban_db_wrapper.get_all_durations() | 51 | ban_durations = ban_db_wrapper.get_all_durations() |
52 | duration_bins = [round(365 / 12 * x) for x in range(1, 50 + 2)] | 52 | (ban_durations_bars, bins) = np.histogram(ban_durations, bins=range(1, 50 + 2)) |
53 | (ban_durations_bars, bins) = np.histogram(ban_durations, bins=duration_bins) | ||
54 | 53 | ||
55 | bar_chart = pygal.Bar(legend_at_bottom=True) | 54 | bar_chart = pygal.Bar(legend_at_bottom=True) |
56 | bar_chart.title = "Active Wikipedia bans by duration (%d samples)" % len(ban_db.list()) | 55 | bar_chart.title = "Active Wikipedia bans by duration (%d samples)" % len(ban_db.list()) |
diff --git a/wikibania/ban/Ban.py b/wikibania/ban/Ban.py index e06ca89..c6a55b4 100644 --- a/wikibania/ban/Ban.py +++ b/wikibania/ban/Ban.py | |||
@@ -28,7 +28,7 @@ class Ban: | |||
28 | self.expiry = datetime.strptime(ban_dict["expiry"], ISO_TIMESTAMP) | 28 | self.expiry = datetime.strptime(ban_dict["expiry"], ISO_TIMESTAMP) |
29 | 29 | ||
30 | def calc_duration(self): | 30 | def calc_duration(self): |
31 | return (self.expiry - self.timestamp).days | 31 | return (self.expiry - self.timestamp).days / round(365 / 12) |
32 | 32 | ||
33 | def lookup_country_code(self): | 33 | def lookup_country_code(self): |
34 | try: | 34 | try: |