Skip to content

Commit dfabd6e

Browse files
committed
Fix indexerror in scutter
1 parent dcd4c34 commit dfabd6e

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

data.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
function getDifficultyOfImplementationWithDependencies($dimensions, $elementImplementation, &$allElements)
6161
{
62+
$aggregated = ($_GET['aggregated'] ?? false) == "true" ? "true" : false;
6263
if ($elementImplementation == null) {
6364
return;
6465
}
@@ -69,7 +70,7 @@ function getDifficultyOfImplementationWithDependencies($dimensions, $elementImpl
6970
$allElements[] = $elementImplementation['difficultyOfImplementation']["time"];
7071
$allElements[] = $elementImplementation['difficultyOfImplementation']["resources"];
7172

72-
if (array_key_exists('dependsOn', $elementImplementation) && $_GET['aggregated'] == "true") {
73+
if (array_key_exists('dependsOn', $elementImplementation) && $aggregated == "true") {
7374
foreach ($elementImplementation['dependsOn'] as $dependency) {
7475
$dependencyElement = getElementByName($dimensions, $dependency);
7576
getDifficultyOfImplementationWithDependencies($dimensions, $dependencyElement, $allElements);
@@ -87,6 +88,7 @@ function getDifficultyOfImplementationWithDependencies($dimensions, $elementImpl
8788

8889
function getDifficultyOfImplementation($dimensions, $elementImplementation)
8990
{
91+
$aggregated = ($_GET['aggregated'] ?? false) == "true" ? "true" : false;
9092
if ($elementImplementation == null) {
9193
return;
9294
}
@@ -96,7 +98,7 @@ function getDifficultyOfImplementation($dimensions, $elementImplementation)
9698
$value = $knowledge + $elementImplementation['difficultyOfImplementation']["time"] * 2 + $elementImplementation['difficultyOfImplementation']["resources"];
9799
$value = $value / 4;
98100

99-
if (array_key_exists('dependsOn', $elementImplementation) && $_GET['aggregated'] == "true") {
101+
if (array_key_exists('dependsOn', $elementImplementation) && $aggregated == "true") {
100102
foreach ($elementImplementation['dependsOn'] as $dependency) {
101103
$dependencyElement = getElementByName($dimensions, $dependency);
102104
$value += getDifficultyOfImplementation($dimensions, $dependencyElement);

scutter.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
include_once "data.php";
1111
include_once "functions.php";
1212

13+
$aggregated = ($_GET['aggregated'] ?? false) == "true" ? "true" : false;
14+
1315

1416
function getJson($dimensions)
1517
{
@@ -21,7 +23,7 @@ function getJson($dimensions)
2123
foreach ($element as $activityName => $content) {
2224
$values[] = array(
2325
"series" => 0,
24-
"shape" => $shapes[$shape],
26+
"shape" => $shapes[$shape] ?? "square",
2527
"size" => 3000,
2628
"x" => getDifficultyOfImplementation($dimensions, $content),
2729
"y" => $content["usefulness"],
@@ -159,16 +161,10 @@ function toggle() {
159161
<button id="toggleChartLabel">Toggle Label</button>
160162

161163
<form action="?" method="get">
162-
<input name="aggregated" type="hidden"
163164
<?php
164-
if($_GET['aggregated'] == "true") {
165-
echo "value='false'";
166-
}else {
167-
echo "value='true'";
168-
}
169-
?>">
165+
echo "<input name=\"aggregated\" type=\"hidden\" value=\"$aggregated\" />";
166+
?>
170167

171-
</input>
172168
<button id="">
173169
<?php
174170
if($_GET['aggregated'] == "true") {

0 commit comments

Comments
 (0)