Skip to content

Commit

Permalink
Merge pull request #226 from eu-federation-gateway-service/fix/batcht…
Browse files Browse the repository at this point in the history
…ag-name-at-midnight

fix: dublicated batch tag when batched at midnight
  • Loading branch information
mschulte-tsi authored Oct 22, 2020
2 parents 0c37629 + d6671be commit c3427a1
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
import eu.interop.federationgateway.repository.DiagnosisKeyBatchRepository;
import eu.interop.federationgateway.repository.DiagnosisKeyEntityRepository;
import eu.interop.federationgateway.utils.EfgsMdc;
import java.time.LocalDate;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -161,7 +162,8 @@ List<String> collectUploaderBatchTags() {
}

private boolean isBatchFromToday(DiagnosisKeyBatchEntity lastEntry) {
return lastEntry.getCreatedAt().toLocalDate().isEqual(LocalDate.now());
return lastEntry.getCreatedAt().toInstant().truncatedTo(ChronoUnit.DAYS).equals(
Instant.now().truncatedTo(ChronoUnit.DAYS));
}

private int getSequenceNumberFromBatchTag(String batchTag) {
Expand Down

0 comments on commit c3427a1

Please sign in to comment.