Improved startDate and endDate management for organizations.

This commit is contained in:
Christian P. MOMON 2022-07-24 10:55:50 +02:00
parent f23834d8e3
commit 8712c99894
3 changed files with 40 additions and 13 deletions

View file

@ -148,10 +148,7 @@ public class Organization extends PathPropertyList
{ {
String result; String result;
LocalDate startDate = StatoolInfosUtils.parseDate(getStartDate()); result = StatoolInfosUtils.toHumanDuration(getStartDate(), getEndDate());
LocalDate endDate = StatoolInfosUtils.parseDate(getEndDate());
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
// //
return result; return result;
@ -272,7 +269,22 @@ public class Organization extends PathPropertyList
* *
* @return the end date * @return the end date
*/ */
public String getEndDate() public LocalDate getEndDate()
{
LocalDate result;
result = StatoolInfosUtils.parseDate(getEndDateValue());
//
return result;
}
/**
* Gets the end date.
*
* @return the end date
*/
public String getEndDateValue()
{ {
String result; String result;
@ -743,7 +755,22 @@ public class Organization extends PathPropertyList
* *
* @return the start date * @return the start date
*/ */
public String getStartDate() public LocalDate getStartDate()
{
LocalDate result;
result = StatoolInfosUtils.parseDate(getStartDateValue());
//
return result;
}
/**
* Gets the start date.
*
* @return the start date
*/
public String getStartDateValue()
{ {
String result; String result;
@ -1112,7 +1139,7 @@ public class Organization extends PathPropertyList
{ {
boolean result; boolean result;
if ((getServiceCount() == 0) && (getLogoURLValue() == null) && (getStartDate() == null)) if ((getServiceCount() == 0) && (getLogoURLValue() == null) && (getStartDateValue() == null))
{ {
result = true; result = true;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org> * Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
* *
* This file is part of StatoolInfos, simple service statistics tool. * This file is part of StatoolInfos, simple service statistics tool.
* *
@ -71,10 +71,10 @@ public class OrganizationHeaderView
data.setEscapedContent("organizationDescription", organization.get("organization.description")); data.setEscapedContent("organizationDescription", organization.get("organization.description"));
data.setEscapedContent("organizationMemberOfName", StringUtils.defaultIfBlank(organization.getFederation().getName(), "n/a")); data.setEscapedContent("organizationMemberOfName", StringUtils.defaultIfBlank(organization.getFederation().getName(), "n/a"));
data.setContent("organizationStartDate", StringUtils.defaultIfBlank(organization.getStartDate(), "n/a")); data.setContent("organizationStartDate", StringUtils.defaultIfBlank(organization.getStartDateValue(), "n/a"));
data.setContent("organizationEndDate", StringUtils.defaultIfBlank(organization.getEndDate(), "n/a")); data.setContent("organizationEndDate", StringUtils.defaultIfBlank(organization.getEndDateValue(), "n/a"));
data.setContent("organizationAge", StringUtils.defaultIfBlank(organization.getAge(), "n/a")); data.setContent("organizationAge", StringUtils.defaultIfBlank(organization.getAge(), "n/a"));
if (StringUtils.isBlank(organization.getEndDate())) if (StringUtils.isBlank(organization.getEndDateValue()))
{ {
data.setContent("organizationMemberOfWord", "depuis"); data.setContent("organizationMemberOfWord", "depuis");
data.setAttribute("organizationEndDateData", "style", "display: none;"); data.setAttribute("organizationEndDateData", "style", "display: none;");

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org> * Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
* *
* This file is part of StatoolInfos, simple service statistics tool. * This file is part of StatoolInfos, simple service statistics tool.
* *
@ -507,7 +507,7 @@ public class StatAgent
// //
for (Organization organization : organizations) for (Organization organization : organizations)
{ {
if (StringUtils.isBlank(organization.getStartDate())) if (StringUtils.isBlank(organization.getStartDateValue()))
{ {
result.incPassiveCount(); result.incPassiveCount();
} }