Skip to content

Commit

Permalink
fix: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
larshelge committed Dec 11, 2024
1 parent 221a551 commit 7b0af20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import static org.hisp.dhis.analytics.util.AnalyticsUtils.getColumnType;
import static org.hisp.dhis.db.model.DataType.GEOMETRY;
import static org.hisp.dhis.db.model.DataType.TEXT;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -217,7 +218,7 @@ private List<AnalyticsTableColumn> getColumnForOrgUnitAttribute(
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

Validate.isTrue(attribute.getValueType().isOrganisationUnit());
List<AnalyticsTableColumn> columns = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import static org.hisp.dhis.system.util.MathUtils.NUMERIC_LENIENT_REGEXP;
import static org.hisp.dhis.util.DateUtils.toLongDate;
import static org.hisp.dhis.util.DateUtils.toMediumDate;

import java.time.Year;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -49,6 +50,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.hisp.dhis.analytics.AnalyticsTableHookService;
import org.hisp.dhis.analytics.AnalyticsTableType;
import org.hisp.dhis.analytics.AnalyticsTableUpdateParams;
Expand Down Expand Up @@ -86,7 +88,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import lombok.extern.slf4j.Slf4j;

/**
* @author Lars Helge Overland
Expand Down Expand Up @@ -515,16 +516,16 @@ private List<AnalyticsTableColumn> getColumnForDataElement(
}

/**
* Retyrns a select expression.
*
* Returns a select expression.
*
* @param dataElement the {@link DataElement}.
* @param columnExpression the column expression.
* @return a select expression.
*/
private String getSelectExpression(DataElement dataElement, String columnExpression) {
return String.format("%s as %s", columnExpression, quote(dataElement.getUid()));
}

/**
* Returns a list of columns.
*
Expand All @@ -536,7 +537,7 @@ private List<AnalyticsTableColumn> getColumnForOrgUnitDataElement(DataElement da
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

List<AnalyticsTableColumn> columns = new ArrayList<>();

if (isSpatialSupport()) {
Expand Down Expand Up @@ -618,7 +619,7 @@ private List<AnalyticsTableColumn> getColumnForAttributeWithLegendSet(
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

String columnExpression = getColumnExpression(attribute.getValueType(), "value");
String numericClause = getNumericClause("value");
String query =
Expand Down Expand Up @@ -666,7 +667,7 @@ private List<AnalyticsTableColumn> getColumnFromDataElementWithLegendSet(
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

String query =
"""
(select l.uid from ${maplegend} l \
Expand Down

0 comments on commit 7b0af20

Please sign in to comment.