Commit 32f48a80 authored by Bas Lijnse's avatar Bas Lijnse

Changed the CondAnd node to include the labels of the sub tasks.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@360 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 9c486898
......@@ -49,7 +49,7 @@ selectSuppliers
collectBids :: String [(Int,String)] -> Task [((Int,String),Real)]
collectBids purchase suppliers
= andTasks
[("Bid from " +++ name, uid @:: collectBid purchase supplier) \\ supplier =: (uid,name) <- suppliers]
[("Bid from " +++ name, uid @: ("Bid request", collectBid purchase supplier)) \\ supplier =: (uid,name) <- suppliers]
where
collectBid :: String (Int,String) -> Task ((Int,String),Real)
collectBid purchase bid
......
......@@ -119,7 +119,7 @@ where
= { taskid = cdesc.caTaskNrId
, delegator = toString pdesc.delegatorId
, processname = pdesc.workflowLabel
, subject = pdesc.taskLabel +++ " - Part " +++ (toString cdesc.caIndex)
, subject = cdesc.caTaskLabel
, priority = pdesc.taskPriority
, timestamp = (\(Time i) -> i) pdesc.timeCreated
, tree_path = path
......
......@@ -51,7 +51,7 @@ Execute all Tasks in parallel / interleaved and FINISH as soon as the predicate
allTasksCond :: - string is used to give a useful name to the trace;
- the predicate is applied on the set of tasks which are finished
*/
:: DisplaySubTasks :== String TaskNr [(Bool,HtmlTree)] -> HtmlTree // function determining how to display the subtasks
:: DisplaySubTasks :== String TaskNr [(Bool,String,HtmlTree)] -> HtmlTree // function determining how to display the subtasks
:: FinishPred a :== [a] -> Bool // predicate determining when the task is finished, depending on the results returned by finished subtasks
allTasksCond :: !String !DisplaySubTasks !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
......
......@@ -174,28 +174,30 @@ where
doandTasks [] tst = return [] tst
doandTasks taskCollection tst=:{tasknr,html}
# ((alist,acode),tst) = checkAllTasks label taskCollection 0 ([],[]) {tst & html = BT [] [],activated = True}
| and (map fst acode) || pred alist = (alist,{tst & html = html, activated = True}) // stop, all work done so far satisfies predicate
| and (map (\(x,_,_) -> x) acode) || pred alist = (alist,{tst & html = html, activated = True}) // stop, all work done so far satisfies predicate
= (alist,{tst & activated = False
, html = html +|+ displayOption label tasknr acode // show all subtasks using the displayOption function
})
where
checkAllTasks :: !String ![LabeledTask a] !Int !(![a],![(Bool,HtmlTree)]) !*TSt -> *(!(![a],![(Bool,HtmlTree)]),!*TSt) | iCreateAndPrint a
checkAllTasks :: !String ![LabeledTask a] !Int !(![a],![(Bool,String,HtmlTree)]) !*TSt -> *(!(![a],![(Bool,String,HtmlTree)]),!*TSt) | iCreateAndPrint a
checkAllTasks traceid taskCollection ctasknr (alist,acode) tst=:{tasknr}
| ctasknr == length taskCollection = ((reverse alist,reverse acode),tst) // all tasks tested
# (taskname,task) = taskCollection!!ctasknr
# (a,tst=:{activated = adone,html=html})
= appTaskTSt (mkParSubTask traceid ctasknr task) {tst & tasknr = tasknr, activated = True, html = BT [] []} // check tasks
= checkAllTasks traceid taskCollection (inc ctasknr) (if adone [a:alist] alist,[(adone,html):acode]) {tst & tasknr = tasknr}
= checkAllTasks traceid taskCollection (inc ctasknr) (if adone [a:alist] alist,[(adone,taskname,html):acode]) {tst & tasknr = tasknr}
displayAsTab :: DisplaySubTasks
displayAsTab = displayAsTab`
where
displayAsTab` label tasknr htmls
= CondAnd label nrSubTasks [({ caTaskNrId = taskNrToString [0,i:tasknr]
, caIndex = nrSubTasks
, caStatus = finished
},html) \\ (finished,html) <- htmls & i <- [0..]
= CondAnd label nrSubTasks [( { caTaskNrId = taskNrToString [0,i:tasknr]
, caTaskLabel = tlabel
, caIndex = i
, caNumSiblings = nrSubTasks
, caStatus = finished
},html) \\ (finished,tlabel,html) <- htmls & i <- [0..]
]
where
nrSubTasks = length htmls
......@@ -205,7 +207,7 @@ displayAll :: DisplaySubTasks
displayAll = displayAll`
where
displayAll` label tasknr htmls
= foldl (+|+) (BT [] []) (map snd htmls)
= foldl (+|+) (BT [] []) (map (\(_,_,x) -> x) htmls)
// ******************************************************************************************************
// Higher order tasks ! Experimental
......
......@@ -58,8 +58,10 @@ import HSt
// Task meta information
:: CondAndDescription
= { caTaskNrId :: !String // tasknr as string
, caIndex :: !Int // index of and task
, caStatus :: !Bool // is sub task finished
, caTaskLabel :: !String // label of subtask
, caIndex :: !Int // index of current task in the set
, caNumSiblings :: !Int // number of siblings in the set
, caStatus :: !Bool // is subtask finished
}
:: TaskDescription
......
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