Skip to content

Commit

Permalink
Simplify getting current milestone
Browse files Browse the repository at this point in the history
  • Loading branch information
markhobson committed Nov 23, 2023
1 parent c884cff commit b3ae959
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions schemes/schemes/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ def update_milestone(self, milestone_revision: MilestoneRevision) -> None:

@property
def current_milestone(self) -> Milestone | None:
current_milestone_revisions = [
revision for revision in self._milestone_revisions if revision.effective_date_to is None
actual_milestones = [
revision.milestone
for revision in self._milestone_revisions
if revision.observation_type == ObservationType.ACTUAL and revision.effective_date_to is None
]
actual_milestone_revisions = [
revision for revision in current_milestone_revisions if revision.observation_type == ObservationType.ACTUAL
]
actual_milestones = [revision.milestone for revision in actual_milestone_revisions]
return sorted(actual_milestones)[-1] if actual_milestones else None

@property
Expand Down

0 comments on commit b3ae959

Please sign in to comment.