From f872f9db47fd541bed72d6d3d4d334b40657dc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Fri, 9 Dec 2022 11:45:35 +0100 Subject: [PATCH] Clean up SloFactory code --- .../rocks/theodolite/kubernetes/slo/SloFactory.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/slo/SloFactory.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/slo/SloFactory.kt index 047f8a657..ef67348c0 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/slo/SloFactory.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/slo/SloFactory.kt @@ -7,18 +7,15 @@ import rocks.theodolite.kubernetes.model.KubernetesBenchmark.Slo class SloFactory { fun createSlos(execution: BenchmarkExecution, benchmark: KubernetesBenchmark): List<Slo> { - var benchmarkSlos = benchmark.slos - var executionSlos = execution.slos + val resultSlos = benchmark.slos.toMutableList() - for(executionSlo in executionSlos) { - for(i in 0 until benchmarkSlos.size) { - if(executionSlo.name == benchmarkSlos[i].name && executionSlo.properties != null) { - for (executionProperty in executionSlo.properties!!) { - benchmarkSlos[i].properties[executionProperty.key] = executionProperty.value - } + for (executionSlo in execution.slos) { + for (resultSlo in resultSlos) { + if (executionSlo.name == resultSlo.name && executionSlo.properties != null) { + resultSlo.properties.putAll(executionSlo.properties!!) } } } - return benchmarkSlos + return resultSlos } } \ No newline at end of file -- GitLab