Skip to content

Commit

Permalink
fix milestone accessing bug (#4471)
Browse files Browse the repository at this point in the history
Co-authored-by: DanielRyanSmith <[email protected]>
  • Loading branch information
DanielRyanSmith and DanielRyanSmith authored Oct 21, 2024
1 parent ce02994 commit d4c249f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internals/stage_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def find_earliest_milestone(stages: list[Stage]) -> int|None:
"""Find the earliest milestone in a list of stages."""
m_list: list[int] = []
for stage in stages:
if stage.milestones is None:
continue
m_list.append(stage.milestones.desktop_first)
m_list.append(stage.milestones.android_first)
m_list.append(stage.milestones.ios_first)
Expand Down
3 changes: 2 additions & 1 deletion internals/stage_helpers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def setUp(self):
self.stage_2_2 = Stage(
feature_id=22222,
milestones=MilestoneSet(desktop_first=121, android_first=120))
self.stage_2_3 = Stage(feature_id=22222)

def tearDown(self):
for stage in Stage.query().fetch():
Expand Down Expand Up @@ -130,5 +131,5 @@ def test_find_earliest_milestone__single_stage(self):
def test_find_earliest_milestone__multi_stage(self):
"""We find the earliest milestone in a list of stages."""
actual = stage_helpers.find_earliest_milestone(
[self.stage_2_1, self.stage_2_2])
[self.stage_2_1, self.stage_2_2, self.stage_2_3])
self.assertEqual(120, actual)

0 comments on commit d4c249f

Please sign in to comment.