From 8c1ad749a8f6b7c04655e045dc8e45f940c715a2 Mon Sep 17 00:00:00 2001 From: awildturtok <1553491+awildturtok@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:13:33 +0200 Subject: [PATCH] use years as observationPeriod --- .../bakdata/conquery/models/config/FrontendConfig.java | 9 ++++----- .../bakdata/conquery/resources/api/ConfigResource.java | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/com/bakdata/conquery/models/config/FrontendConfig.java b/backend/src/main/java/com/bakdata/conquery/models/config/FrontendConfig.java index 599b78a222..1bbfcddd56 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/config/FrontendConfig.java +++ b/backend/src/main/java/com/bakdata/conquery/models/config/FrontendConfig.java @@ -2,12 +2,11 @@ import java.net.URI; import java.net.URL; -import java.time.LocalDate; -import java.time.temporal.ChronoUnit; import javax.annotation.Nullable; import javax.validation.Valid; import javax.validation.constraints.Email; +import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import com.bakdata.conquery.models.forms.frontendconfiguration.FormScanner; @@ -29,10 +28,10 @@ public class FrontendConfig { private CurrencyConfig currency = new CurrencyConfig(); /** - * Default start-date for EntityPreview and DatePicker. + * Years to include in entity preview. */ - @NotNull - private LocalDate observationStart = LocalDate.now().minus(10, ChronoUnit.YEARS); + @Min(0) + private int observationPeriodYears = 6; /** * The url that points a manual. This is also used by the {@link FormScanner} diff --git a/backend/src/main/java/com/bakdata/conquery/resources/api/ConfigResource.java b/backend/src/main/java/com/bakdata/conquery/resources/api/ConfigResource.java index 0c2432c762..deeb7e5d21 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/api/ConfigResource.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/api/ConfigResource.java @@ -1,5 +1,7 @@ package com.bakdata.conquery.resources.api; +import java.time.Year; + import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -38,7 +40,7 @@ public FrontendConfiguration getFrontendConfig() { idColumns, frontendConfig.getManualUrl(), frontendConfig.getContactEmail(), - frontendConfig.getObservationStart() + Year.now().minusYears(frontendConfig.getObservationPeriodYears()).atDay(1) ); }