From acca082714941e8ba63ed5baeb8f4fb5e0c6e4a6 Mon Sep 17 00:00:00 2001 From: Nikita Dementev Date: Fri, 10 Jun 2022 18:49:24 +0300 Subject: [PATCH] Fix arithmetic division by zero in the DatasetTestReport API (#729) --- .../oddplatform/mapper/DataQualityMapper.java | 5 ++++- odd-platform-api/src/main/resources/application.yml | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/mapper/DataQualityMapper.java b/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/mapper/DataQualityMapper.java index 6878e9c8e..4b58b0ccf 100644 --- a/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/mapper/DataQualityMapper.java +++ b/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/mapper/DataQualityMapper.java @@ -7,6 +7,9 @@ @Mapper(config = MapperConfig.class, uses = OffsetDateTimeMapper.class) public interface DataQualityMapper { - @Mapping(target = "score", expression = "java( (int)(100 * report.getSuccessTotal() / report.getTotal()) )") + @Mapping( + target = "score", + expression = "java( report.getTotal() != 0 ? (int)(100 * report.getSuccessTotal() / report.getTotal()) : 0 )" + ) DataSetTestReport mapDatasetTestReport(final DatasetTestReportDto report); } \ No newline at end of file diff --git a/odd-platform-api/src/main/resources/application.yml b/odd-platform-api/src/main/resources/application.yml index 87dd5f805..1dc8f5b86 100644 --- a/odd-platform-api/src/main/resources/application.yml +++ b/odd-platform-api/src/main/resources/application.yml @@ -79,6 +79,8 @@ management: health: ldap: enabled: false + redis: + enabled: false logging: level: