|
@@ -11,6 +11,7 @@ from datetime import datetime, timezone, timedelta
|
|
|
from applications import DeNetMysql, PQMySQL, longArticlesMySQL, bot
|
|
|
|
|
|
STATISTICS_PERIOD = 31 * 24 * 60 * 60
|
|
|
+ONE_DAY_IN_SECONDS = 60 * 60 * 24
|
|
|
|
|
|
|
|
|
def float_to_percentage(value, decimals=3) -> str:
|
|
@@ -258,6 +259,9 @@ def update_single_day(dt, account_list, article_df, lam):
|
|
|
index_list = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
|
error_list = []
|
|
|
insert_error_list = []
|
|
|
+ update_timestamp = str_to_timestamp(dt)
|
|
|
+ # 因为计算均值的时候是第二天,所以需要把时间前移一天
|
|
|
+ avg_date = timestamp_to_str(update_timestamp - ONE_DAY_IN_SECONDS)
|
|
|
for account in tqdm(account_list):
|
|
|
for index in index_list:
|
|
|
avg_rate, max_time, min_time, articles_count = cal_avg_account_read_rate(article_df, account['gh_id'], index, dt)
|
|
@@ -293,7 +297,7 @@ def update_single_day(dt, account_list, article_df, lam):
|
|
|
articles_count,
|
|
|
timestamp_to_str(min_time),
|
|
|
timestamp_to_str(max_time),
|
|
|
- dt.replace("-", ""),
|
|
|
+ avg_date.replace("-", ""),
|
|
|
0
|
|
|
)
|
|
|
)
|