feat(gui): Add cascade blocking logic to block/unblock
This commit is contained in:
25
src/gui_2.py
25
src/gui_2.py
@@ -1960,6 +1960,17 @@ class App:
|
||||
t['status'] = 'blocked'
|
||||
t['manual_block'] = True
|
||||
t['blocked_reason'] = '[MANUAL] User blocked'
|
||||
changed = True
|
||||
while changed:
|
||||
changed = False
|
||||
for t in self.active_tickets:
|
||||
if t.get('status') == 'todo':
|
||||
for dep_id in t.get('depends_on', []):
|
||||
dep = next((x for x in self.active_tickets if str(x.get('id', '')) == dep_id), None)
|
||||
if dep and dep.get('status') == 'blocked':
|
||||
t['status'] = 'blocked'
|
||||
changed = True
|
||||
break
|
||||
self._push_mma_state_update()
|
||||
|
||||
def _cb_unblock_ticket(self, ticket_id: str) -> None:
|
||||
@@ -1968,6 +1979,20 @@ class App:
|
||||
t['status'] = 'todo'
|
||||
t['manual_block'] = False
|
||||
t['blocked_reason'] = None
|
||||
changed = True
|
||||
while changed:
|
||||
changed = False
|
||||
for t in self.active_tickets:
|
||||
if t.get('status') == 'blocked' and not t.get('manual_block', False):
|
||||
can_run = True
|
||||
for dep_id in t.get('depends_on', []):
|
||||
dep = next((x for x in self.active_tickets if str(x.get('id', '')) == dep_id), None)
|
||||
if dep and dep.get('status') != 'completed':
|
||||
can_run = False
|
||||
break
|
||||
if can_run:
|
||||
t['status'] = 'todo'
|
||||
changed = True
|
||||
self._push_mma_state_update()
|
||||
|
||||
def _reorder_ticket(self, src_idx: int, dst_idx: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user