Commit b4849a0 1 parent a01b1d0 commit b4849a0 Copy full SHA for b4849a0
File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -669,7 +669,7 @@ def promote_to_top_position(self) -> "PackagedWorkBasket":
669
669
"""Promote the instance to the top position of the package processing
670
670
queue so that it occupies position 1."""
671
671
672
- if self .position = = 1 :
672
+ if self .position < = 1 :
673
673
return self
674
674
675
675
position = self .position
@@ -680,6 +680,7 @@ def promote_to_top_position(self) -> "PackagedWorkBasket":
680
680
681
681
self .position = 1
682
682
self .save ()
683
+ self .refresh_from_db ()
683
684
684
685
return self
685
686
@@ -689,7 +690,7 @@ def promote_position(self) -> "PackagedWorkBasket":
689
690
"""Promote the instance by one position up the package processing
690
691
queue."""
691
692
692
- if self .position = = 1 :
693
+ if self .position < = 1 :
693
694
return
694
695
695
696
obj_to_swap = PackagedWorkBasket .objects .select_for_update (nowait = True ).get (
@@ -711,7 +712,7 @@ def demote_position(self) -> "PackagedWorkBasket":
711
712
"""Demote the instance by one position down the package processing
712
713
queue."""
713
714
714
- if self .position == PackagedWorkBasket .objects .max_position ():
715
+ if self .position in { 0 , PackagedWorkBasket .objects .max_position ()} :
715
716
return
716
717
717
718
obj_to_swap = PackagedWorkBasket .objects .select_for_update (nowait = True ).get (
You can’t perform that action at this time.
0 commit comments