Skip to content

Commit

Permalink
Migrate from old string elements to new software version elements
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti committed Aug 17, 2024
1 parent a9a27b5 commit 2917df9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libraries/elements/software-version-list/copy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/** @var $copyValue string */

// when copy the experiment, we need to copy the current configurations and apply our setting for every of them
if (!empty($copyData[$e['id'] . "-parameter"])) { // special handle for checkbox selections
if (!empty($copyData[$e['id'] . "-parameter"])) {
$parameterName = $copyData[$e['id'] . "-parameter"];
if (empty($copyData[$parameterName . "-numberOfVersions"])) {
var_dump($copyData);
Expand All @@ -24,4 +24,14 @@
for ($i = 0; $i < $numberOfVersions; $i++) {
$copyValue[$i] = $copyData[$parameterName . "-version-" . $i];
}
} else {
// Migrate from old elements, if there is a string element with the same parameter name, we use it
$copyValue = [];
$i = 0;
if (!empty($copyData[$e['parameter']])) {
foreach(explode(",", $copyData[$e['parameter']]) as $version) {
$copyValue[$i] = $version;
$i++;
}
}
}
1 change: 1 addition & 0 deletions libraries/elements/software-version-list/process.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
}
}


$allConfigurations = $newConfigurations;

0 comments on commit 2917df9

Please sign in to comment.