Skip to content

Commit 6aeff3b

Browse files
committed
update csv columns for n-result
Signed-off-by: David BRAQUART <[email protected]>
1 parent 8c3855f commit 6aeff3b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/main/java/org/gridsuite/securityanalysis/server/dto/LimitViolationDTO.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,19 @@ private static String convertDoubleToLocale(Double value, String language) {
5959
}
6060

6161
public List<String> toCsvRow(Map<String, String> translations, String language) {
62+
// must be in-sync with security analysis columns definition in the Front (table "N")
6263
List<String> csvRow = new ArrayList<>();
63-
csvRow.add(this.getLocationId());
6464
csvRow.add(this.getLimitType() != null ? CsvExportUtils.translate(this.getLimitType().name(), translations) : "");
65+
csvRow.add(this.getLocationId()); // busId
6566
csvRow.add(CsvExportUtils.replaceNullWithEmptyString(CsvExportUtils.translate(this.getLimitName(), translations)));
66-
csvRow.add(convertDoubleToLocale(this.getLimit(), language));
67-
csvRow.add(convertDoubleToLocale(this.getValue(), language));
6867
csvRow.add(this.getLoading() == null ? "" : convertDoubleToLocale(this.getLoading(), language));
68+
csvRow.add(this.getPatlLoading() == null ? "" : convertDoubleToLocale(this.getPatlLoading(), language));
6969
csvRow.add(this.getAcceptableDuration() == Integer.MAX_VALUE ? null : Integer.toString(this.getAcceptableDuration()));
70+
csvRow.add(this.getUpcomingAcceptableDuration() == null || this.getUpcomingAcceptableDuration() == Integer.MAX_VALUE ? null : Integer.toString(this.getUpcomingAcceptableDuration()));
71+
csvRow.add(CsvExportUtils.replaceNullWithEmptyString(CsvExportUtils.translate(this.getNextLimitName(), translations)));
72+
csvRow.add(convertDoubleToLocale(this.getLimit(), language));
73+
csvRow.add(this.getPatlLimit() == null ? "" : convertDoubleToLocale(this.getPatlLimit(), language));
74+
csvRow.add(convertDoubleToLocale(this.getValue(), language));
7075
csvRow.add(this.getSide() != null ? CsvExportUtils.translate(this.getSide().name(), translations) : "");
7176
return csvRow;
7277
}

src/main/java/org/gridsuite/securityanalysis/server/dto/PreContingencyLimitViolationResultDTO.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public static PreContingencyLimitViolationResultDTO toDto(PreContingencyLimitVio
4343
public List<String> toCsvRow(Map<String, String> translations, String language) {
4444
List<String> csvRow = List.of();
4545

46-
if (this.getLimitViolation() != null) {
46+
if (this.getLimitViolation() != null && this.getSubjectId() != null) {
47+
csvRow = List.of(this.getSubjectId());
4748
return Stream.concat(csvRow.stream(), this.getLimitViolation().toCsvRow(translations, language).stream()).toList();
4849
}
4950

0 commit comments

Comments
 (0)