@@ -58,7 +58,9 @@ def unresolved(self):
5858 Q (decisions__isnull = True )
5959 | Q (
6060 # i.e. the latest decision is a requeue
61- decisions__action = DECISION_ACTIONS .AMO_REQUEUE ,
61+ decisions__action__in = (
62+ DECISION_ACTIONS .AMO_REQUEUE , DECISION_ACTIONS .AMO_ESCALATE
63+ ),
6264 decisions__overridden_by__isnull = True ,
6365 )
6466 )
@@ -324,8 +326,15 @@ def process_decision(
324326 decision .send_notifications ()
325327
326328 def process_queue_move (self , * , new_queue , notes ):
327- CinderQueueMove .objects .create (cinder_job = self , notes = notes , to_queue = new_queue )
328329 if new_queue == CinderAddonHandledByReviewers (self .target ).queue :
330+ ContentDecision .objects .create (
331+ addon = self .target_addon ,
332+ action = DECISION_ACTIONS .AMO_ESCALATE ,
333+ override_of = self .decision ,
334+ action_date = datetime .now (),
335+ notes = notes ,
336+ cinder_job = self ,
337+ )
329338 # now escalated
330339 entity_helper = CinderJob .get_entity_helper (
331340 self .target , resolved_in_reviewer_tools = True
@@ -358,27 +367,20 @@ def clear_needs_human_review_flags(self):
358367 .resolvable_in_reviewer_tools ()
359368 )
360369 if (
361- (decision_actions := tuple (self .decisions .values_list ('action' , flat = True )))
370+ (penultimate_action :=
371+ tuple (self .decisions .values_list ('action' , flat = True ))[- 2 :- 1 ])
362372 # i.e. was the previous decision before the current a requeue
363- and len (decision_actions ) >= 2
364- and decision_actions [- 2 ] == DECISION_ACTIONS .AMO_REQUEUE
373+ and penultimate_action == DECISION_ACTIONS .AMO_REQUEUE
365374 ):
366375 has_unresolved_jobs_with_similar_reason = base_unresolved_jobs_qs .filter (
367376 decisions__action = DECISION_ACTIONS .AMO_REQUEUE ,
368377 decisions__overridden_by__isnull = True ,
369378 ).exists ()
370379 reasons = {NeedsHumanReview .REASONS .SECOND_LEVEL_REQUEUE }
371- elif self . forwarded_from_jobs . exists () :
380+ elif penultimate_action == DECISION_ACTIONS . AMO_ESCALATE_ADDON :
372381 has_unresolved_jobs_with_similar_reason = base_unresolved_jobs_qs .filter (
373- forwarded_from_jobs__isnull = False
374- ).exists ()
375- reasons = {
376- NeedsHumanReview .REASONS .CINDER_ESCALATION ,
377- NeedsHumanReview .REASONS .CINDER_APPEAL_ESCALATION ,
378- }
379- elif self .queue_moves .exists ():
380- has_unresolved_jobs_with_similar_reason = base_unresolved_jobs_qs .filter (
381- queue_moves__id__gt = 0
382+ decisions__action = DECISION_ACTIONS .AMO_ESCALATE_ADDON ,
383+ decisions__overridden_by__isnull = True ,
382384 ).exists ()
383385 reasons = {
384386 NeedsHumanReview .REASONS .CINDER_ESCALATION ,
@@ -1457,11 +1459,3 @@ class CinderAppeal(ModelBase):
14571459 reporter_report = models .OneToOneField (
14581460 to = AbuseReport , on_delete = models .CASCADE , null = True
14591461 )
1460-
1461-
1462- class CinderQueueMove (ModelBase ):
1463- cinder_job = models .ForeignKey (
1464- to = CinderJob , on_delete = models .CASCADE , related_name = 'queue_moves'
1465- )
1466- notes = models .TextField (max_length = 1000 , blank = True )
1467- to_queue = models .CharField (max_length = 128 )
0 commit comments