Skip to content

Conversation

@dbraquart
Copy link
Contributor

No description provided.

@dbraquart dbraquart requested a review from SlimaneAmar October 20, 2025 14:03
@dbraquart dbraquart force-pushed the dbraquart/dont-load-modifications-we-wont-build branch from 6e87cd1 to f1a2189 Compare October 21, 2025 08:44
…odifications-we-wont-build

# Conflicts:
#	src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java
Signed-off-by: David BRAQUART <[email protected]>
@dbraquart dbraquart force-pushed the dbraquart/dont-load-modifications-we-wont-build branch from f0bc16e to 42a8cdc Compare October 21, 2025 10:52
@sonarqubecloud
Copy link

Copy link
Contributor

@TheMaskedTurtle TheMaskedTurtle left a comment

Choose a reason for hiding this comment

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

Be careful with the word 'active' because there are already methods that are named 'active' but it fetches only unstashed modifications... and not unstashed and active... which can be confusing. So either remane these other methods or maybe rename yours. Even if yours is correctly named ^^

Comment on lines +427 to +430
List<ModificationEntity> modificationsEntities = getModificationEntityStream(groupUuid)
.filter(m -> modificationsToExclude == null || !modificationsToExclude.contains(m.getId()))
.filter(m -> !m.getStashed() && m.getActivated())
.toList();
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be even better to do that in SQL directly. So we don't load unnecessary entities in JPA.

Comment on lines 247 to 248
.stream()
.filter(m -> modificationsToExclude == null || !modificationsToExclude.contains(m.getId()))
.filter(m -> !m.getStashed())
.toList();
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove .stream().toList();

@TheMaskedTurtle
Copy link
Contributor

Now getModificationsEntitiesNonTransactional is called only once... I think it can also be refactored a bit to simplify.

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