forked from shirof1re/OpenDocPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_activity.py
30 lines (23 loc) · 935 Bytes
/
update_activity.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
import json
try:
with open("data/excel/activity_table.json", encoding="utf-8") as f:
activity_table = json.load(f)
activity_start_time_list = []
for i in activity_table["basicInfo"]:
if i.endswith("side"):
startTime = activity_table["basicInfo"][i]["startTime"]
endTime = activity_table["basicInfo"][i]["endTime"]
activity_start_time_list.append((startTime, endTime))
max_activity_start_time, max_activity_end_time = max(
activity_start_time_list, key=lambda k: k[0]
)
with open("config/config.json") as f:
config = json.load(f)
config["userConfig"]["activityMinStartTs"] = max_activity_start_time - \
(7*24*60*60)
config["userConfig"]["activityMaxStartTs"] = max_activity_end_time + \
(7*24*60*60)
with open("config/config.json", "w") as f:
json.dump(config, f, indent=4)
except Exception:
pass