You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/07/22 21:44:33 UTC

(causeway-app-petclinic) 02/03: updates persona to create a more realistic 'lastVisit' date

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to tag tags/3.1.0/03-03-remaining-PetOwner-properties
in repository https://gitbox.apache.org/repos/asf/causeway-app-petclinic.git

commit 82ad4732643f784e2adaab463d5e1fa32df9e182
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu May 23 06:49:21 2024 +0100

    updates persona to create a more realistic 'lastVisit' date
---
 .../java/domainapp/modules/petowner/fixture/PetOwner_persona.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java b/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
index dac7045..e07594e 100644
--- a/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
+++ b/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
@@ -2,6 +2,7 @@ package domainapp.modules.petowner.fixture;
 
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.time.LocalDate;
 
 import jakarta.inject.Inject;
 
@@ -74,7 +75,9 @@ implements Persona<PetOwner, PetOwner_persona.Builder> {
                 petOwner.setKnownAs(persona.knownAs);
             }
 
-            petOwner.setLastVisit(clockService.getClock().nowAsLocalDate().plusDays(fakeDataService.ints().between(-10, +10)));
+            final var numDaysAgo = fakeDataService.ints().between(2, 100);
+            final var lastVisit = clockService.getClock().nowAsLocalDate().minusDays(numDaysAgo);
+            petOwner.setLastVisit(lastVisit);
 
             return petOwner;
         }