taskcheck 0.3.2.post1__tar.gz → 0.3.2.post2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: taskcheck
3
- Version: 0.3.2.post1
3
+ Version: 0.3.2.post2
4
4
  Summary: Automatic scheduler for taskwarrior
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -144,3 +144,7 @@ additional_attributes_unplanned = ["due", "urgency"] # additional attributes to
144
144
  -i, --install: install taskcheck configuration
145
145
  -r, --report: show tasks planned until a certain time
146
146
  ```
147
+
148
+ ## TODO
149
+
150
+ - [ ] Consider due dates are nearer while planning in the future
@@ -131,3 +131,7 @@ additional_attributes_unplanned = ["due", "urgency"] # additional attributes to
131
131
  -i, --install: install taskcheck configuration
132
132
  -r, --report: show tasks planned until a certain time
133
133
  ```
134
+
135
+ ## TODO
136
+
137
+ - [ ] Consider due dates are nearer while planning in the future
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "taskcheck"
3
- version = "0.3.2-1"
3
+ version = "0.3.2-2"
4
4
  description = "Automatic scheduler for taskwarrior"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -80,10 +80,7 @@ def check_tasks_parallel(config, verbose=False):
80
80
  )
81
81
 
82
82
  for day_offset in range(days_ahead):
83
- date = today + timedelta(days=day_offset)
84
- allocate_time_for_day(
85
- task_info, day_offset, date, urgency_coefficients, verbose
86
- )
83
+ allocate_time_for_day(task_info, day_offset, urgency_coefficients, verbose)
87
84
 
88
85
  update_tasks_with_scheduling_info(task_info, verbose)
89
86
 
@@ -118,7 +115,8 @@ def initialize_task_info(tasks, time_maps, days_ahead, urgency_coefficients, cal
118
115
  return task_info
119
116
 
120
117
 
121
- def allocate_time_for_day(task_info, day_offset, date, urgency_coefficients, verbose):
118
+ def allocate_time_for_day(task_info, day_offset, urgency_coefficients, verbose):
119
+ date = datetime.today().date() + timedelta(days=day_offset)
122
120
  total_available_hours = compute_total_available_hours(task_info, day_offset)
123
121
  # if verbose:
124
122
  # print(f"Day {date}, total available hours: {total_available_hours:.2f}")
@@ -156,6 +154,12 @@ def allocate_time_for_day(task_info, day_offset, date, urgency_coefficients, ver
156
154
  ],
157
155
  )
158
156
  continue
157
+
158
+ wait = info["task"].get("wait")
159
+ if wait and date <= datetime.strptime(wait, "%Y%m%dT%H%M%SZ").date():
160
+ if verbose:
161
+ print(f"Skipping task {info['task']['id']} due to wait date {wait}")
162
+ continue
159
163
  allocation = allocate_time_to_task(info, day_offset, day_remaining_hours)
160
164
  if allocation > 0:
161
165
  day_remaining_hours -= allocation
@@ -216,8 +220,17 @@ def recompute_urgencies(tasks_remaining, urgency_coefficients):
216
220
  if started_by_scheduler and not started_by_user:
217
221
  # If the task was started by the scheduler, apply the active task coefficient
218
222
  info["urgency"] += urgency_coefficients.active
223
+ info["started"] = False
219
224
 
220
225
  if urgency_coefficients.inherit:
226
+ # Build reverse dependencies mapping
227
+ reverse_deps = {} # Map from task_uuid to list of tasks that depend on it
228
+ for task_uuid, info in tasks_remaining.items():
229
+ for dep_uuid in info["task"].get("depends", []):
230
+ if dep_uuid not in reverse_deps:
231
+ reverse_deps[dep_uuid] = []
232
+ reverse_deps[dep_uuid].append(task_uuid)
233
+
221
234
  # Define a recursive function to compute the maximum urgency
222
235
  def get_max_urgency(info, visited):
223
236
  task_uuid = info["task"]["uuid"]
@@ -226,8 +239,8 @@ def recompute_urgencies(tasks_remaining, urgency_coefficients):
226
239
  # Start with the current task's urgency
227
240
  urgency = info["urgency"]
228
241
  visited[task_uuid] = urgency # Mark as visited
229
- # Recursively compute urgencies of dependents
230
- for dep_uuid in info["task"].get("depends", []):
242
+ # Recursively compute urgencies of tasks that depend on this task
243
+ for dep_uuid in reverse_deps.get(task_uuid, []):
231
244
  if dep_uuid in tasks_remaining:
232
245
  dep_info = tasks_remaining[dep_uuid]
233
246
  dep_urgency = get_max_urgency(dep_info, visited)
@@ -235,7 +248,7 @@ def recompute_urgencies(tasks_remaining, urgency_coefficients):
235
248
  visited[task_uuid] = urgency # Update with the maximum urgency found
236
249
  return urgency
237
250
 
238
- # Update urgencies based on dependents
251
+ # Update urgencies based on tasks that depend on them
239
252
  for info in tasks_remaining.values():
240
253
  visited = {} # Reset visited dictionary for each task
241
254
  max_urgency = get_max_urgency(info, visited)
@@ -257,9 +270,10 @@ def allocate_time_to_task(info, day_offset, day_remaining_hours):
257
270
  if allocation <= 0.05:
258
271
  return 0
259
272
 
273
+ if info["remaining_hours"] == info["task"]["estimated"]:
274
+ info["started"] = True
260
275
  info["remaining_hours"] -= allocation
261
276
  info["task_time_map"][day_offset] -= allocation
262
- info["started"] = True
263
277
 
264
278
  return allocation
265
279
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: taskcheck
3
- Version: 0.3.2.post1
3
+ Version: 0.3.2.post2
4
4
  Summary: Automatic scheduler for taskwarrior
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -144,3 +144,7 @@ additional_attributes_unplanned = ["due", "urgency"] # additional attributes to
144
144
  -i, --install: install taskcheck configuration
145
145
  -r, --report: show tasks planned until a certain time
146
146
  ```
147
+
148
+ ## TODO
149
+
150
+ - [ ] Consider due dates are nearer while planning in the future
File without changes