Add subtask module
This commit is contained in:
parent
1b93fce200
commit
a2d56d6ac4
2 changed files with 33 additions and 11 deletions
23
src/TaskMachine/Subtask.hs
Normal file
23
src/TaskMachine/Subtask.hs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
module TaskMachine.Subtask
|
||||||
|
( Subtask(..)
|
||||||
|
, SubtaskID
|
||||||
|
, allRepetitionsTotal
|
||||||
|
, allRepetitionsDone
|
||||||
|
) where
|
||||||
|
|
||||||
|
import qualified Data.Text as T
|
||||||
|
|
||||||
|
type SubtaskID = Integer
|
||||||
|
|
||||||
|
data Subtask = Subtask
|
||||||
|
{ subID :: SubtaskID
|
||||||
|
, subLabel :: T.Text
|
||||||
|
, subRepetitionsTotal :: Integer
|
||||||
|
, subRepetitionsDone :: Integer
|
||||||
|
}
|
||||||
|
|
||||||
|
allRepetitionsTotal :: [Subtask] -> Integer
|
||||||
|
allRepetitionsTotal = sum . map subRepetitionsTotal
|
||||||
|
|
||||||
|
allRepetitionsDone :: [Subtask] -> Integer
|
||||||
|
allRepetitionsDone = sum . map subRepetitionsDone
|
||||||
|
|
@ -9,22 +9,14 @@
|
||||||
|
|
||||||
module TaskMachine.Task
|
module TaskMachine.Task
|
||||||
( Task(..)
|
( Task(..)
|
||||||
, Subtask(..)
|
, TaskID
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
import qualified TaskMachine.DateExpr as TM
|
import qualified TaskMachine.DateExpr as TM
|
||||||
import qualified TaskMachine.Deadline as TM
|
import qualified TaskMachine.Deadline as TM
|
||||||
|
import qualified TaskMachine.Subtask as TM
|
||||||
type SubtaskID = Integer
|
|
||||||
|
|
||||||
data Subtask = Subtask
|
|
||||||
{ subID :: SubtaskID
|
|
||||||
, subLabel :: T.Text
|
|
||||||
, subRepetitionsTotal :: Integer
|
|
||||||
, subRepetitionsDone :: Integer
|
|
||||||
}
|
|
||||||
|
|
||||||
type TaskID = Integer
|
type TaskID = Integer
|
||||||
|
|
||||||
|
|
@ -34,7 +26,14 @@ data Task = Task
|
||||||
, taskFormula :: Maybe TM.IntExpr
|
, taskFormula :: Maybe TM.IntExpr
|
||||||
, taskDescription :: T.Text
|
, taskDescription :: T.Text
|
||||||
, taskDetails :: T.Text
|
, taskDetails :: T.Text
|
||||||
, taskSubtasks :: [Subtask]
|
, taskSubtasks :: [TM.Subtask]
|
||||||
|
}
|
||||||
|
|
||||||
|
data EmptyTask = EmptyTask
|
||||||
|
{ etaskID :: TaskID
|
||||||
|
, etaskFormula :: Maybe TM.IntExpr
|
||||||
|
, etaskDescription :: T.Text
|
||||||
|
, etaskDetails :: T.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
{-
|
{-
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue