Commit abdde1cc authored by GROSS-AMBLARD David's avatar GROSS-AMBLARD David
Browse files

Fixes the use of nodetip as a transition destination in Artifact.php

parent 0d00bf5b
......@@ -120,44 +120,46 @@ function updateonce($conn, $artifact, $artifactid, $count)
$actions = '';
foreach ($stateinfo as $dest=>$v) {
debug("checking transition $node -> $dest");
debug("node data: ".json_encode($stateinfo[$dest]));
if($dest<>"nodetip"){
debug("checking transition $node -> $dest");
debug("node data: ".json_encode($stateinfo[$dest]));
if( isset($artifact[$node][$dest]["guard"]) ){
$guard=$artifact[$node][$dest]["guard"];
$guard=sugarFree($guard);
}
if( isset($artifact[$node][$dest]["guard"]) ){
$guard=$artifact[$node][$dest]["guard"];
$guard=sugarFree($guard);
}
if($guard=="none")
$guard="select true from dual";
if (preg_match("/^task ([0-9]+) is answered/",$guard,$matches)){
$guard="select true from Answered where artifact=CURRENT_ARTIFACT and id=".$matches[1];
}
$guard=str_replace('SESSION_USER', $_SESSION['id'], $guard);
$guard=str_replace("CURRENT_ARTIFACT",$artifactid, $guard);
$actions=str_replace('SESSION_USER', $_SESSION['id'], $artifact[$node][$dest]["actions"]);
if( isset($artifact[$node][$dest]["actions"]) ){
if($guard=="none")
$guard="select true from dual";
if (preg_match("/^task ([0-9]+) is answered/",$guard,$matches)){
$guard="select true from Answered where artifact=CURRENT_ARTIFACT and id=".$matches[1];
}
$guard=str_replace('SESSION_USER', $_SESSION['id'], $guard);
$guard=str_replace("CURRENT_ARTIFACT",$artifactid, $guard);
$actions=str_replace('SESSION_USER', $_SESSION['id'], $artifact[$node][$dest]["actions"]);
}
if (isset($_SESSION['skills'])) {
$actions=str_replace('SKILLS', $_SESSION['skills'], $actions);
// TODO but actions is an array?
// TODO what for?
}
if( isset($artifact[$node][$dest]["actions"]) ){
$actions=str_replace('SESSION_USER', $_SESSION['id'], $artifact[$node][$dest]["actions"]);
}
if (isset($_SESSION['skills'])) {
$actions=str_replace('SKILLS', $_SESSION['skills'], $actions);
// TODO but actions is an array?
// TODO what for?
}
//We make sure that guard and actions are not empty before sending a query to activate step
if($guard !=='' && $actions !== ''){
//We make sure that guard and actions are not empty before sending a query to activate step
if($guard !=='' && $actions !== ''){
$activated=step($conn, $artifactid, $node, $dest, $guard, $actions);
debug("result:".$activated);
if ($activated) {
return true;
}
$activated=step($conn, $artifactid, $node, $dest, $guard, $actions);
debug("result:".$activated);
if ($activated) {
return true;
}
$activated=step($conn, $artifactid, $node, $dest, $guard, $actions);
if ($activated) {
return true;
}
}
debug("no transition from $node");
......
......@@ -70,7 +70,7 @@
<!-- no-repeat bottom right/20% url('projects/headwork/background.jpg'); background-color: rgb(197,205,66);"> -->
<!-- <body> -->
<nav class="navbar fixed-top navbar-dark justify-content-between bg-dark flex-sm-row flex-column" style="background-color: black;">
<nav class="navbar navbar-dark justify-content-between bg-dark flex-sm-row flex-column" style="background-color: black;">
<!-- Navbar content -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment