This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch v2 in repository https://gitbox.apache.org/repos/asf/causeway-app-petclinic.git
commit bf8c8de5e64104f71147dfb24bbd34dc1b8c9355 Author: Dan Haywood <[email protected]> AuthorDate: Sat May 25 14:45:42 2024 +0100 adds PetOwner#getDaysSinceLastVisit derived property --- .../java/domainapp/modules/petowner/dom/petowner/PetOwner.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java index 29a659e..166d0f8 100644 --- a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java +++ b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java @@ -2,6 +2,7 @@ package domainapp.modules.petowner.dom.petowner; import java.time.LocalTime; import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; import java.util.Comparator; import javax.inject.Inject; @@ -185,6 +186,13 @@ public class PetOwner implements Comparable<PetOwner>, CalendarEventable { private java.time.LocalDate lastVisit; + @Property + @PropertyLayout(fieldSetId = LayoutConstants.FieldSetId.DETAILS, sequence = "3.1") + public long getDaysSinceLastVisit() { + return Math.abs(ChronoUnit.DAYS.between(getLastVisit(), clockService.getClock().nowAsLocalDate())); + } + + @Override public String getCalendarName() { return "Last checked-in";
