Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle the get count filters ids #54

Merged
merged 9 commits into from
Dec 14, 2023
Merged

Conversation

ghazwarhili
Copy link
Contributor

No description provided.

@@ -97,6 +98,16 @@ public ResponseEntity<UUID> runAndSave(@Parameter(description = "Network UUID")
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(resultUuid);
}

@PostMapping(value = "/networks/{networkUuid}/computation-count", produces = APPLICATION_JSON_VALUE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/networks/{networkUuid}/parameters/complexity ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a proposal from Slimane

@Operation(summary = "Get computation count of the total of identifiables for a list of filters")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The sensitivity analysis identifiables count"),
@ApiResponse(responseCode = "404", description = "Sensitivity analysis identifiables count result has not been found")})
public ResponseEntity<Integer> getComputationCount(@Parameter(description = "Result UUID") @PathVariable("networkUuid") UUID networkUuid,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description = "Network UUID"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -113,6 +114,18 @@ private List<IdentifiableAttributes> goGetIdentifiables(EquipmentsContainer filt
}
}

private Integer getComputationCount(Map<String, List<UUID>> ids, UUID networkUuid, Integer containersAttributesCount) {
Map<String, List<Integer>> map = filterService.getIdentifiablesCount(ids, networkUuid, null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for contingency list ids, you should request the actions-server and not the filter-server, to get all the contingencies ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -465,7 +469,7 @@ public void setUp() {
given(filterService.getIdentifiablesFromFilter(EQUIPMENTS_IN_VOLTAGE_REGULATION_FILTERS_UUID, NETWORK_UUID, VARIANT_2_ID)).willReturn(EQUIPMENTS_IN_VOLTAGE_REGULATION);
given(filterService.getIdentifiablesFromFilter(EQUIPMENTS_IN_VOLTAGE_REGULATION_FILTERS_UUID, NETWORK_UUID, null)).willReturn(EQUIPMENTS_IN_VOLTAGE_REGULATION);
given(filterService.getIdentifiablesFromFilter(EQUIPMENTS_IN_VOLTAGE_REGULATION_FILTERS_UUID, NETWORK_STOP_UUID, VARIANT_2_ID)).willReturn(EQUIPMENTS_IN_VOLTAGE_REGULATION);

given(filterService.getIdentifiablesCount(IDS, NETWORK_UUID, null)).willReturn(Map.of("0", List.of(6), "1", List.of(6), "2", List.of(6)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See remark above for contingencies ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


HttpEntity<Map<String, List<UUID>>> httpEntity = new HttpEntity<>(ids, headers);

return restTemplate.exchange(filterServerBaseUri + path, HttpMethod.POST, httpEntity,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpMethod.GET

ids.remove(INJECTIONS);
}
containersAttributesCount = getComputationCount(ids, networkUuid, variantId, containersAttributesCount);
return containersAttributesCount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return getComputationCount(ids, networkUuid, variantId, containersAttributesCount) ?

@@ -133,6 +133,14 @@ public class SensitivityAnalysisControllerTest {
private static final UUID MONITORED_VOLTAGE_LEVELS_FILTERS_NODES_UUID = UUID.randomUUID();
private static final UUID EQUIPMENTS_IN_VOLTAGE_REGULATION_FILTERS_UUID = UUID.randomUUID();
private static final UUID CONTINGENCIES_NODES_UUID = UUID.randomUUID();
private static final List<UUID> MONITORED_BRANCHES_FILTERS_UUID = List.of(UUID.randomUUID());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really need these constants ?

Copy link

@ghazwarhili ghazwarhili merged commit 697d341 into main Dec 14, 2023
3 checks passed
@ghazwarhili ghazwarhili deleted the calcul-activated-param-sensi branch December 14, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants