Replaced 0 value with emoji in tables.

This commit is contained in:
Christian P. MOMON 2022-01-21 00:31:33 +01:00
parent 0e47ac2dae
commit 1d36510ac3
3 changed files with 33 additions and 6 deletions

View file

@ -65,6 +65,32 @@ public class StatoolInfosUtils
public static final DateTimeFormatter PATTERN_SHORTDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy", Locale.FRANCE);
public static final DateTimeFormatter PATTERN_LONGDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE);
/**
* Default if zero.
*
* @param value
* the value
* @param defaultValue
* the default value
* @return the string
*/
public static String defaultIfZero(final long value, final String defaultValue)
{
String result;
if (value == 0)
{
result = defaultValue;
}
else
{
result = String.valueOf(value);
}
//
return result;
}
/**
* Epoch to local date time.
*

View file

@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Organization;
import fr.devinsy.statoolinfos.core.Organizations;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
@ -78,9 +79,9 @@ public class OrganizationListView
data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString());
data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString());
}
data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceActiveCount());
data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount());
data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount());
data.setContent("organizationListLine", index, "organizationListLineServiceCount", StatoolInfosUtils.defaultIfZero(organization.getServiceActiveCount(), "😿"));
data.setContent("organizationListLine", index, "organizationListLineUserCount", StatoolInfosUtils.defaultIfZero(organization.getPreviousMonthUserCount(), "😢"));
data.setContent("organizationListLine", index, "organizationListLineVisitCount", StatoolInfosUtils.defaultIfZero(organization.getPreviousMonthVisitCount(), "😞"));
data.setContent("organizationListLine", index, "organizationListLineDate", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY")));
data.setAttribute("organizationListLine", index, "organizationListLineDate", "title", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("HH:mm:ss")));

View file

@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Service;
import fr.devinsy.statoolinfos.core.Services;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.DisplayMode;
import fr.devinsy.xidyn.data.TagDataManager;
@ -88,9 +89,8 @@ public class ServiceListView
data.setEscapedContent("serviceListLine", index, "serviceListLineSoftwareLink", service.getSoftwareName());
data.setAttribute("serviceListLine", index, "serviceListLineSoftwareLink", "href", "software-" + service.getSoftwareTechnicalName() + ".xhtml");
data.setContent("serviceListLine", index, "serviceListLineUserCount", service.getPreviousMonthUserCount());
data.setContent("serviceListLine", index, "serviceListLineVisitCount", service.getPreviousMonthVisitCount());
data.setContent("serviceListLine", index, "serviceListLineUserCount", StatoolInfosUtils.defaultIfZero(service.getPreviousMonthUserCount(), "😞"));
data.setContent("serviceListLine", index, "serviceListLineVisitCount", StatoolInfosUtils.defaultIfZero(service.getPreviousMonthVisitCount(), "😢"));
data.setEscapedContent("serviceListLine", index, "serviceListLineDate", service.getCrawledDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY")));
data.setEscapedAttribute("serviceListLine", index, "serviceListLineDate", "title", service.getCrawledDate().format(DateTimeFormatter.ofPattern("HH:mm:ss")));