Skip to content

Commit 6cac6cb

Browse files
authored
Adjust some labels in modification filters (#675)
* Adjust some labels in modification filters Signed-off-by: Igor PIROG <[email protected]> * Don't forget to add the changeset :/ Signed-off-by: Igor PIROG <[email protected]> * Forget the REACTIVE_POWER key. Signed-off-by: Igor PIROG <[email protected]> * Forget the REACTIVE_POWER key and adjust comments. Signed-off-by: Igor PIROG <[email protected]> * Extract sql orders in sql file Signed-off-by: Igor PIROG <[email protected]> * Maj network-modification lib Signed-off-by: Igor PIROG <[email protected]> * Force rebuild Signed-off-by: Igor PIROG <[email protected]> --------- Signed-off-by: Igor PIROG <[email protected]>
1 parent d8020a2 commit 6cac6cb

File tree

6 files changed

+77
-11
lines changed

6 files changed

+77
-11
lines changed

pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<sonar.organization>gridsuite</sonar.organization>
5353
<sonar.projectKey>org.gridsuite:network-modification-server</sonar.projectKey>
5454
<!-- TODO network-modification.version remove when upgrading gridsuite dependencies -->
55-
<network-modification.version>0.32.0</network-modification.version>
55+
<network-modification.version>0.34.0</network-modification.version>
5656
<powsybl-balances-adjustment.version>2.14.1</powsybl-balances-adjustment.version>
5757
</properties>
5858

@@ -89,7 +89,6 @@
8989
<dependencyManagement>
9090
<dependencies>
9191
<!-- overrides of imports -->
92-
9392
<dependency><!-- To remove when integrate in next release of gridsuite-dependencies or powsybl-ws-dependencies -->
9493
<groupId>com.squareup.okhttp3</groupId>
9594
<artifactId>okhttp-bom</artifactId>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
4+
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd"
7+
logicalFilePath="db/changelog/changesets/changelog_20250822T162300Z.xml">
8+
<changeSet id="Update field name from LOAD.(RE)ACTIVE_POWER to (RE)ACTIVE_POWER_SET_POINT" author="pirogigo">
9+
<sqlFile
10+
dbms="postgresql"
11+
encoding="UTF-8"
12+
path="migrationModificationByAssignment_20250822T162300Z.sql"
13+
relativeToChangelogFile="true"
14+
splitStatements="true"
15+
stripComments="true"/>
16+
</changeSet>
17+
</databaseChangeLog>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
with tmp as (
2+
select assi.id
3+
from assignment as assi
4+
inner join modification_by_assignment as mba
5+
on mba.id=assi.modification_by_assignment_id
6+
where mba.equipment_type = 'LOAD'
7+
and assi.edited_field in ('ACTIVE_POWER', 'REACTIVE_POWER')
8+
)
9+
update assignment
10+
set edited_field = edited_field || '_SET_POINT'
11+
where id in (select id from tmp);
12+
13+
with tmp as (
14+
select form.id
15+
from formula as form
16+
inner join by_formula_modification as bfm
17+
on bfm.id=form.by_formula_modification_id
18+
where bfm.identifiable_type = 14 --'LOAD'
19+
and form.edited_field in ('ACTIVE_POWER', 'REACTIVE_POWER')
20+
)
21+
update formula
22+
set edited_field = edited_field || '_SET_POINT'
23+
where id in (select id from tmp);
24+
25+
with tmp as (
26+
select form.id
27+
from formula as form
28+
inner join by_formula_modification as bfm
29+
on bfm.id=form.by_formula_modification_id
30+
where bfm.identifiable_type = 14 --'LOAD'
31+
and form.equipment_field1 in ('ACTIVE_POWER', 'REACTIVE_POWER')
32+
)
33+
update formula
34+
set equipment_field1 = equipment_field1 || '_SET_POINT'
35+
where id in (select id from tmp);
36+
37+
with tmp as (
38+
select form.id
39+
from formula as form
40+
inner join by_formula_modification as bfm
41+
on bfm.id=form.by_formula_modification_id
42+
where bfm.identifiable_type = 14 --'LOAD'
43+
and form.equipment_field2 in ('ACTIVE_POWER', 'REACTIVE_POWER')
44+
)
45+
update formula
46+
set equipment_field2 = equipment_field2 || '_SET_POINT'
47+
where id in (select id from tmp);

src/main/resources/db/changelog/db.changelog-master.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,6 @@ databaseChangeLog:
402402
- include:
403403
file: changesets/changelog_20250729T072247Z.xml
404404
relativeToChangelogFile: true
405+
- include:
406+
file: changesets/changelog_20250822T162300Z.xml
407+
relativeToChangelogFile: true

src/test/java/org/gridsuite/modification/server/modifications/byfilter/assignment/LoadModificationByAssignmentTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ protected List<AbstractFilter> getTestFilters() {
6161
@Override
6262
protected List<AssignmentInfos<?>> getAssignmentInfos() {
6363
DoubleAssignmentInfos assignmentInfos1 = DoubleAssignmentInfos.builder()
64-
.editedField(LoadField.ACTIVE_POWER.name())
64+
.editedField(LoadField.ACTIVE_POWER_SET_POINT.name())
6565
.value(25.)
6666
.filters(List.of(filter1))
6767
.build();
6868

6969
DoubleAssignmentInfos assignmentInfos2 = DoubleAssignmentInfos.builder()
70-
.editedField(LoadField.REACTIVE_POWER.name())
70+
.editedField(LoadField.REACTIVE_POWER_SET_POINT.name())
7171
.value(2.5)
7272
.filters(List.of(filter2))
7373
.build();
@@ -87,7 +87,7 @@ protected List<AssignmentInfos<?>> getAssignmentInfos() {
8787
@Override
8888
protected List<AssignmentInfos<?>> getUpdatedAssignmentInfos() {
8989
DoubleAssignmentInfos assignmentInfos1 = DoubleAssignmentInfos.builder()
90-
.editedField(LoadField.ACTIVE_POWER.name())
90+
.editedField(LoadField.ACTIVE_POWER_SET_POINT.name())
9191
.value(200.)
9292
.filters(List.of(filter1))
9393
.build();

src/test/java/org/gridsuite/modification/server/modifications/byfilter/formula/LoadByFormulaModificationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,29 @@ protected List<AbstractFilter> getTestFilters() {
5959

6060
@Override
6161
protected List<FormulaInfos> getFormulaInfos() {
62-
FormulaInfos formulaInfos1 = getFormulaInfo(LoadField.ACTIVE_POWER.name(),
62+
FormulaInfos formulaInfos1 = getFormulaInfo(LoadField.ACTIVE_POWER_SET_POINT.name(),
6363
List.of(filter1),
6464
Operator.ADDITION,
65-
ReferenceFieldOrValue.builder().equipmentField(LoadField.ACTIVE_POWER.name()).build(),
65+
ReferenceFieldOrValue.builder().equipmentField(LoadField.ACTIVE_POWER_SET_POINT.name()).build(),
6666
ReferenceFieldOrValue.builder().value(25.).build()
6767
);
6868

69-
FormulaInfos formulaInfos2 = getFormulaInfo(LoadField.REACTIVE_POWER.name(),
69+
FormulaInfos formulaInfos2 = getFormulaInfo(LoadField.REACTIVE_POWER_SET_POINT.name(),
7070
List.of(filter2),
7171
Operator.MULTIPLICATION,
72-
ReferenceFieldOrValue.builder().equipmentField(LoadField.REACTIVE_POWER.name()).build(),
72+
ReferenceFieldOrValue.builder().equipmentField(LoadField.REACTIVE_POWER_SET_POINT.name()).build(),
7373
ReferenceFieldOrValue.builder().value(2.5).build()
7474
);
7575
return List.of(formulaInfos1, formulaInfos2);
7676
}
7777

7878
@Override
7979
protected List<FormulaInfos> getUpdatedFormulaInfos() {
80-
FormulaInfos formulaInfos1 = getFormulaInfo(LoadField.ACTIVE_POWER.name(),
80+
FormulaInfos formulaInfos1 = getFormulaInfo(LoadField.ACTIVE_POWER_SET_POINT.name(),
8181
List.of(filter1),
8282
Operator.PERCENTAGE,
8383
ReferenceFieldOrValue.builder().value(200.).build(),
84-
ReferenceFieldOrValue.builder().equipmentField(LoadField.ACTIVE_POWER.name()).build()
84+
ReferenceFieldOrValue.builder().equipmentField(LoadField.ACTIVE_POWER_SET_POINT.name()).build()
8585
);
8686

8787
return List.of(formulaInfos1);

0 commit comments

Comments
 (0)