pyvikunja 0.11__py3-none-any.whl → 0.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyvikunja/models/task.py +52 -3
- {pyvikunja-0.11.dist-info → pyvikunja-0.13.dist-info}/METADATA +1 -1
- {pyvikunja-0.11.dist-info → pyvikunja-0.13.dist-info}/RECORD +6 -6
- {pyvikunja-0.11.dist-info → pyvikunja-0.13.dist-info}/LICENSE +0 -0
- {pyvikunja-0.11.dist-info → pyvikunja-0.13.dist-info}/WHEEL +0 -0
- {pyvikunja-0.11.dist-info → pyvikunja-0.13.dist-info}/top_level.txt +0 -0
pyvikunja/models/task.py
CHANGED
@@ -10,10 +10,58 @@ from pyvikunja.models.user import User
|
|
10
10
|
|
11
11
|
class Task(BaseModel):
|
12
12
|
def __init__(self, api: 'VikunjaAPI', data: Dict):
|
13
|
-
|
14
13
|
super().__init__(data)
|
15
14
|
self.api = api
|
15
|
+
self.id: int = -1
|
16
|
+
self.data = data
|
17
|
+
self.title: str = ""
|
18
|
+
self.description: str = ""
|
19
|
+
self.done: bool = False
|
20
|
+
self.done_at: Optional[datetime] = None
|
21
|
+
self.due_date: Optional[datetime] = None
|
22
|
+
self.start_date: Optional[datetime] = None
|
23
|
+
self.end_date: Optional[datetime] = None
|
24
|
+
self.hex_color: Optional[str] = None
|
25
|
+
self.is_favorite: bool = False
|
26
|
+
self.percent_done: int = 0
|
27
|
+
self.priority: Optional[Priority] = None
|
28
|
+
self.project_id: Optional[int] = None
|
29
|
+
self.labels: List[Label] = []
|
30
|
+
self.assignees: List[User] = []
|
31
|
+
self.repeat_mode: Optional[RepeatMode] = None
|
32
|
+
self.repeat_after: Optional[timedelta] = None
|
33
|
+
self.repeat_enabled = False
|
34
|
+
|
35
|
+
self.parse_data(data)
|
36
|
+
|
37
|
+
def __eq__(self, other):
|
38
|
+
if not isinstance(other, Task):
|
39
|
+
return False
|
40
|
+
|
41
|
+
return (
|
42
|
+
self.id == other.id and
|
43
|
+
self.title == other.title and
|
44
|
+
self.description == other.description and
|
45
|
+
self.done == other.done and
|
46
|
+
self.done_at == other.done_at and
|
47
|
+
self.due_date == other.due_date and
|
48
|
+
self.start_date == other.start_date and
|
49
|
+
self.end_date == other.end_date and
|
50
|
+
self.hex_color == other.hex_color and
|
51
|
+
self.is_favorite == other.is_favorite and
|
52
|
+
self.percent_done == other.percent_done and
|
53
|
+
self.priority == other.priority and
|
54
|
+
self.project_id == other.project_id and
|
55
|
+
self.repeat_mode == other.repeat_mode and
|
56
|
+
self.repeat_after == other.repeat_after and
|
57
|
+
self.repeat_enabled == other.repeat_enabled and
|
58
|
+
sorted(self.labels, key=lambda x: x.id) == sorted(other.labels, key=lambda x: x.id) and
|
59
|
+
sorted(self.assignees, key=lambda x: x.id) == sorted(other.assignees, key=lambda x: x.id)
|
60
|
+
)
|
61
|
+
|
62
|
+
def parse_data(self, data):
|
16
63
|
self.data = data
|
64
|
+
self.id: int = data.get('id', -1)
|
17
65
|
self.title: str = data.get('title', '')
|
18
66
|
self.description: str = data.get('description', '')
|
19
67
|
self.done: bool = data.get('done', False)
|
@@ -63,7 +111,7 @@ class Task(BaseModel):
|
|
63
111
|
updated_data = await self.api.update_task(self.id, combined)
|
64
112
|
|
65
113
|
# Update the local data with the response
|
66
|
-
self.
|
114
|
+
self.parse_data(updated_data)
|
67
115
|
|
68
116
|
return self
|
69
117
|
|
@@ -118,7 +166,8 @@ class Task(BaseModel):
|
|
118
166
|
|
119
167
|
async def set_repeating_enabled(self, enabled: bool):
|
120
168
|
return await self.update({
|
121
|
-
'repeat_after': None if not enabled else 3600 # 1 hour min
|
169
|
+
'repeat_after': None if not enabled else 3600, # 1 hour min
|
170
|
+
'repeat_mode': 0
|
122
171
|
})
|
123
172
|
|
124
173
|
async def set_repeating_interval(self, interval: Optional[timedelta] = None,
|
@@ -3,13 +3,13 @@ pyvikunja/api.py,sha256=mHPn0XPFrYNCG3ChIUnluAOP08z3YyUL_3nors9RuYU,6920
|
|
3
3
|
pyvikunja/models/label.py,sha256=cOOuVYDVDMmK96Ev22EDgWwXljkAonQNL4XsTMay4K4,467
|
4
4
|
pyvikunja/models/models.py,sha256=RCPsYQtcgE-W5ZmhwGDejAI76nHZ9-1X-x5GeTG4RnI,637
|
5
5
|
pyvikunja/models/project.py,sha256=viVIe3lVgbh7k05ADDds1cwzvC1vf4tT2vSNjbB7KMk,1179
|
6
|
-
pyvikunja/models/task.py,sha256=
|
6
|
+
pyvikunja/models/task.py,sha256=ZEiIMyOUo-qJVQZmmYm1aJrU8WDyWJanBSLIRRsYYdA,7782
|
7
7
|
pyvikunja/models/team.py,sha256=0Z3828Cm3nNuNr1z2on63fLYAVW325_SQKi5RmqXf-I,559
|
8
8
|
pyvikunja/models/user.py,sha256=36duFNyGXKzlwqO0d6FA-C1KTCci2sIMU1IBIF-N_LM,310
|
9
9
|
pyvikunja/models/enum/repeat_mode.py,sha256=xkDPfYeRz342ovqro1UVBAoegpPgpZQYTnyo2sf6R7I,112
|
10
10
|
pyvikunja/models/enum/task_priority.py,sha256=aVz1HEofIqwUkXG0vYm58n_vLNbgqtbvHuQ5K-YQqA0,119
|
11
|
-
pyvikunja-0.
|
12
|
-
pyvikunja-0.
|
13
|
-
pyvikunja-0.
|
14
|
-
pyvikunja-0.
|
15
|
-
pyvikunja-0.
|
11
|
+
pyvikunja-0.13.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
12
|
+
pyvikunja-0.13.dist-info/METADATA,sha256=LOF8eaoSTMas35r93WvwvLuNWfCmS8BCl81MIZ7KgYM,188
|
13
|
+
pyvikunja-0.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
14
|
+
pyvikunja-0.13.dist-info/top_level.txt,sha256=WVV9zgxUBuWOkUY1t_U7zI0paWWTVelKYB4vjsiKsks,10
|
15
|
+
pyvikunja-0.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|