Skip to content

Commit

Permalink
Bugfix in retrieving requirements corresponding to measures (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherSpelt authored Nov 22, 2024
2 parents 73b4616 + 1520994 commit a3617de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 3 additions & 0 deletions amt/api/routes/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ async def find_requirement_tasks_by_measure_urn(system_card: SystemCard, measure
measure = await measures_service.fetch_measures(measure_urn)
for requirement_urn in measure[0].links:
# TODO: This is because measure are linked to too many requirement not applicable in our use case
if requirement_urn not in requirement_mapper:
continue

if len(await requirements_service.fetch_requirements(requirement_urn)) > 0:
requirement_tasks.append(requirement_mapper[requirement_urn])

Expand Down
8 changes: 0 additions & 8 deletions tests/api/routes/test_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,6 @@ async def test_find_requirement_tasks_by_measure_urn() -> None:
requirement_tasks = await find_requirement_tasks_by_measure_urn(test_algorithm.system_card, "urn:nl:ak:mtr:dat-01")
assert len(requirement_tasks) == 2

# empty requirements
test_algorithm.system_card.requirements = []
with pytest.raises(KeyError):
# TODO: this is because it is not coded well change later
requirement_tasks = await find_requirement_tasks_by_measure_urn(
test_algorithm.system_card, "urn:nl:ak:mtr:dat-01"
)


@pytest.mark.asyncio
async def test_get_measure(client: AsyncClient, db: DatabaseTestUtils) -> None:
Expand Down

0 comments on commit a3617de

Please sign in to comment.