diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-18 04:02:29 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-18 04:02:29 +0300 |
commit | ed74bb2602269771021bc9f41e29fbb3992c30e0 (patch) | |
tree | 67078bdf56d23d6d865df83fc058a49d798c2cc1 /vk/utils/tracking/online_periods.py | |
parent | group online periods by date/user/etc. (diff) | |
download | vk-scripts-ed74bb2602269771021bc9f41e29fbb3992c30e0.tar.gz vk-scripts-ed74bb2602269771021bc9f41e29fbb3992c30e0.zip |
"online periods" are called "online streaks" now
Diffstat (limited to '')
-rw-r--r-- | vk/utils/tracking/online_streaks.py (renamed from vk/utils/tracking/online_periods.py) | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vk/utils/tracking/online_periods.py b/vk/utils/tracking/online_streaks.py index 8bd2bda..7523750 100644 --- a/vk/utils/tracking/online_periods.py +++ b/vk/utils/tracking/online_streaks.py @@ -8,7 +8,7 @@ from datetime import timedelta from vk.user import User -class OnlinePeriodEnumerator(MutableMapping): +class OnlineStreakEnumerator(MutableMapping): def __init__(self): self._records = {} @@ -33,7 +33,7 @@ class OnlinePeriodEnumerator(MutableMapping): if period is not None: yield period - def duration_by_user(self, db_reader): + def group_by_user(self, db_reader): by_user = {} for user, time_from, time_to in self.enum(db_reader): if user not in by_user: @@ -41,7 +41,7 @@ class OnlinePeriodEnumerator(MutableMapping): by_user[user] += time_to - time_from return by_user - def duration_by_date(self, db_reader): + def group_by_date(self, db_reader): by_date = OrderedDict() for _, time_from, time_to in self.enum(db_reader): for date, duration in self._enum_dates_and_durations(time_from, time_to): @@ -50,7 +50,7 @@ class OnlinePeriodEnumerator(MutableMapping): by_date[date] += duration return by_date - def duration_by_weekday(self, db_reader): + def group_by_weekday(self, db_reader): by_weekday = OrderedDict() for weekday in range(7): by_weekday[weekday] = timedelta() |