MCPcopy Index your code
hub / github.com/diffgram/diffgram / Task_Update

Class Task_Update

shared/utils/task/task_update_manager.py:9–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8@dataclass
9class Task_Update():
10 session: any
11 task: Task
12 mode: str = None
13 status: str = None
14 member: 'Member' = None
15
16 """
17 Controls the changing of the task status and generation of the appropriate events depending
18 on the status.
19
20 Notes:
21 - For completing a task use task_complete() function in task.py. that function uses this class eventually.
22
23 """
24
25 def __post_init__(self):
26
27 self.session.add(self.task)
28 self.try_to_commit = regular_methods.try_to_commit
29
30 # TODO clarify if this needs to use factory thing
31 self.log = regular_log.default()
32
33 def main(self):
34 old_status = self.task.status
35 if self.mode == 'toggle_deferred':
36 self.defer()
37 if self.mode == 'incomplete':
38 self.status = 'in_progress'
39 self.change_status()
40 if self.status:
41 self.change_status()
42 regular_methods.try_to_commit(self)
43 self.emit_task_event_based_on_status(old_status, self.task)
44 self.update_related_file_status(old_status, self.task)
45 self.task.job.refresh_stat_count_tasks(self.session)
46 return
47
48 def update_related_file_status(self, old_status, updated_task: Task):
49 if updated_task.status == 'complete':
50 # Find All Other Tasks from the related file
51 other_pending_tasks = Task.get_related_pending_tasks(session = self.session,
52 task = updated_task)
53 if len(other_pending_tasks) == 0:
54 updated_task.file.ann_is_complete = True
55
56 else:
57 updated_task.file.ann_is_complete = False
58 else:
59 updated_task.file.ann_is_complete = False
60 self.session.add(updated_task.file)
61
62 def emit_task_event_based_on_status(self, old_status, task):
63 if task.status == 'complete':
64 if old_status != 'completed':
65 assignees = task.get_assignees(session = self.session)
66 if old_status == 'in_review':

Callers 9

job_cancel_coreFunction · 0.90
task_review_coreFunction · 0.90
task_update_apiFunction · 0.90
get_next_task_by_projectFunction · 0.90
get_next_task_by_jobFunction · 0.90
task_completeFunction · 0.90
get_task_from_job_idMethod · 0.90

Calls

no outgoing calls

Tested by 1