commit d5ecddcb01aeaa122d102fb2bdc7eca8667f5bd0
Author: mlinha <mlinha@students.zcu.cz>
Date:   Sun Aug 9 23:48:27 2020 +0200

    re #8113 re #7885 bug fixes, list generation re #8134 changed row indentations in previous commit; re #8154 nothing; no comments

diff --git a/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java b/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
index 79b59f0d..3424286e 100644
--- a/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
@@ -95,11 +95,16 @@ public class SqlQueryManagerImpl implements SqlQueryManager {
                             parameterInConfiguration.getParameter().getName(), function.getName().toUpperCase(),
                             parameterInConfiguration.getParameter().getParameterType().getName()));
                 }
+                if (valueFunctions.size() == 0) {
+                    valueFunctions.add(new ValueFunction(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
+                            parameterInConfiguration.getParameter().getName(), "",
+                            parameterInConfiguration.getParameter().getParameterType().getName()));
+                }
             }
         }
 
         if (valueFunctions.size() == 0) {
-            valueFunctions.add(new ValueFunction("", "", "", "Seznam"));
+            valueFunctions.add(new ValueFunction("", "nic", "NIC", ""));
         }
     }
 
@@ -142,7 +147,6 @@ public class SqlQueryManagerImpl implements SqlQueryManager {
                         finalSQLQuery.append(otherOperators(values, parameterInConfiguration.getParameter().getParameterType().getName()));
                         break;
                 }
-
             }
         }
 
diff --git a/src/main/java/vldc/aswi/utils/Converter.java b/src/main/java/vldc/aswi/utils/Converter.java
index 511e02e8..2967ca3f 100644
--- a/src/main/java/vldc/aswi/utils/Converter.java
+++ b/src/main/java/vldc/aswi/utils/Converter.java
@@ -38,6 +38,7 @@ public class Converter {
     public List<ContingencyTableRow> convertTableColumnsToContingencyTableRows() {
         long startTime = System.nanoTime();
 
+        long startTime1 = System.nanoTime();
         columnNodes = new ArrayList<>();
         List<List<String>> values = new ArrayList<>();
         for(NameUserName nameUserName : columnNames) {
@@ -48,6 +49,9 @@ public class Converter {
         Node startNode = new Node();
         generateColumns(0, values, columnNodes, startNode);
 
+        long stopTime1 = System.nanoTime();
+        System.out.println("Colums list:" + TimeUnit.MILLISECONDS.convert((stopTime1 - startTime1), TimeUnit.NANOSECONDS));
+
         List<ContingencyTableRow> contingencyTableRows = new ArrayList<>();
 
         long startTime2 = System.nanoTime();
@@ -87,31 +91,18 @@ public class Converter {
      * @return list of contingency table rows
      */
     private List<ContingencyTableRow> createHeaderOnlyRows() {
-        //columnNodes = new ArrayList<>();
         List<ContingencyTableRow> headerRows = new ArrayList<>();
 
-//        List<String> valueOptions = new ArrayList<>();
-//
-//        for (ValueFunction valueFunction : valueFunctions) {
-//            if (!valueFunctions.get(0).getType().equals("Seznam")) {
-//                valueOptions.add(valueFunction.getFunction() + " z " + valueFunction.getName());
-//            }
-//            else if (valueFunctions.get(0).getType().equals("Seznam") && columnNames.size() > 0) {
-//                valueOptions.add("NIC z nic");
-//            }
-//        }
-
-        //values.add(valueOptions);
         headerRows.add(new ContingencyTableRow(true, 0));
 
         for (int i = 0; i < columnNames.size(); i++) {
-            //NameUserName ignored = columnNames.get(i);
-            //TableColumn column = tableColumns.get(nameUserName.getName());
             headerRows.add(new ContingencyTableRow(true, 0));
         }
 
-        if (valueFunctions.get(0).getType().equals("Seznam")) {
+        if (valueFunctions.get(0).getFunction() != null && valueFunctions.get(0).getFunction().equals("NIC") &&
+                columnNames.size() == 0) {
             headerRows.get(0).addTableRowCell(new ContingencyTableRowCell("Seznam", 1));
+
             return headerRows;
         }
 
@@ -154,7 +145,10 @@ public class Converter {
                 }
 
                 prevSize = columnNode.getValues().size();
-                prevValues.remove(prevValues.size() - 1);
+
+                if (!prevValues.isEmpty()) {
+                    prevValues.remove(prevValues.size() - 1);
+                }
             }
         }
 
@@ -166,12 +160,6 @@ public class Converter {
                     " z " + valueFunction.getName(), 1));
         }
 
-
-
-        long startTime = System.nanoTime();
-        long stopTime = System.nanoTime();
-        System.out.println("Colums list:" + TimeUnit.MILLISECONDS.convert((stopTime - startTime), TimeUnit.NANOSECONDS));
-
         return headerRows;
     }
 
@@ -220,8 +208,8 @@ public class Converter {
 
         dataRows.removeAll(rowsToBeRemoved);
 
-        if (!valueFunctions.get(0).getType().equals("Seznam") ||
-                (valueFunctions.get(0).getType().equals("Seznam") && columnNames.size() > 0)) {
+        if (valueFunctions.get(0).getFunction() != null && (!valueFunctions.get(0).getFunction().equals("NIC") ||
+                (valueFunctions.get(0).getFunction().equals("NIC") && columnNames.size() > 0))) {
             dataRows.add(createFinalRow());
         }
 
@@ -303,7 +291,8 @@ public class Converter {
 
         List<Integer> usableIDs = getUsableIDs(node);
 
-        if (valueFunctions.get(0).getType().equals("Seznam") && !usableIDs.isEmpty()) {
+        if (valueFunctions.get(0).getFunction() != null && valueFunctions.get(0).getFunction().equals("NIC") &&
+                !usableIDs.isEmpty()) {
             return true;
         }
 
@@ -314,9 +303,13 @@ public class Converter {
         initializeWrapperField(totalsAvgSum);
 
         boolean[] isFilledValueCells = new boolean[valueFunctions.size()];
-        int columnIndex = 0;
         //hodnota
         for (int v = 0; v < valueFunctions.size(); v++) {
+            if (valueFunctions.get(v).getFunction() != null && (valueFunctions.get(v).getFunction().equals("") ||
+                    valueFunctions.get(v).getFunction().equals("NIC"))) {
+                isRowUsable = true;
+                break;
+            }
             BooleanWrapper isFirstMinMaxTotal = new BooleanWrapper(true);
             ValueFunction valueFunction = valueFunctions.get(v);
             //sloupec v kont. tabulce
@@ -364,11 +357,10 @@ public class Converter {
                     row.addTableRowCell(generateFilledCell(valueFunction.getFunction(), result.getValue(), result.getValue(), result.getValue(),
                             result.getValue(), resultAvgSum.getValue(), result.getValue()));
                 }
-                columnIndex++;
             }
         }
         for (int i = 0; i < valueFunctions.size(); i++) {
-            if (valueFunctions.get(i).getType().equals("Seznam")) {
+            if (valueFunctions.get(i).getFunction() != null && valueFunctions.get(i).getFunction().equals("NIC")) {
                 break;
             }
             if (!isFilledValueCells[i]) {
@@ -583,6 +575,10 @@ public class Converter {
         ContingencyTableRow finalRow = new ContingencyTableRow(false, 0);
         finalRow.addTableRowCell(new ContingencyTableRowCell("Celkem", 1));
 
+        if (valueFunctions.get(0).getFunction() != null && valueFunctions.get(0).getFunction().equals("NIC")) {
+            return finalRow;
+        }
+
         List<ContingencyTableRowCell> valueCells = new ArrayList<>();
         for (ValueFunction valueFunction : valueFunctions) {
             for (Node columnNode : columnNodes) {
