From a62614f86523f740ecbba2c8f9c39aef3b177b4a Mon Sep 17 00:00:00 2001
From: Jan-Niclas Struewer <j.n.struewer@gmail.com>
Date: Mon, 30 Oct 2023 15:12:17 +0100
Subject: [PATCH] added order property for KPIs to enable custom sorting

---
 .../iem/dataprovider/kpi/dto/KPITreeResponseDto.kt       | 3 ++-
 .../iem/dataprovider/kpi/enumeration/KpiKind.kt          | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/dto/KPITreeResponseDto.kt b/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/dto/KPITreeResponseDto.kt
index cc879d65..4369ab0b 100644
--- a/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/dto/KPITreeResponseDto.kt
+++ b/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/dto/KPITreeResponseDto.kt
@@ -7,5 +7,6 @@ data class KPITreeResponseDto(
     val isRoot: Boolean = false,
     val displayValue: String? = null,
     val children: List<KPITreeChildResponseDto>,
-    val isEmpty: Boolean
+    val isEmpty: Boolean,
+    val order: Int = 1
 )
diff --git a/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/enumeration/KpiKind.kt b/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/enumeration/KpiKind.kt
index 5f843c29..920adcce 100644
--- a/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/enumeration/KpiKind.kt
+++ b/src/main/kotlin/de/fraunhofer/iem/dataprovider/kpi/enumeration/KpiKind.kt
@@ -222,7 +222,8 @@ enum class KpiKind {
                     " For this purpose, the development process traceable in the repository is" +
                     " compared with common development standards to enable an assessment.",
                 children = children,
-                isEmpty = isEmpty
+                isEmpty = isEmpty,
+                order = 4
             )
         }
 
@@ -244,7 +245,8 @@ enum class KpiKind {
                     " various analyzes are performed that assess the availability of information " +
                     "about the software development process within the repository.",
                 children = children,
-                isEmpty = isEmpty
+                isEmpty = isEmpty,
+                order = 3
             )
         }
 
@@ -265,7 +267,8 @@ enum class KpiKind {
                     "various security-relevant analyzes are carried out, which, among other things," +
                     " check the external dependencies or the code for vulnerabilities.",
                 children = children,
-                isEmpty = isEmpty
+                isEmpty = isEmpty,
+                order = 2
             )
         }
 
-- 
GitLab