-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolicy.py
96 lines (67 loc) · 3.07 KB
/
policy.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from datetime import date
from datetime import timedelta
"""
Last Finished Time : | Hardness | Problem Name | Tag | Failed Times | Solve Time |
"""
class arrangement():
def __init__(self,raw_data:dict) -> None:
self.raw_data = raw_data
self.calendar = dict()
for i in range(0,31):
today = date.today()
target_date = today + timedelta(days=i)
self.calendar[target_date] = []
def get(self) -> dict:
return self.calendar
def arrange_base_on_date(self):
#print(self.raw_data)
for d,p in self.raw_data.items():
#print(d,p)
self.normal_next_prac(d,p)
self.flatten()
def flatten(self):
for i in self.calendar:
self.calendar[i] = [val for sublist in self.calendar[i] for val in sublist]
def normal_next_prac(self, prac_date:date, problem_number:list) -> None:
today = date.today()
tmr = today + timedelta(days=1)
next_1_day = prac_date + timedelta(days=1)
next_2_day = prac_date + timedelta(days=2)
next_4_day = prac_date + timedelta(days=4)
next_week = prac_date + timedelta(days= 7)
next_2_week = prac_date + timedelta(days= 15)
next_month = prac_date + timedelta(days= 30)
next_3_month = prac_date + timedelta(days= 90)
next_6_month = prac_date + timedelta(days= 180)
date_list = [next_1_day,next_2_day,next_4_day,next_week, next_2_week, next_month,next_3_month,next_6_month]
#print(prac_date,problem_number)
for i in date_list:
if i in self.calendar:
self.calendar[i].append(problem_number)
def failed_next_prac(self, failed: int) -> list:
pass
def hardness_next_prac(self, hardness: int) -> list:
pass
def proficiency_next_prac(self, workingTime:int) -> list:
pass
def overall_next_prac(self) -> list:
# self.raw_data = { date1: problem_num, d2: p4, ...}
# failed > normal > hardness and use solve time as a tie breaker
#tbu
pass
def advance_by(self, target_date:date, problem_num:int,advance_date:int) ->None:
time_diff = target_date - date.today()
while time_diff.days >= 0:
next_date = target_date - timedelta(days=advance_date)
time_diff = next_date-target_date
if problem_num not in self.calendar[next_date]:
self.calendar[next_date].append(problem_num)
self.calendar[target_date].remove(problem_num)
return
def delay_by(self, target_date:date, problem_num:int,delay_day:int) ->None:
# failed * 0.5 + normal * 0.4 + hardness * 0.1 and solve problem is super low can remove one category <10min
# category problems base on their normal date, and add problems base on that
self.calendar[target_date].remove(problem_num)
next_date = target_date + timedelta(days=delay_day)
if problem_num not in self.calendar[next_date]:
self.calendar[next_date].append(problem_num)