Improved startDate and endDate management for services.

This commit is contained in:
Christian P. MOMON 2022-07-24 11:01:46 +02:00
parent 8712c99894
commit 04aed10a38
3 changed files with 45 additions and 18 deletions

View file

@ -136,10 +136,7 @@ public class Service extends PathPropertyList
{
String result;
LocalDate startDate = StatoolInfosUtils.parseDate(getStartDate());
LocalDate endDate = StatoolInfosUtils.parseDate(getEndDate());
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
result = StatoolInfosUtils.toHumanDuration(getStartDate(), getEndDate());
//
return result;
@ -250,7 +247,22 @@ public class Service extends PathPropertyList
*
* @return the end date
*/
public String getEndDate()
public LocalDate getEndDate()
{
LocalDate result;
result = StatoolInfosUtils.parseDate(getEndDateValue());
//
return result;
}
/**
* Gets the end date value.
*
* @return the end date value
*/
public String getEndDateValue()
{
String result;
@ -851,7 +863,22 @@ public class Service extends PathPropertyList
*
* @return the start date
*/
public String getStartDate()
public LocalDate getStartDate()
{
LocalDate result;
result = StatoolInfosUtils.parseDate(getStartDateValue());
//
return result;
}
/**
* Gets the start date value.
*
* @return the start date value
*/
public String getStartDateValue()
{
String result;
@ -1056,7 +1083,7 @@ public class Service extends PathPropertyList
{
boolean result;
if (getEndDate() == null)
if (getEndDateValue() == null)
{
result = false;
}

View file

@ -1317,7 +1317,7 @@ public class ChartHtmlizer
YearMonth first = null;
for (Service service : services)
{
LocalDate date = StatoolInfosUtils.parseDate(service.getStartDate());
LocalDate date = service.getStartDate();
if (date != null)
{
YearMonth current = YearMonth.from(date);
@ -1361,8 +1361,8 @@ public class ChartHtmlizer
long count = 0;
for (Service service : services)
{
LocalDate startDate = StatoolInfosUtils.parseDate(service.getStartDate());
LocalDate endDate = StatoolInfosUtils.parseDate(service.getEndDate());
LocalDate startDate = service.getStartDate();
LocalDate endDate = service.getEndDate();
if (startDate != null)
{
@ -1502,7 +1502,7 @@ public class ChartHtmlizer
Integer first = null;
for (Service service : services)
{
LocalDate date = StatoolInfosUtils.parseDate(service.getStartDate());
LocalDate date = service.getStartDate();
if (date != null)
{
int current = date.getYear();
@ -1548,8 +1548,8 @@ public class ChartHtmlizer
long count = 0;
for (Service service : services)
{
LocalDate startDate = StatoolInfosUtils.parseDate(service.getStartDate());
LocalDate endDate = StatoolInfosUtils.parseDate(service.getEndDate());
LocalDate startDate = service.getStartDate();
LocalDate endDate = service.getEndDate();
if (startDate != null)
{
@ -1602,7 +1602,7 @@ public class ChartHtmlizer
long unfilled = 0;
for (Service service : services)
{
if (StatoolInfosUtils.parseDate(service.getStartDate()) == null)
if (service.getStartDate() == null)
{
unfilled += 1;
}

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.
*
@ -69,10 +69,10 @@ public class ServiceHeaderView
data.setEscapedContent("serviceDescription", StringUtils.defaultIfBlank(service.getDescription(), "n/a"));
data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDate(), "n/a"));
data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDate(), "n/a"));
data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDateValue(), "n/a"));
data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDateValue(), "n/a"));
data.setContent("serviceAge", StringUtils.defaultIfBlank(service.getAge(), "n/a"));
if (StringUtils.isBlank(service.getEndDate()))
if (StringUtils.isBlank(service.getEndDateValue()))
{
data.setAttribute("serviceEndDateData", "style", "display: none;");
}