Commit e7df023e authored by Steffen Michels's avatar Steffen Michels

Merge branch '145-cannot-delete-task-from-task-list' into 'master'

Fixed removal of task instance data if persistTask option is switched off

Closes #145

See merge request !96
parents 3186e4c4 d108ab31
...@@ -193,8 +193,15 @@ replaceTaskInstance instanceNo task iworld=:{options={appVersion},current={taskT ...@@ -193,8 +193,15 @@ replaceTaskInstance instanceNo task iworld=:{options={appVersion},current={taskT
`b` \iworld -> (Ok (), iworld) `b` \iworld -> (Ok (), iworld)
deleteTaskInstance :: !InstanceNo !*IWorld -> *(!MaybeError TaskException (), !*IWorld) deleteTaskInstance :: !InstanceNo !*IWorld -> *(!MaybeError TaskException (), !*IWorld)
deleteTaskInstance instanceNo iworld deleteTaskInstance instanceNo iworld=:{IWorld|options={EngineOptions|persistTasks}}
//Delete all states //Delete in administration
# (mbe,iworld) = 'SDS'.modify (\is -> ((),[i \\ i=:(no,_,_,_) <- is | no <> instanceNo])) (sdsFocus defaultValue filteredInstanceIndex) iworld
| mbe =: (Error _) = (mbe,iworld)
# (mbe,iworld) = 'SDS'.modify (\(Queue f r) -> ((),Queue [e \\ e=:(no,_) <- f | no <> instanceNo] [e \\ e=:(no,_) <- r | no <> instanceNo])) taskEvents iworld
| mbe =: (Error _) = (mbe,iworld)
| not persistTasks
= (Ok (),iworld)
//Delete all states on disk
# (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-reduct") iworld # (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-reduct") iworld
| mbe =: (Error _) = (Error (exception (fromError mbe)),iworld) | mbe =: (Error _) = (Error (exception (fromError mbe)),iworld)
# (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-value") iworld # (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-value") iworld
...@@ -203,10 +210,6 @@ deleteTaskInstance instanceNo iworld ...@@ -203,10 +210,6 @@ deleteTaskInstance instanceNo iworld
| mbe =: (Error _) = (Error (exception (fromError mbe)),iworld) | mbe =: (Error _) = (Error (exception (fromError mbe)),iworld)
# (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-tasklists") iworld # (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-tasklists") iworld
| mbe =: (Error _) = (Error (exception (fromError mbe)),iworld) | mbe =: (Error _) = (Error (exception (fromError mbe)),iworld)
# (mbe,iworld) = 'SDS'.modify (\is -> ((),[i \\ i=:(no,_,_,_) <- is | no <> instanceNo])) (sdsFocus defaultValue filteredInstanceIndex) iworld
| mbe =: (Error _) = (mbe,iworld)
# (mbe,iworld) = 'SDS'.modify (\(Queue f r) -> ((),Queue [e \\ e=:(no,_) <- f | no <> instanceNo] [e \\ e=:(no,_) <- r | no <> instanceNo])) taskEvents iworld
| mbe =: (Error _) = (mbe,iworld)
= (Ok (),iworld) = (Ok (),iworld)
//Filtered interface to the instance index. This interface should always be used to access instance data //Filtered interface to the instance index. This interface should always be used to access instance data
......
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