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

Fixes GUI so that only running artifacts are displayed.

Fixes engine so that autostart artifact classes are relaunched when no more running instances exists
parent 5183d7b4
...@@ -86,17 +86,10 @@ function executeSqlFile($file_name, $conn){ ...@@ -86,17 +86,10 @@ function executeSqlFile($file_name, $conn){
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) { if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
$query .= $sql_line; $query .= $sql_line;
if (substr(rtrim($query), -1) == ';') { if (substr(rtrim($query), -1) == ';') {
// try {
debug("query from init-workflow"); debug("query from init-workflow");
debug($query); debug($query);
$conn->query($query); $conn->query($query);
// } catch (PDOException $e) { $query = "";
// echo "<p>Headache ! <pre>$e</pre></p>";
// echo $query."<br/>";
// print_r($conn->errorInfo());
// exit;
// }
$query = "";
} }
} }
} }
...@@ -160,6 +153,10 @@ function nextTaskFromArtifact($conn,$user,$artifact){ ...@@ -160,6 +153,10 @@ function nextTaskFromArtifact($conn,$user,$artifact){
return $nextTaskId; return $nextTaskId;
} }
// TODO document bots
// TODO document presentation.html
/** /**
* insertAnswer * insertAnswer
* *
......
...@@ -301,7 +301,7 @@ function startArtifact($conn,$artifactid,$userid){ ...@@ -301,7 +301,7 @@ function startArtifact($conn,$artifactid,$userid){
*/ */
function startAllArtifact($conn,$userid){ function startAllArtifact($conn,$userid){
$table=$conn->query("select id from ArtifactClass where autostart and id not in (select classid from Artifact where ownerid=$userid)"); $table=$conn->query("select id from ArtifactClass where autostart and id not in (select classid from Artifact where ownerid=$userid and state='running')");
if($table->rowCount()>0){ if($table->rowCount()>0){
debug("ArtifactClass to instanciate available"); debug("ArtifactClass to instanciate available");
while($tuple=$table->fetch()){ while($tuple=$table->fetch()){
......
...@@ -81,7 +81,7 @@ INSERT INTO `Users` (`id`, `name`, `hashed_password`) VALUES ...@@ -81,7 +81,7 @@ INSERT INTO `Users` (`id`, `name`, `hashed_password`) VALUES
-- user: the id of the user who answered -- user: the id of the user who answered
-- value: the value of the answer -- value: the value of the answer
-- mass: the probability or the belief of the value for the user -- mass: the probability or the belief of the value for the user
-- help: TODO ANDRIEN -- help: TODO ADRIEN
-- step: TODO One day, unify in json -- step: TODO One day, unify in json
-- Artifact: temporary -- Artifact: temporary
......
...@@ -497,7 +497,7 @@ function showAwaitingActivites($conn) ...@@ -497,7 +497,7 @@ function showAwaitingActivites($conn)
function showRunningActivities($conn){ function showRunningActivities($conn){
global $VIEW; global $VIEW;
$table = $conn->query("select description, Artifact.id, concat('index.php?mode=showTasks&activitydesc=',description,'&activityid=',Artifact.id),'button' from Artifact,ArtifactClass where project='" . $_SESSION['project'] . "' and Artifact.classid=ArtifactClass.id and Artifact.ownerid=" . $_SESSION['id'] . " order by Artifact.classid, Artifact.id"); $table = $conn->query("select description, Artifact.id, concat('index.php?mode=showTasks&activitydesc=',description,'&activityid=',Artifact.id),'button' from Artifact,ArtifactClass where project='" . $_SESSION['project'] . "' and Artifact.classid=ArtifactClass.id and Artifact.state='running' and Artifact.ownerid=" . $_SESSION['id'] . " order by Artifact.classid, Artifact.id");
$mylist = $table->fetchAll(PDO::FETCH_NUM); $mylist = $table->fetchAll(PDO::FETCH_NUM);
......
Supports Markdown
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