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

Adds task relevance computation. In between, adapt the code for proper task,...

Adds task relevance computation. In between, adapt the code for proper task, answers and answered identification. Updates the corresponding artefacts.
parent 7348445b
......@@ -182,25 +182,25 @@ function insertAnswer($conn, $id, $artifactid, $value, $mass, $isAjax=false, $he
if ((($checked and $type != 3) or ($checked and $type == 3 and strlen(preg_replace("/\r|\n/", "", $value)) > 0)) and $value !== null) {
//TODO : gérer la partie ressource "help"
$query = "insert into Answer(idtask, user, mass, value".($help ? ", help" : "").") values ";
$query = "insert into Answer(idtask, artifact, user, mass, value".($help ? ", help" : "").") values ";
if ($type == 3 || (($type == 5 || $type == 6 || $type == 7) && $isJson)) { // Multi-line answer or JSON answer
$values = "";
if ($type == 3) {
foreach (explode(PHP_EOL, $value) as $val) {
$val = html_entity_decode($val, ENT_QUOTES); // We need to decode in order to avoid double encoding issues
$values .= "(:id, :user, $realMass, " . $conn->quote($val) . "),";
$values .= "(:id, :artifact, :user, $realMass, " . $conn->quote($val) . "),";
}
} else {
foreach (json_decode($value) as $jsonObject) {
$val = html_entity_decode($jsonObject->value, ENT_QUOTES); // We need to decode in order to avoid double encoding issues
$values .= "(" . $jsonObject->idtask . ", :user, $realMass," . $conn->quote($val) . ($help ? ", ".(strlen($jsonObject->help->link) > 0 ? $conn->quote(json_encode($jsonObject->help)) : "null") : "") . "),";
$values .= "(" . $jsonObject->idtask . ",:artifact, :user, $realMass," . $conn->quote($val) . ($help ? ", ".(strlen($jsonObject->help->link) > 0 ? $conn->quote(json_encode($jsonObject->help)) : "null") : "") . "),";
}
}
$values = substr($values, 0, strlen($values) - 1);
$query .= $values;
} else {
$query .= "(:id, :user, $realMass, :value)";
$query .= "(:id, :artifact,:user, $realMass, :value)";
}
debug("Current query ".$query);
......@@ -214,7 +214,7 @@ function insertAnswer($conn, $id, $artifactid, $value, $mass, $isAjax=false, $he
}
$stmt->bindParam(':user', $user, PDO::PARAM_INT);
$stmt->bindParam(':artifact', $artifact, PDO::PARAM_STR);
//if (isset($_REQUEST['choice'])) {
// $stmt->bindParam(':artifact', $_REQUEST['choice'], PDO::PARAM_INT);
//} else {
......
......@@ -144,6 +144,8 @@ function update($conn, $artifactid)
*/
function step($conn, $artifactid, $from, $to, $guard, $actions)
{
$conn->beginTransaction();
// checking guards
$guardvalue=false;
debug("test guard ".$guard);
......@@ -180,6 +182,7 @@ function step($conn, $artifactid, $from, $to, $guard, $actions)
}
}
$conn->commit();
return $guardvalue;
}
/**
......
......@@ -79,11 +79,12 @@ DROP TABLE IF EXISTS Answer;
CREATE TABLE IF NOT EXISTS Answer (
idtask int(11) NOT NULL,
user varchar(100) NOT NULL,
Artifact varchar(100) DEFAULT NULL,
artifact varchar(100) NOT NULL,
value mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
mass float default 1,
help json DEFAULT NULL,
step int(11) DEFAULT NULL
-- TODO missing FK
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
......@@ -250,45 +251,18 @@ CREATE TABLE IF NOT EXISTS `Cities` (
KEY `iduser` (`iduser`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- TODO DEPRECATED
-- Doublure de structure pour la vue `matrixskyline`
-- (Voir ci-dessous la vue réelle)
--
-- DROP VIEW IF EXISTS `matrixskyline`;
-- CREATE TABLE IF NOT EXISTS `matrixskyline` (
-- `idtask` int(11)
-- ,`duration` int(11)
-- ,`reward` int(11)
-- ,`skill1` varchar(100)
-- ,`skill2` varchar(100)
-- );
-- --------------------------------------------------------
--
-- Doublure de structure pour la vue `preferences`
-- (Voir ci-dessous la vue réelle)
--
-- TODO DEPRECATED
-- DROP VIEW IF EXISTS `preferences`;
-- CREATE TABLE IF NOT EXISTS `preferences` (
-- `iduser` int(11)
-- ,`skill` varchar(100)
-- );
-- --------------------------------------------------------
--
-- profile table, specifying for each task its required Skills
-- idtask: id of the task
-- idartifact: id of the corresponding artifact
-- idskill: id of the required skill
-- TODO Foreign key?
DROP TABLE IF EXISTS `Profile`;
CREATE TABLE IF NOT EXISTS `Profile` (
`idtask` int(11) NOT NULL,
idartifact int(11) NOT NULL,
`idskill` int(11) NOT NULL,
KEY `idtask` (`idtask`),
KEY `idskill` (`idskill`)
......@@ -328,9 +302,9 @@ CREATE TABLE IF NOT EXISTS `Skills` (
--
INSERT INTO `Skills` (`iduser`, `idskill`, `level`) VALUES
(1, 1, 50),
(2, 1, 50),
(3, 1, 50),
(1, 1, 100),
(2, 1, 100),
(3, 1, 100),
(4, 1002, 100);
-- --------------------------------------------------------
......@@ -1384,8 +1358,8 @@ CREATE TABLE IF NOT EXISTS TaskClass (
--
CREATE TABLE IF NOT EXISTS Task (
id int(11) NOT NULL AUTO_INCREMENT,
`artifact` int(11),
id int(11) NOT NULL,
`artifact` int(11) NOT NULL,
taskclass varchar(1000),
`title` varchar(100) NOT NULL,
`description` varchar(100),
......
......@@ -6,8 +6,9 @@
"guard": "select true from dual",
"actions": [
"select @TEMPLATE:=body from Template where id='headwork-belief-step1'",
"insert into Task(id,title,modality,description,body,checker,checkermsg,artifact,ajax) values (1,'demo','belief','Step 1: Using uncertain answers',@TEMPLATE,'REGEXP \"^-?[0-9]+$\"','please, enter an integer',1004,false)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,title,modality,description,body,checker,checkermsg,artifact,ajax) values (1,'demo','belief','Step 1: Using uncertain answers',@TEMPLATE,'REGEXP \"^-?[0-9]+$\"','please, enter an integer',CURRENT_ARTIFACT,false)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (1,CURRENT_ARTIFACT,1)"
]
}
......@@ -17,15 +18,16 @@
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=1",
"actions": [
"-- delete from profile",
"delete from Task where artifact=1004",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='Headwork-belief-step2'",
"insert into Answer(idtask,user,artifact,value,mass) values(1,1000,CURRENT_ARTIFACT,1,0.35)",
"insert into Answer(idtask,user,artifact,value,mass) values(1,2000,CURRENT_ARTIFACT,1,0.05)",
"insert into Answer(idtask,user,artifact,value,mass) values(1,3000,CURRENT_ARTIFACT,2,0.8)",
"insert into Answer(idtask,user,artifact,value,mass) values(1,4000,CURRENT_ARTIFACT,1,0.2)",
"PIGNISTIC",
"insert into Task(id,title,description,body,type,artifact) select 2,'demo','Step 2: Making decisions with uncertain opinions',replace(@TEMPLATE,'TAG1',if(value='2','right!','wrong, sorry')),0,1004 from Answer where idtask=1 and user=SESSION_USER",
"insert into Profile (select id,1 from Task)",
"insert into Task(id,title,description,body,type,artifact) select 2,'demo','Step 2: Making decisions with uncertain opinions',replace(@TEMPLATE,'TAG1',if(value='2','right!','wrong, sorry')),0,CURRENT_ARTIFACT from Answer where idtask=1 and artifact=CURRENT_ARTIFACT and user=SESSION_USER",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (2,CURRENT_ARTIFACT,1)",
"insert into Skills values (SESSION_USER,1006,100) on duplicate key update level=100"
]
}
......@@ -34,7 +36,8 @@
"4": {
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=2",
"actions": [
"delete from Task where artifact=1004"
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"delete from Task where artifact=CURRENT_ARTIFACT"
]
}
},
......
......@@ -8,41 +8,45 @@
"-- Load the template of the question.",
"select @TEMPLATE:=body from Template where id='headwork-step1'",
"-- Install the related question. Set a checker to filter the answer.",
"insert into Task(title,description,body,checker,checkermsg,artifact,ajax) values ('demo','Step 1: What is Headwork ?',@TEMPLATE,'REGEXP ''^-?[0-9]+$''','please, enter an integer',1000,false)",
"insert into Task(id,title,description,body,checker,checkermsg,artifact,ajax) values (1,'demo','Step 1: What is Headwork ?',@TEMPLATE,'REGEXP ''^-?[0-9]+$''','please, enter an integer',CURRENT_ARTIFACT,false)",
"-- Set the profile of the question. Any user with the default skill can participate.",
"insert into Profile (select id,1 from Task)"
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (1,CURRENT_ARTIFACT,1)"
]
}
},
"2": {
"3": {
"guard": "select count(*)>=1 from Answer",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=1",
"actions": [
"-- delete from profile",
"delete from Task where artifact=1000",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-step2'",
"insert into Task(title,description,body,type,artifact) select 'demo','Step 2: Making decisions',replace(@TEMPLATE,'TAG1',if(value='2','right!','wrong, sorry')),0,1000 from Answer",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,title,description,body,type,artifact) select 2,'demo','Step 2: Making decisions',replace(@TEMPLATE,'TAG1',if(value='2','right!','wrong, sorry')),0,CURRENT_ARTIFACT from Answer where idtask=1 and artifact=CURRENT_ARTIFACT and user=SESSION_USER",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (2,CURRENT_ARTIFACT,1)"
]
}
},
"3": {
"4": {
"guard": "select count(*)>=2 from Answer",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=2",
"actions": [
"-- delete from profile",
"delete from Task where artifact=1000",
"insert into Task(title,description,body,type,checker,checkermsg,artifact) values ('demo','Step 3: Skills','Congratulations ! You are now aware of the basics of Headwork. You were granted this specific skill in your SKILL TREE (skills top menu). Look inside to see your score. This score is used to rank the tasks proposed to you (relevance score).',0,null,'',1000)",
"insert into Profile (select id,1 from Task)"
"delete from Task where artifact=CURRENT_ARTIFACT",
"insert into Task(id,title,description,body,type,checker,checkermsg,artifact) values (3,'demo','Step 3: Skills','Congratulations ! You are now aware of the basics of Headwork. You were granted this specific skill in your SKILL TREE (skills top menu). Look inside to see your score. This score is used to rank the tasks proposed to you (relevance score).',0,null,'',CURRENT_ARTIFACT)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (3,CURRENT_ARTIFACT,1)"
]
}
},
"4": {
"5": {
"guard": "select count(*)>=3 from Answer",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=3",
"actions": [
"delete from Task where artifact=1000",
"delete from Task where artifact=CURRENT_ARTIFACT",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"delete from Skills where iduser=SESSION_USER and idskill=1004",
"insert into Skills values (SESSION_USER,1004,50)",
"insert into Skills values (SESSION_USER,1003,20)"
......
......@@ -8,96 +8,102 @@
"select @CHECKER:='REGEXP \"^A$\"'",
"select @CHECKERMSG:='Please enter the letter A'",
"select @TYPE:=NULL",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (1,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (1,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (1,CURRENT_ARTIFACT,1),(1,CURRENT_ARTIFACT,1004)"
]
}
},
"2": {
"3": {
"guard": "select true from Answered where artifact=1001 and id=1",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=1",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-2'",
"select @TITLE:='Generic HTML questions'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @TYPE:=0",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (2,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (2,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (2,CURRENT_ARTIFACT,1)"
]
}
},
"3": {
"4": {
"guard": "select true from Answered where artifact=1001 and id=2",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=2",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Multi-line input'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='add several inputs, separated by a return'",
"select @TYPE:=3",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (3,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (3,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (3,CURRENT_ARTIFACT,1)"
]
}
},
"4": {
"5": {
"guard": "select true from Answered where artifact=1001 and id=3",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=3",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-4'",
"select @TITLE:='Drowpdown list'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='select value as value,value as text from Answer where user=SESSION_USER and idtask=3'",
"select @TYPE:=1",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (4,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (4,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (4,CURRENT_ARTIFACT,1)"
]
}
},
"5": {
"6": {
"guard": "select true from Answered where artifact=1001 and id=4",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=4",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-5'",
"select @TITLE:='Radio buttons'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='select value as value,value as text from Answer where user=SESSION_USER and idtask=3'",
"select @TYPE:=2",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (5,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (5,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (5,CURRENT_ARTIFACT,1)"
]
}
},
"6": {
"7": {
"guard": "select true from Answered where artifact=1001 and id=5",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=5",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-6'",
"select @TITLE:='Radio buttons with alternative free input'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='select value as value,value as text from Answer where user=SESSION_USER and idtask=3'",
"select @TYPE:=4",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (6,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1) values (6,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (6,CURRENT_ARTIFACT,1)"
]
}
},
"7": {
"9": {
"guard": "select true from Answered where artifact=1001 and id=6",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=6",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=''",
"select @TITLE:='Multiple questions at once, with multiple answers'",
"select @CHECKER:=NULL",
......@@ -105,17 +111,19 @@
"select @LIST:='select idtask as id,value as text from Answer where user=SESSION_USER and idtask=3'",
"select @ANS:='select id, id as value, text,class,false as request_feedback from AnswerButton'",
"select @TYPE:=5",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1,arg2) values (7,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST,@ANS)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type,arg1,arg2) values (7,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST,@ANS)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (7,CURRENT_ARTIFACT,1)"
]
}
},
"8": {
"9": {
"guard": "select true from Answered where artifact=1001 and id=7",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=7",
"actions": [
"-- WARNING DISABLED STATE",
"-- deprecated. API on diagrams.io has changed",
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Embedding any kind of diagram (here from draw.io)'",
"select @CHECKER:=NULL",
......@@ -123,31 +131,34 @@
"-- select @LIST:='select id,skill as text from SkillTree limit 5'",
"-- select @ANS:='select id, id as value, text,class,false as request_feedback from AnswerButton'",
"select @TYPE:=8",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (8,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (8,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (8,CURRENT_ARTIFACT,1)"
]
}
},
"9": {
"10": {
"guard": "select true from Answered where artifact=1001 and id=7",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=7",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:='Your Headwork Basics skill is skyrocketing!'",
"select @TITLE:='Congratulations!'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @TYPE:=0",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (8,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (9,CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (9,CURRENT_ARTIFACT,1)"
]
}
},
"10":{
"100": {
"guard": "select true from Answered where artifact=1001 and id=8",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=9",
"actions": [
"delete from Task where artifact=1001",
"delete from Task where artifact=CURRENT_ARTIFACT",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"update Skills set level=level+20 where iduser=SESSION_USER and idskill=1004"
]
}
......
......@@ -8,96 +8,102 @@
"select @CHECKER:='REGEXP \"^A$\"'",
"select @CHECKERMSG:='Please enter the letter A'",
"select @TYPE:=NULL",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type) values (1,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type) values (1,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (1,CURRENT_ARTIFACT,1)"
]
}
},
"2": {
"3": {
"guard": "select true from Answered where artifact=1005 and id=1",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=1",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-2'",
"select @TITLE:='Generic HTML questions'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @TYPE:=0",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type) values (2,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type) values (2,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (2,CURRENT_ARTIFACT,1)"
]
}
},
"3": {
"4": {
"guard": "select true from Answered where artifact=1005 and id=2",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=2",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Multi-line input'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='add several inputs, separated by a return'",
"select @TYPE:=3",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (3,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (3,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (3,CURRENT_ARTIFACT,1)"
]
}
},
"4": {
"5": {
"guard": "select true from Answered where artifact=1005 and id=3",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=3",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Drowpdown list (dynamic content).'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='select value as value,value as text from Answer where user=SESSION_USER'",
"select @TYPE:=1",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (4,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (4,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (4,CURRENT_ARTIFACT,1)"
]
}
},
"5": {
"6": {
"guard": "select true from Answered where artifact=1005 and id=4",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=4",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Radio buttons (dynamic content)'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='select id as value,skill as text from SkillTree limit 10'",
"select @TYPE:=2",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (5,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (5,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (5,CURRENT_ARTIFACT,1)"
]
}
},
"6": {
"7": {
"guard": "select true from Answered where artifact=1005 and id=5",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=5",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Radio buttons with free input (dynamic content)'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @LIST:='select id as value,skill as text from SkillTree limit 10'",
"select @TYPE:=4",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (6,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1) values (6,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (6,CURRENT_ARTIFACT,1)"
]
}
},
"7": {
"8": {
"guard": "select true from Answered where artifact=1005 and id=6",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=6",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Multiple questions at once, with multiple answers'",
"select @CHECKER:=NULL",
......@@ -105,16 +111,17 @@
"select @LIST:='select id,skill as text from SkillTree limit 5'",
"select @ANS:='select id, id as value, text,class,false as request_feedback from AnswerButton'",
"select @TYPE:=5",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1,arg2) values (7,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST,@ANS)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type,arg1,arg2) values (7,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@LIST,@ANS)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (7,CURRENT_ARTIFACT,1)"
]
}
},
"8": {
"9": {
"guard": "select true from Answered where artifact=1005 and id=7",
"guard": "select true from Answered where artifact=CURRENT_ARTIFACT and id=7",
"actions": [
"delete from Task where artifact=1005",
"delete from Task where artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=body from Template where id='headwork-gui-3'",
"select @TITLE:='Embedding any kind of diagram (here from draw.io)'",
"select @CHECKER:=NULL",
......@@ -122,8 +129,10 @@
"-- select @LIST:='select id,skill as text from SkillTree limit 5'",
"-- select @ANS:='select id, id as value, text,class,false as request_feedback from AnswerButton'",
"select @TYPE:=8",
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type) values (8,'belief',1005,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
"insert into Task(id,modality,artifact,title,description,body,checker,checkermsg,type) values (8,'belief',CURRENT_ARTIFACT,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"delete from Profile where idartifact=CURRENT_ARTIFACT",
"insert into Profile values (8,CURRENT_ARTIFACT,1)"
]
}
},
......
{a
"1": {
"2": {
"guard": "select true from dual",
"actions": [
"select @TEMPLATE:=body from Template where id='headwork-gui-1'",
"select @TITLE:='Simple question, simple checking'",
"select @CHECKER:='REGEXP \"^A$\"'",
"select @CHECKERMSG:='Please enter the letter A'",
"select @TYPE:=NULL",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (1,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
]
}
},
"2": {
"3": {
"guard": "select true from Answered where artifact=1001 and id=1",
"actions": [
"delete from Task where artifact=1001",
"select @TEMPLATE:=body from Template where id='headwork-gui-2'",
"select @TITLE:='Generic HTML questions'",
"select @CHECKER:=NULL",
"select @CHECKERMSG:=NULL",
"select @TYPE:=0",
"insert into Task(id,artifact,title,description,body,checker,checkermsg,type) values (2,1001,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE)",
"insert into Profile (select id,1 from Task)"
]
}
},
"3": {
"4": {