Fixed registration type stats.

This commit is contained in:
Christian P. MOMON 2021-05-26 02:05:45 +02:00
parent 453d1c51bc
commit 08a88600ef
2 changed files with 59 additions and 4 deletions

View file

@ -878,6 +878,28 @@ public class Service extends PathPropertyList
return result;
}
/**
* Checks if is registration unknown.
*
* @return true, if is registration unknown
*/
public boolean isRegistrationUnknown()
{
boolean result;
if (isRegistrationNone() || isRegistrationFree() || isRegistrationMember() || isRegistrationClient())
{
result = false;
}
else
{
result = true;
}
//
return result;
}
public void setInputFile(final File inputFile)
{
this.inputFile = inputFile;

View file

@ -320,19 +320,23 @@ public class StatAgent
{
result.inc(RegistrationType.NONE);
}
else if (service.isRegistrationFree())
if (service.isRegistrationFree())
{
result.inc(RegistrationType.FREE);
}
else if (service.isRegistrationMember())
if (service.isRegistrationMember())
{
result.inc(RegistrationType.MEMBER);
}
else if (service.isRegistrationClient())
if (service.isRegistrationClient())
{
result.inc(RegistrationType.CLIENT);
}
else
if (service.isRegistrationUnknown())
{
result.inc(RegistrationType.UNKNOWN);
}
@ -489,4 +493,33 @@ public class StatAgent
//
return result;
}
/**
* Stats organization turnout.
*
* @param service
* the service
* @return the organization turnout stats
*/
public static OrganizationTurnoutStats statsOrganizationTurnout(final Service service)
{
OrganizationTurnoutStats result;
result = new OrganizationTurnoutStats();
//
PathPropertyList lines = service.getByPattern("metrics\\..*\\.\\d{4}\\.(months|weeks|days)");
if (lines.hasFilledValue())
{
result.incWithServiceMetricCount();
}
else
{
result.incWithServiceFileCount();
}
//
return result;
}
}