Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Feat/added Logging for setting SC (#105)
Browse files Browse the repository at this point in the history
* added Logging for setting SC

* Update src/main/java/app/coronawarn/testresult/service/TestResultService.java

* Update TestResultService.java

Co-authored-by: Felix Dittrich <31076102+f11h@users.noreply.github.com>
  • Loading branch information
mschulte-tsi and f11h authored Oct 8, 2021
1 parent d47199f commit 80ce457
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public TestResult toModel(TestResultEntity entity) {
*/
public TestResultEntity toEntity(TestResult model) {
if (model.getSc() == null) {
log.info("Set Sc during conversion to Entity for Lab {}", model.getLabId());
model.setSc(LocalDateTime.now().toEpochSecond(ZoneOffset.UTC));
}
return new TestResultEntity()
Expand Down Expand Up @@ -95,6 +96,7 @@ public TestResult createOrUpdate(final TestResult result) {
log.info("Updating test result in database.");
LocalDateTime sc = LocalDateTime.now();
if (result.getSc() != null) {
log.warn("Set Sc for Lab {}", result.getLabId());
sc = LocalDateTime.ofEpochSecond(result.getSc(),0, ZoneOffset.UTC);
}
entity.setResult(result.getResult())
Expand Down Expand Up @@ -130,6 +132,7 @@ public TestResult getOrCreate(final String id, boolean quicktest, Long sc) {
resultEntity.setResultId(id);
}
if (sc == null) {
log.info("Set Sc during get or create");
resultEntity.setResultDate(LocalDateTime.now());
} else {
resultEntity.setResultDate(LocalDateTime.ofEpochSecond(sc, 0, ZoneOffset.UTC));
Expand Down

0 comments on commit 80ce457

Please sign in to comment.