A Cancelled Recipe Revision Appears as the Current Tea Blend
Level 2 · node · Data · Latest recipe excluding cancelled revisions
Scenario
A fictional teahouse keeps tasting recipes with revision numbers. Some revisions are cancelled after tasting, but those records remain in the history. The tasting display should show the highest valid revision; instead it can choose a cancelled revision.
Requirements
Return the blend name from the highest non-cancelled revision. Return null if no valid revision remains. Input order is not guaranteed.
Acceptance criteria
- When none are cancelled, choose the recipe with the highest revision number.
- When the highest revision is cancelled, choose the preceding valid revision.
- Return null when every revision is cancelled.
- Return null when there is no revision history.