From 90657bb9dfc55a743608a8a281e7a82283c774aa Mon Sep 17 00:00:00 2001
From: Lars Johansson <lars.johansson@ess.eu>
Date: Wed, 8 Jun 2022 13:38:25 +0200
Subject: [PATCH] Update report about Naming

---
 .../rest/controller/ReportController.java     | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/openepics/names/rest/controller/ReportController.java b/src/main/java/org/openepics/names/rest/controller/ReportController.java
index aa37b329..7cb7f53f 100644
--- a/src/main/java/org/openepics/names/rest/controller/ReportController.java
+++ b/src/main/java/org/openepics/names/rest/controller/ReportController.java
@@ -110,6 +110,7 @@ public class ReportController {
                               2) ESS names
                               3) System structure
                               4) Device structure
+                              5) Device structure - P&ID Disciplines
                           """
     )
     @ApiResponses(value = {
@@ -138,23 +139,23 @@ public class ReportController {
         long nbrEssNameSystemstructure = 0;
         long nbrEssNameSystemstructureDevicestructure = 0;
         long nbrEssNameSystemstructureDevicestructureIndex = 0;
+        long nbrEssNameOther = 0;
 
-        for (NameElement nameElement : nameElementsEssNames.getList()) {
-            if (Boolean.FALSE.equals(nameElement.isDeleted())
-                    && !StringUtils.isEmpty(nameElement.getSystemstructure())
+        for (NameElement nameElement : nameElementsEssNamesNotDeleted.getList()) {
+            if (!StringUtils.isEmpty(nameElement.getSystemstructure())
                     && StringUtils.isEmpty(nameElement.getDevicestructure())
                     && StringUtils.isEmpty(nameElement.getIndex())) {
                 nbrEssNameSystemstructure++;
-            } else if (Boolean.FALSE.equals(nameElement.isDeleted())
-                    && !StringUtils.isEmpty(nameElement.getSystemstructure())
+            } else if (!StringUtils.isEmpty(nameElement.getSystemstructure())
                     && !StringUtils.isEmpty(nameElement.getDevicestructure())
                     && StringUtils.isEmpty(nameElement.getIndex())) {
                 nbrEssNameSystemstructureDevicestructure++;
-            } else if (Boolean.FALSE.equals(nameElement.isDeleted())
-                    && !StringUtils.isEmpty(nameElement.getSystemstructure())
+            } else if (!StringUtils.isEmpty(nameElement.getSystemstructure())
                     && !StringUtils.isEmpty(nameElement.getDevicestructure())
                     && !StringUtils.isEmpty(nameElement.getIndex())) {
                 nbrEssNameSystemstructureDevicestructureIndex++;
+            } else {
+                nbrEssNameOther++;
             }
         }
 
@@ -413,7 +414,7 @@ public class ReportController {
         .append("    2) # entries - ESS names").append(NEWLINE)
         .append("    3) # entries - System structure").append(NEWLINE)
         .append("    4) # entries - Device structure").append(NEWLINE)
-        .append("    5) Device structure - P&ID Discipline").append(NEWLINE)
+        .append("    5) Device structure - P&ID Disciplines").append(NEWLINE)
         .append(DIVIDER_128).append(NEWLINE);
 
         // report overview
@@ -456,7 +457,7 @@ public class ReportController {
         sb.append(DIVIDER_96).append(NEWLINE);
         sb.append("5) Device structure - P&ID Disciplines").append(NEWLINE);
         sb.append(DIVIDER_96).append(NEWLINE);
-        // discipline p&id, scientific
+        // disciplines p&id, scientific
         sb.append(metricsPIDDiscipline.toString()).append(NEWLINE);
         sb.append(DIVIDER_128).append(NEWLINE);
 
-- 
GitLab