Explorar el Código

Fix PDF test values not being set properly

Alan Lam hace 4 años
padre
commit
b0886f01d3
Se han modificado 2 ficheros con 6 adiciones y 4 borrados
  1. 5 3
      controllers/test_pdf.php
  2. 1 1
      engine/test.php

+ 5 - 3
controllers/test_pdf.php

@@ -30,10 +30,12 @@ $location = $test->getLocation();
 $tester = $test->getTester();
 
 $test_values = $test->getValues();
-$keys = array_column($test_values, "name");
-$values = array_column($test_values, "value");
+$values = [];
+
+foreach($test_values as $value) {
+	$values[$value->name] = $value->value;
+}
 
-$values = array_combine($keys, $values);
 $values = array_filter($values, function($value) {
 	return strlen($value) !== 0;
 });

+ 1 - 1
engine/test.php

@@ -487,7 +487,7 @@ class Test extends Model {
 
 	/**
 	 * @param bool $as_assoc_array
-	 * @return array
+	 * @return TestValue[]
 	 * @throws Exception
 	 */
 	public function getValues(bool $as_assoc_array = false): array {