aboutsummaryrefslogtreecommitdiff
path: root/src/model/difficulty.py
diff options
context:
space:
mode:
authorJoris2020-05-10 12:50:46 +0200
committerJoris2020-05-10 12:50:46 +0200
commit7372ab407535ade48ce0b642ae051990e3bef7ed (patch)
tree65ae22d72cf10e40e777c4fa1919539d8e065e46 /src/model/difficulty.py
parenta134f20eb62e6d174e7da81fd4adb7ff9e8b3b71 (diff)
downloadtodo-7372ab407535ade48ce0b642ae051990e3bef7ed.tar.gz
todo-7372ab407535ade48ce0b642ae051990e3bef7ed.tar.bz2
todo-7372ab407535ade48ce0b642ae051990e3bef7ed.zip
Add task difficulty and priority fields
Diffstat (limited to 'src/model/difficulty.py')
-rw-r--r--src/model/difficulty.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/model/difficulty.py b/src/model/difficulty.py
new file mode 100644
index 0000000..595f844
--- /dev/null
+++ b/src/model/difficulty.py
@@ -0,0 +1,30 @@
+from enum import IntEnum
+from typing import Optional
+
+class Difficulty(IntEnum):
+ LOW = 0
+ MEDIUM = 1
+ HIGH = 2
+
+values = [
+ Difficulty.LOW,
+ Difficulty.MEDIUM,
+ Difficulty.HIGH]
+
+def format(difficulty: Difficulty) -> str:
+ if difficulty == Difficulty.LOW:
+ return 'Low'
+ elif difficulty == Difficulty.MEDIUM:
+ return 'Medium'
+ elif difficulty == Difficulty.HIGH:
+ return 'High'
+
+def parse(string: str) -> Optional[Difficulty]:
+ if string == 'Low':
+ return Difficulty.LOW
+ elif string == 'Medium':
+ return Difficulty.MEDIUM
+ elif string == 'High':
+ return Difficulty.HIGH
+ else:
+ return None