Commit e4728533 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer

cond and task tab now properly ends

and task as a whole does not determinate yet
to be continued


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@319 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent ede8d05e
......@@ -179,22 +179,25 @@ where
doandTasks taskCollection tst=:{tasknr,html,options,userId}
# ((alist,acode),tst=:{activated=finished,html=allhtml})
= checkAllTasks label taskCollection 0 True ([],[]) {tst & html = BT [] [],activated = True}
| finished || pred alist = (alist,{tst & html = html, activated = True}) // stop, all work done so far satisfies predicate
| finished || pred alist = (alist,{tst & html = html, activated = True}) // stop, all work done so far satisfies predicate
= (alist,{tst & activated = False
, html = html +|+ collectCode label acode // show previous code
})
where
collectCode :: !String ![HtmlTree] -> HtmlTree
collectCode label htmls = CondAnd label [(toStringTaskNr [0,i:tasknr],html) \\ html <- htmls & i <- [0..]]
collectCode :: !String ![(Bool,HtmlTree)] -> HtmlTree
collectCode label htmls = CondAnd label lengthltask [({ caTaskNrId = toStringTaskNr [0,i:tasknr]
, caIndex = lengthltask
, caStatus = finished
},html) \\ (finished,html) <- htmls & i <- [0..]]
checkAllTasks :: !String ![LabeledTask a] !Int !Bool !(![a],![HtmlTree]) !*TSt -> *(!(![a],![HtmlTree]),!*TSt) | iCreateAndPrint a
checkAllTasks :: !String ![LabeledTask a] !Int !Bool !(![a],![(Bool,HtmlTree)]) !*TSt -> *(!(![a],![(Bool,HtmlTree)]),!*TSt) | iCreateAndPrint a
checkAllTasks traceid taskCollection ctasknr bool (alist,acode) tst=:{tasknr}
| ctasknr == length taskCollection = ((reverse alist,reverse acode),{tst & activated = bool}) // 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) False (if adone [a:alist] alist,[html:acode]) {tst & tasknr = tasknr}
= checkAllTasks traceid taskCollection (inc ctasknr) False (if adone [a:alist] alist,[(adone,html):acode]) {tst & tasknr = tasknr}
/*
allTasksCond :: !String !(TasksToShow a) !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
......
......@@ -42,7 +42,7 @@ import HSt
| (@@:) infix 0 !TaskDescription !HtmlTree // code with id of user attached to it
| (+-+) infixl 1 !HtmlTree !HtmlTree // code to be placed next to each other
| (+|+) infixl 1 !HtmlTree !HtmlTree // code to be placed below each other
| CondAnd !String [(!TaskNrId,!HtmlTree)] // list of subtasks to display in different tabs by worklist handler
| CondAnd !String !Int [(!CondAndDescription,!HtmlTree)] // list of subtasks to display in different tabs by worklist handler
| DivCode !String !HtmlTree // code that should be labeled with a div, used for Ajax and Client technology
| TaskTrace TraceInfo !HtmlTree // trace information used for displaying the task tree
......@@ -55,6 +55,12 @@ import HSt
}
// Task meta information
:: CondAndDescription
= { caTaskNrId :: !TaskNrId // tasknr as string
, caIndex :: !Int // index of and task
, caStatus :: !Bool // is sub task finished
}
:: TaskDescription
= { delegatorId :: !UserId // id of the work delegator
, taskWorkerId :: !UserId // id of worker on the task
......
......@@ -20,12 +20,12 @@ where
# collected = determineTaskList` thisuser tree ntaskDescr
| ntaskDescr.taskWorkerId == thisuser = [ntaskDescr:collected]
= collected
determineTaskList` thisuser (CondAnd label []) taskDescr
determineTaskList` thisuser (CondAnd label nr []) taskDescr
= []
determineTaskList` thisuser (CondAnd label [t=:(taskNr,htmlTree):ts]) taskDescr
determineTaskList` thisuser (CondAnd label nr [t=:(condAndDescr,htmlTree):ts]) taskDescr
# collection = determineTaskList` thisuser htmlTree taskDescr
# collections = determineTaskList` thisuser (CondAnd label ts) taskDescr
= [{taskDescr & taskNrId = taskNr}] ++ collection ++ collections
# collections = determineTaskList` thisuser (CondAnd label nr ts) taskDescr
= [{taskDescr & taskNrId = condAndDescr.caTaskNrId, taskLabel = label <+++ condAndDescr.caIndex, curStatus = condAndDescr.caStatus}] ++ collection ++ collections
determineTaskList` thisuser (tree1 +|+ tree2)taskDescr
# collection1 = determineTaskList` thisuser tree1 taskDescr
# collection2 = determineTaskList` thisuser tree2 taskDescr
......@@ -72,11 +72,11 @@ mkFilteredTaskTree thisuser taskuser (description @@: tree)
| thisuser == description.taskWorkerId
= (html,inputs)
| otherwise = ([],[])
mkFilteredTaskTree thisuser taskuser (CondAnd label [])
mkFilteredTaskTree thisuser taskuser (CondAnd label nr [])
= ([],[])
mkFilteredTaskTree thisuser taskuser (CondAnd label [(nr,tree):trees])
mkFilteredTaskTree thisuser taskuser (CondAnd label nr [(index,tree):trees])
# (tag,input) = mkFilteredTaskTree thisuser taskuser tree
# (tags,inputs) = mkFilteredTaskTree thisuser taskuser (CondAnd label trees)
# (tags,inputs) = mkFilteredTaskTree thisuser taskuser (CondAnd label nr trees)
= (tag ++ tags,input ++ inputs)
mkFilteredTaskTree thisuser taskuser (tree1 +|+ tree2)
# (lhtml,linputs) = mkFilteredTaskTree thisuser taskuser tree1
......@@ -101,12 +101,12 @@ mkFilteredTaskTree thisuser taskuser (TaskTrace traceinfo tree)
mkUnfilteredTaskTree :: !HtmlTree -> (![HtmlTag],![InputId])
mkUnfilteredTaskTree (BT body inputs) = (body, inputs)
mkUnfilteredTaskTree (_ @@: html) = mkUnfilteredTaskTree html
mkUnfilteredTaskTree (CondAnd label []) = ([],[])
mkUnfilteredTaskTree (CondAnd label [(tn,tree):trees])
mkUnfilteredTaskTree (CondAnd label nr []) = ([],[])
mkUnfilteredTaskTree (CondAnd label nr [(tn,tree):trees])
= (htmlL ++ htmlR,inpL ++ inpR)
where
(htmlL,inpL) = mkUnfilteredTaskTree tree
(htmlR,inpR) = mkUnfilteredTaskTree (CondAnd label trees)
(htmlR,inpR) = mkUnfilteredTaskTree (CondAnd label nr trees)
mkUnfilteredTaskTree (DivCode str html) = mkUnfilteredTaskTree html
mkUnfilteredTaskTree (TaskTrace traceinfo html) = mkUnfilteredTaskTree html
mkUnfilteredTaskTree (nodeL +-+ nodeR) = (htmlL <=> htmlR,inpL ++ inpR)
......@@ -127,12 +127,15 @@ determineMyTaskTree thisuser thistaskid tree = determineMyTaskTree` thisuser thi
where
determineMyTaskTree` thisuser thistaskid (BT bdtg inputs) taskDescr
= Nothing
determineMyTaskTree` thisuser thistaskid (CondAnd label []) taskDescr
determineMyTaskTree` thisuser thistaskid (CondAnd label nr []) taskDescr
= Nothing
determineMyTaskTree` thisuser thistaskid (CondAnd label [(taskid,tree):trees]) taskDescr
| thistaskid == taskid = Just ({taskDescr & taskNrId = taskid, taskLabel = label } @@: (pruneTree tree))
determineMyTaskTree` thisuser thistaskid (CondAnd label nr [(condAndDescr,tree):trees]) taskDescr
| thistaskid == condAndDescr.caTaskNrId
= Just ({taskDescr & taskNrId = thistaskid
, taskLabel = label <+++ condAndDescr.caIndex
, curStatus = condAndDescr.caStatus} @@: (pruneTree tree))
# mbTree = determineMyTaskTree` thisuser thistaskid tree taskDescr
| isNothing mbTree = determineMyTaskTree` thisuser thistaskid (CondAnd label trees) taskDescr
| isNothing mbTree = determineMyTaskTree` thisuser thistaskid (CondAnd label nr trees) taskDescr
= mbTree
determineMyTaskTree` thisuser thistaskid (tree1 +-+ tree2) taskDescr
# ntree1 = determineMyTaskTree` thisuser thistaskid tree1 taskDescr
......@@ -153,7 +156,7 @@ where
pruneTree :: !HtmlTree -> HtmlTree // delete all sub trees not belonging to this task
pruneTree (taskdescr @@: tree) = BT [] [] // this task will appear in another tab
pruneTree (CondAnd label trees) = BT [] [] // this task will appear in another tab as well
pruneTree (CondAnd label nr trees) = BT [] [] // this task will appear in another tab as well
pruneTree (tree1 +|+ tree2) = pruneTree tree1 +|+ pruneTree tree2
pruneTree (tree1 +-+ tree2) = pruneTree tree1 +-+ pruneTree tree2
pruneTree (BT bdtg inputs) = BT bdtg inputs
......@@ -183,7 +186,7 @@ where
collectTraceInfo (TaskTrace traceinfo html) = [traceinfo : collectTraceInfo html]
collectTraceInfo (BT body inputs) = []
collectTraceInfo (_ @@: html) = collectTraceInfo html
collectTraceInfo (CondAnd label html) = flatten (map collectTraceInfo (map snd html))
collectTraceInfo (CondAnd label nr html) = flatten (map collectTraceInfo (map snd html))
collectTraceInfo (DivCode str html) = collectTraceInfo html
collectTraceInfo (nodeL +-+ nodeR) = traceLeft ++ traceRight
where
......
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