forked from fzls/djc_helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_usage.py
38 lines (30 loc) · 1.73 KB
/
show_usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from usage_count import *
from util import *
from version import *
global_usage_counter_name = "global_count"
this_version_global_usage_counter_name = f"version/ver{now_version} {ver_time}"
user_usage_counter_name_prefix = "user_count"
my_usage_counter_name = f"{user_usage_counter_name_prefix}/{get_uuid()}"
this_version_user_usage_prefix = f"version_user_usage/{now_version}"
this_version_my_usage_counter_name = f"{this_version_user_usage_prefix}/{get_uuid()}"
def show_usage():
show_head_line("从2020-10-26至今小助手使用情况概览", color("fg_bold_yellow"))
last_n_days = get_last_n_days(14)
extra_time_periods = [*time_periods, *last_n_days]
extra_time_periods_desc = [*time_periods_desc, *last_n_days]
heads = ["计数对象", *extra_time_periods_desc]
colSizes = [20, *[8 for _ in extra_time_periods_desc]]
rows = [
["本机使用次数", *[get_count(my_usage_counter_name, period) for period in extra_time_periods]],
# ["当前版本总计使用数", *[get_count(this_version_global_usage_counter_name, period) for period in extra_time_periods]],
# ["所有版本总计使用数", *[get_count(global_usage_counter_name, period) for period in extra_time_periods]],
# ["当前版本活跃用户数", *[get_record_count_name_start_with(this_version_user_usage_prefix, period) for period in extra_time_periods]],
["所有版本活跃用户数", *[get_record_count_name_start_with(user_usage_counter_name_prefix, period) for period in extra_time_periods]],
]
logger.info(tableify(heads, colSizes))
for row in rows:
logger.info(color("fg_bold_cyan") + tableify(row, colSizes))
if __name__ == '__main__':
maximize_console()
show_usage()
os.system("PAUSE")