Skip to content

Commit

Permalink
Merge pull request #3117 from ingef/feature/use-lastn-years-for-obser…
Browse files Browse the repository at this point in the history
…vation-period

use years as observationPeriod
  • Loading branch information
awildturtok authored Jun 29, 2023
2 parents af4362d + 8c1ad74 commit a60bff3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -38,7 +40,7 @@ public FrontendConfiguration getFrontendConfig() {
idColumns,
frontendConfig.getManualUrl(),
frontendConfig.getContactEmail(),
frontendConfig.getObservationStart()
Year.now().minusYears(frontendConfig.getObservationPeriodYears()).atDay(1)
);
}

Expand Down

0 comments on commit a60bff3

Please sign in to comment.