Improved code.

This commit is contained in:
Christian P. MOMON 2022-01-22 19:29:44 +01:00
parent defa20b003
commit 2ee42fd197
2 changed files with 12 additions and 13 deletions

View file

@ -101,15 +101,14 @@ public class Federation extends PathPropertyList
* *
* @return the active services * @return the active services
*/ */
public Services getActiveServices() public long getActiveServiceCount()
{ {
Services result; long result;
result = new Services();
result = 0;
for (Organization organization : getActiveOrganizations()) for (Organization organization : getActiveOrganizations())
{ {
result.addAll(organization.getActiveServices()); result += organization.getActiveServiceCount();
} }
// //
@ -121,14 +120,15 @@ public class Federation extends PathPropertyList
* *
* @return the active services * @return the active services
*/ */
public long getActiveServiceCount() public Services getActiveServices()
{ {
long result; Services result;
result = new Services();
result = 0;
for (Organization organization : getActiveOrganizations()) for (Organization organization : getActiveOrganizations())
{ {
result += organization.getActiveServiceCount(); result.addAll(organization.getActiveServices());
} }
// //
@ -510,7 +510,7 @@ public class Federation extends PathPropertyList
result = new Softwares(); result = new Softwares();
for (Service service : getServicesAll()) for (Service service : getServices())
{ {
if (StringUtils.isNotBlank(service.getSoftwareName())) if (StringUtils.isNotBlank(service.getSoftwareName()))
{ {

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.
* *
@ -1271,8 +1271,7 @@ public class ChartHtmlizer
{ {
String result; String result;
result = htmlizeServiceCountYearChart(federation.getServicesAll(), result = htmlizeServiceCountYearChart(federation.getServices(), StatoolInfosUtils.parseDate(federation.getStartDate()).getYear());
StatoolInfosUtils.parseDate(federation.getStartDate()).getYear());
// //
return result; return result;