Skip to content

Commit

Permalink
Within the fixversion block, prioritize by due date
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Oct 24, 2024
1 parent f84b72c commit 021b50f
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/rules/team/fixversion_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ class FixVersionBlock(Block):
"""A special-case block that gets ranked to the top"""

def yield_issues(self):
yield from sorted(self.issues, key=self._earliest_fixversion_date)
""" Within the fixversion block, issues get sorted by due date """
duedate_field_id = self.issues[0].raw["Context"]["Field Ids"]["Due Date"]
duedate = lambda issue: getattr(issue.fields, duedate_field_id)
yield from sorted(self.issues, key=duedate)

@property
def rank(self):
Expand All @@ -100,20 +103,6 @@ def rank(self):
def claims(self, issue) -> bool:
return self._claims(issue)

@staticmethod
def _earliest_fixversion_date(issue):
fixversions = issue.fields.fixVersions
if not fixversions:
return None
dates = [
fixversion.releaseDate
for fixversion in fixversions
if hasattr(fixversion, "releaseDate")
]
if not dates:
return None
return sorted(dates)[0]

@staticmethod
def _claims(issue) -> bool:
critical_deadline = (
Expand Down

0 comments on commit 021b50f

Please sign in to comment.