diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py index 2d21a1ec..4f0a57b5 100644 --- a/pgcommitfest/commitfest/models.py +++ b/pgcommitfest/commitfest/models.py @@ -11,6 +11,10 @@ from .util import DiffableModel +# Patches with one of these tags are always moved to the next commitfest when +# their commitfest closes. +AUTO_MOVE_ALWAYS_TAG_NAMES = ["Bugfix"] + # We have few enough of these, and it's really the only thing we # need to extend from the user model, so just create a separate @@ -114,10 +118,15 @@ def to_json(self): def _should_auto_move_patch(self, patch, current_date): """Determine if a patch should be automatically moved to the next commitfest. - A patch qualifies for auto-move if it both: + A patch tagged as a bug fix is always moved, so that it doesn't get + lost in a closed commitfest. Any other patch qualifies for auto-move + if it both: 1. Has had email activity within the configured number of days 2. Hasn't been failing CI for longer than the configured threshold """ + if any(tag.name in AUTO_MOVE_ALWAYS_TAG_NAMES for tag in patch.tags.all()): + return True + activity_cutoff = current_date - timedelta( days=settings.AUTO_MOVE_EMAIL_ACTIVITY_DAYS ) @@ -148,8 +157,8 @@ def _should_auto_move_patch(self, patch, current_date): def auto_move_active_patches(self): """Automatically move active patches to the next commitfest. - A patch is moved if it has recent email activity and hasn't been - failing CI for too long. + A patch is moved if it is tagged as a bug fix, or if it has recent + email activity and hasn't been failing CI for too long. """ current_date = datetime.now() @@ -170,9 +179,13 @@ def auto_move_active_patches(self): ).order_by("startdate")[0] # Get all patches with open status in this commitfest - open_pocs = self.patchoncommitfest_set.filter( - status__in=PatchOnCommitFest.OPEN_STATUSES - ).select_related("patch") + open_pocs = ( + self.patchoncommitfest_set.filter( + status__in=PatchOnCommitFest.OPEN_STATUSES + ) + .select_related("patch") + .prefetch_related("patch__tags") + ) for poc in open_pocs: if self._should_auto_move_patch(poc.patch, current_date): diff --git a/pgcommitfest/commitfest/templates/help.html b/pgcommitfest/commitfest/templates/help.html index 5807add2..609f0214 100644 --- a/pgcommitfest/commitfest/templates/help.html +++ b/pgcommitfest/commitfest/templates/help.html @@ -17,7 +17,7 @@
- When a Commitfest closes, patches that have been active recently are automatically moved to the next Commitfest. A patch is considered "active" if it has had email activity in the past {{auto_move_email_activity_days}} days and has not been failing CI for more than {{auto_move_max_failing_days}} days. Patches that are not automatically moved will stay in the closed Commitfest, where they will no longer be picked up by CI. Authors of such patches that have enabled "Notify on all where author" in their profile settings will receive an email notification asking them to either move the patch to the next Commitfest or close it with an appropriate status. + When a Commitfest closes, patches that have been active recently are automatically moved to the next Commitfest. A patch is considered "active" if it has had email activity in the past {{auto_move_email_activity_days}} days and has not been failing CI for more than {{auto_move_max_failing_days}} days. Patches tagged "Bugfix" are always moved, even if they are not active. Patches that are not automatically moved will stay in the closed Commitfest, where they will no longer be picked up by CI. Authors of such patches that have enabled "Notify on all where author" in their profile settings will receive an email notification asking them to either move the patch to the next Commitfest or close it with an appropriate status.