-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelements.py
More file actions
87 lines (64 loc) · 2.06 KB
/
elements.py
File metadata and controls
87 lines (64 loc) · 2.06 KB
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
from datetime import datetime
import typing as tp
#TODO: how to add Personal Best! to tracking?
#NOTES: Should we pledge a max amount per cycle, or per plan? The cost of failure? or something?
# in strict mode there is akrasia horizon
class Goal():
...
#get royal society prize for tranqphil
class Day():
'''
'''
def __init__(self):
...
self.type: ... = ...#work, rest,
class Cycle():
'''
A Cycle is a sequence of Days
'''
...
class Plan():
'''
A Plan is a sequence of Cycles
'''
...
#get royal society prize: finish book - write XXX chapters - read YYY - structure
class Units():
...
#hours / minutes
#milligrams
class Contract():
'''
TODO: think about how to do categorial 0-1 goals. a scalar goal w integer units an optional deadline and no repeats?
'''
def __init__(self):
...
self.units: 'Units' = ...
self.amount: = ...
self.activity: np.array = ... #an array with 7 columns, and at least 1 row, of boolean values
self.deadline: datetime = ...
self.repeat: bool = ...
self.stake: float = ...
self.strict: bool = ...
self.payment_schedule: Enum = ... # flat, linear and exponential
self.last_payment: float = 0
self.total_time = datetime.timedelta()
def time_to_deadline(self) -> datetime.timedelta:
now = datetime.datetime.now()
remaining_time = self.deadline - now
return remaining_time
def start_timer(self):
self.start_time = datetime.datetime.now()
self.is_running = True
def stop_timer(self):
self.end_time = datetime.datetime.now()
self.is_running = False
elapsed_time = self.end_time - self.start_time
self.total_time += elapsed_time
def elapsed_time(self) -> datetime.timedelta:
if self.is_running:
now = datetime.datetime.now()
elapsed_time = now - self.start_time
else:
elapsed_time = self.end_time - self.start_time
return elapsed_time