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

Add by formula modification #359

Merged
merged 30 commits into from
Nov 13, 2023
Merged

Add by formula modification #359

merged 30 commits into from
Nov 13, 2023

Conversation

YenguiSeddik
Copy link
Contributor

No description provided.

@YenguiSeddik YenguiSeddik requested review from anistouri and removed request for SlimaneAmar November 2, 2023 16:05
Comment on lines 63 to 68
if (filters == null) {
this.filters = formulaInfos.getFilters().stream().map(FilterInfos::toEntity).collect(Collectors.toList());
} else {
filters.clear();
filters.addAll(formulaInfos.getFilters().stream().map(FilterInfos::toEntity).collect(Collectors.toList()));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (filters == null) {
this.filters = formulaInfos.getFilters().stream().map(FilterInfos::toEntity).collect(Collectors.toList());
} else {
filters.clear();
filters.addAll(formulaInfos.getFilters().stream().map(FilterInfos::toEntity).collect(Collectors.toList()));
}
this.filters = formulaInfos.getFilters().stream().map(FilterInfos::toEntity).collect(Collectors.toList());

List<Report> formulaReports,
FormulaInfos formulaInfos,
FilterInfos filterInfos) {
var filterEquipments = exportFilters.get(filterInfos.getId());
Copy link
Contributor

Choose a reason for hiding this comment

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

To enhance code readability and maintainability, I suggest specifying the explicit return type instead of using var

Suggested change
var filterEquipments = exportFilters.get(filterInfos.getId());
FilterEquipments filterEquipments = exportFilters.get(filterInfos.getId());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

.build());

if (!CollectionUtils.isEmpty(filterEquipments.getNotFoundEquipments())) {
var equipmentIds = String.join(", ", filterEquipments.getNotFoundEquipments());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var equipmentIds = String.join(", ", filterEquipments.getNotFoundEquipments());
String equipmentIds = String.join(", ", filterEquipments.getNotFoundEquipments());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


public boolean isValidFilter(Reporter subReporter,
NetworkModificationException.Type errorType,
Map<UUID, String> filters,
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not used

Map<UUID, String> filters,
Map<UUID, FilterEquipments> exportFilters) {
// collect all filters with wrong equipments ids
Map<UUID, FilterEquipments> filterWithWrongEquipmentsIds = exportFilters.entrySet()
Copy link
Contributor

Choose a reason for hiding this comment

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

this variable is not used

case DIVISION -> {
if (value2 == 0) {
throw new NetworkModificationException(NetworkModificationException.Type.BY_FORMULA_MODIFICATION_ERROR,
"there is a division by 0 in one formula");
Copy link
Contributor

Choose a reason for hiding this comment

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

replace with "there is a division by zero in a formula"

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

84.8% 84.8% Coverage
0.0% 0.0% Duplication

@YenguiSeddik YenguiSeddik merged commit c2b5b44 into main Nov 13, 2023
4 checks passed
@YenguiSeddik YenguiSeddik deleted the add_by_formula_modification branch November 13, 2023 13:41
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