Commit 53ced609 authored by Bas Lijnse's avatar Bas Lijnse

Fixed passing of meta data in task lists

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2382 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent cdb4f5dd
......@@ -268,8 +268,7 @@ where
# (mbResult,iworld) = read (taskInstanceResult instanceNo) iworld
= case (mbMeta,mbResult) of
(Ok meta,Ok res)
# fixme = [] //TODO: Get the attributes from detached tasks
# (entry,iworld) = updateListEntryDetachedResult taskId entryId res meta.TIMeta.progress meta.TIMeta.management fixme iworld
# (entry,iworld) = updateListEntryDetachedResult taskId entryId res meta.TIMeta.progress meta.TIMeta.management iworld
= (Nothing,acc++[(entry,Nothing)],iworld)
_ = (Nothing,acc,iworld) //TODO: remove from parallel if it can't be loaded (now it simply keeps the last known result)
......@@ -324,7 +323,7 @@ appendTaskToList taskId=:(TaskId parent _) (parType,parTask) iworld=:{taskTime,c
= (taskIda, EmbeddedState (dynamic task :: Task a^) (TCInit taskIda taskTime),iworld)
Detached management
# task = parTask (parListShare taskId)
# progress = {issuedAt=currentDateTime,issuedBy=currentUser,stable=True,firstEvent=Nothing,latestEvent=Nothing}
# progress = {issuedAt=currentDateTime,issuedBy=currentUser,stable=True,firstEvent=Nothing,latestEvent=Nothing,latestAttributes='Map'.newMap}
# (taskIda=:TaskId instanceNo _,iworld) = createTopTaskInstance task management currentUser parent iworld
= (taskIda,DetachedState instanceNo progress management, iworld)
# result = TIValue NoValue taskTime
......@@ -349,12 +348,12 @@ where
maxTime cur (ValueResult _ {TaskInfo|lastEvent} _ _) = max cur lastEvent
maxTime cur _ = cur
updateListEntryDetachedResult :: !TaskId !TaskId TIResult !ProgressMeta !ManagementMeta !TaskMeta !*IWorld -> (!TaskListEntry,!*IWorld)
updateListEntryDetachedResult listId entryId result progress management attributes iworld
updateListEntryDetachedResult :: !TaskId !TaskId TIResult !ProgressMeta !ManagementMeta !*IWorld -> (!TaskListEntry,!*IWorld)
updateListEntryDetachedResult listId entryId result progress management iworld
= updateListEntry listId entryId update iworld
where
update e=:{TaskListEntry|state=DetachedState no _ _}
= {TaskListEntry| e & state = DetachedState no progress management,result = result, attributes = 'Map'.fromList attributes}
= {TaskListEntry| e & state = DetachedState no progress management,result = result, attributes = progress.latestAttributes}
update e = e
markListEntryRemoved :: !TaskId !TaskId !*IWorld -> *IWorld
......
......@@ -64,9 +64,9 @@ isSession :: !TIMeta -> Bool
isSession {TIMeta|sessionId=Just _} = True
isSession _ = False
toTaskListItem :: !TIMeta -> TaskListItem a //TODO add task meta
toTaskListItem :: !TIMeta -> TaskListItem a
toTaskListItem {TIMeta|instanceNo,progress,management}
= {taskId = TaskId instanceNo 0, value = NoValue, taskMeta = [], progressMeta = Just progress, managementMeta = Just management}
= {taskId = TaskId instanceNo 0, value = NoValue, progressMeta = Just progress, managementMeta = Just management}
currentUser :: ReadOnlyShared User
currentUser = createReadOnlySDS (\iworld=:{currentUser} -> (currentUser,iworld))
......
......@@ -412,8 +412,6 @@ instance == TaskId
instance < TaskId
//* Meta-data of tasks
:: TaskMeta :== [(!String,!String)] //* Task meta data consists of untyped attributes
:: ManagementMeta =
{ title :: !Maybe String //* Title to identify the task
, worker :: !UserConstraint //* Who has to do the task?
......@@ -430,6 +428,7 @@ instance < TaskId
, stable :: !Stability //* Is a maintask stable
, firstEvent :: !Maybe DateTime //* When was the first work done on this task
, latestEvent :: !Maybe DateTime //* When was the latest event on this task
, latestAttributes :: !Map String String //* User interface attributes of latest execution
}
//* Tasks can have three levels of priority
......@@ -454,7 +453,6 @@ instance toString (TaskListId s)
:: TaskListItem a =
{ taskId :: !TaskId
, value :: !TaskValue a
, taskMeta :: !TaskMeta
, managementMeta :: !Maybe ManagementMeta //Only for detached tasks
, progressMeta :: !Maybe ProgressMeta //Only for detached tasks
}
......@@ -467,7 +465,6 @@ instance toString (TaskListId s)
:: ParallelTask a :== (SharedTaskList a) -> Task a
/** Interaction masks contain information about a value as it is being edited
* in an interactive task.
*/
......
......@@ -18,7 +18,7 @@ createSessionTaskInstance task event iworld=:{currentDateTime,taskTime}
# worker = AnonymousUser sessionId
//Create the initial instance data in the store
# mmeta = defaultValue
# pmeta = {issuedAt=currentDateTime,issuedBy=worker,stable=False,firstEvent=Nothing,latestEvent=Nothing}
# pmeta = {issuedAt=currentDateTime,issuedBy=worker,stable=False,firstEvent=Nothing,latestEvent=Nothing,latestAttributes='Map'.newMap}
# meta = createMeta instanceNo (Just sessionId) 0 (Just worker) mmeta pmeta
# (_,iworld) = 'SharedDataSource'.write meta (taskInstanceMeta instanceNo) iworld
# (_,iworld) = 'SharedDataSource'.write (createReduct instanceNo task taskTime) (taskInstanceReduct instanceNo) iworld
......@@ -38,7 +38,7 @@ where
createTopTaskInstance :: !(Task a) !ManagementMeta !User !InstanceNo !*IWorld -> (!TaskId, !*IWorld) | iTask a
createTopTaskInstance task mmeta issuer parent iworld=:{currentDateTime,taskTime}
# (instanceNo,iworld) = newInstanceNo iworld
# pmeta = {issuedAt=currentDateTime,issuedBy=issuer,stable=False,firstEvent=Nothing,latestEvent=Nothing}
# pmeta = {issuedAt=currentDateTime,issuedBy=issuer,stable=False,firstEvent=Nothing,latestEvent=Nothing,latestAttributes='Map'.newMap}
# meta = createMeta instanceNo Nothing parent Nothing mmeta pmeta
# (_,iworld) = 'SharedDataSource'.write meta (taskInstanceMeta instanceNo) iworld
# (_,iworld) = 'SharedDataSource'.write (createReduct instanceNo task taskTime) (taskInstanceReduct instanceNo) iworld
......@@ -152,7 +152,7 @@ evalTaskInstance event instanceNo iworld=:{currentDateTime,currentUser,currentIn
# (meta, iworld) = case 'SharedDataSource'.read (taskInstanceMeta instanceNo) iworld of
(Ok meta, iworld) = (meta, iworld)
(_, iworld) = (meta, iworld)
# meta = {TIMeta|meta & progress = setStability result progress}
# meta = {TIMeta|meta & progress = updateProgress currentDateTime result progress}
# (_,iworld) = 'SharedDataSource'.writeFilterMsg meta ((<>) instanceNo) (taskInstanceMeta instanceNo) iworld //TODO Check error
//Store updated reduct
# (nextTaskNo,iworld) = getNextTaskNo iworld
......@@ -171,9 +171,13 @@ where
getLocalShares iworld=:{IWorld|localShares} = (localShares,iworld)
getLocalLists iworld=:{IWorld|localLists} = (localLists,iworld)
setStability (ExceptionResult _ _) meta = {meta & stable = True}
setStability (ValueResult (Value _ True) _ _ _) meta = {meta & stable = True}
setStability _ meta = {meta & stable = False}
updateProgress now result progress
# progress = {progress & firstEvent = Just (fromMaybe now progress.firstEvent), latestEvent = Just now}
= case result of
(ExceptionResult _ _) = {progress & stable = True}
(ValueResult (Value _ True) _ _ _) = {progress & stable = True}
(ValueResult _ _ (TaskRep ui _) _) = {progress & stable = False, latestAttributes = uiDefAttributes ui}
_ = {progress & stable = False}
tasktree (ValueResult _ _ _ tree) = tree
tasktree (ExceptionResult _ _) = TCNop
......@@ -254,7 +258,6 @@ where
toItem {TaskListEntry|entryId,state,result=TIValue val ts,attributes}
= {taskId = entryId
,value = deserialize val
,taskMeta = 'Map'.toList attributes
,managementMeta = management
,progressMeta = progress
}
......
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