Skip to content

Commit

Permalink
fix: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
larshelge committed Nov 25, 2024
1 parent 8e24e08 commit 0106716
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ void verifyGetTableWithDataElements() {
.thenReturn(DatabaseInfo.builder().spatialSupport(true).build());
Program program = createProgram('A');

DataElement deA = createDataElement('Z', ValueType.TEXT, AggregationType.SUM);
DataElement deB = createDataElement('P', ValueType.PERCENTAGE, AggregationType.SUM);
DataElement deC = createDataElement('Y', ValueType.BOOLEAN, AggregationType.NONE);
DataElement deD = createDataElement('W', ValueType.DATE, AggregationType.LAST);
DataElement deE = createDataElement('G', ValueType.ORGANISATION_UNIT, AggregationType.NONE);
DataElement deF = createDataElement('H', ValueType.INTEGER, AggregationType.SUM);
DataElement deG = createDataElement('U', ValueType.COORDINATE, AggregationType.NONE);
DataElement deA = createDataElement('A', ValueType.TEXT, AggregationType.SUM);
DataElement deB = createDataElement('B', ValueType.PERCENTAGE, AggregationType.SUM);
DataElement deC = createDataElement('C', ValueType.BOOLEAN, AggregationType.NONE);
DataElement deD = createDataElement('D', ValueType.DATE, AggregationType.LAST);
DataElement deE = createDataElement('E', ValueType.ORGANISATION_UNIT, AggregationType.NONE);
DataElement deF = createDataElement('F', ValueType.INTEGER, AggregationType.SUM);
DataElement deG = createDataElement('G', ValueType.COORDINATE, AggregationType.NONE);

ProgramStage ps1 = createProgramStage('A', Set.of(deA, deB, deC, deD, deE, deF, deG));

Expand All @@ -167,13 +167,13 @@ void verifyGetTableWithDataElements() {

String aliasD1 = "json_unquote(json_extract(eventdatavalues, '$.%s.value')) as `%s`";
String aliasD2 =
"case when json_unquote(json_extract(eventdatavalues, '$.%s.value')) regexp '^(-?[0-9]+)(\\.[0-9]+)?$' then cast(json_unquote(json_extract(eventdatavalues, '$.%s.value')) as double) else null end as `deabcdefghP`";
"case when json_unquote(json_extract(eventdatavalues, '$.%s.value')) regexp '^(-?[0-9]+)(\\.[0-9]+)?$' then cast(json_unquote(json_extract(eventdatavalues, '$.%s.value')) as double) else null end as `%s`";
String aliasD3 =
"case when json_unquote(json_extract(eventdatavalues, '$.%s.value')) = 'true' then 1 when json_unquote(json_extract(eventdatavalues, '$.%s.value')) = 'false' then 0 else null end as `%s`";
String aliasD4 =
"case when json_unquote(json_extract(eventdatavalues, '$.%s.value')) regexp '^\\d{4}-\\d{2}-\\d{2}(\\s|T)?((\\d{2}:)(\\d{2}:)?(\\d{2}))?(|.(\\d{3})|.(\\d{3})Z)?$' then cast(json_unquote(json_extract(eventdatavalues, '$.%s.value')) as datetime) else null end as `%s`";
String aliasD5 =
"(select ou.uid from dhis2.public.`organisationunit` ou where ou.uid = json_unquote(json_extract(eventdatavalues, '$.deabcdefghG.value')) ) as `deabcdefghG`";
"(select ou.uid from dhis2.public.`organisationunit` ou where ou.uid = json_unquote(json_extract(eventdatavalues, '$.%s.value')) ) as `%s`";
String aliasD5Name =
"(select ou.name from dhis2.public.`organisationunit` ou where ou.uid = json_unquote(json_extract(eventdatavalues, '$.%s.value')) ) as `%s`";
String aliasD6 =
Expand Down

0 comments on commit 0106716

Please sign in to comment.