-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputtodo.py
executable file
·40 lines (29 loc) · 1.12 KB
/
inputtodo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/python3
import sqlite3
from datetime import date
# CREATE TABLE tasks (id, task, priority, severity, type, subtask, estimatedtime, creationdate, deadline, importance);
# determine id
conn = sqlite3.connect('todo.sqlite')
c = conn.cursor()
c.execute("select max(id) from tasks;")
maxid = c.fetchone()
print(maxid)
if maxid[0] == (None):
id = 0;
else:
id = int(maxid[0]) + 1;
task = input('Name of the task: ')
priority = input('Priority: ')
severity = input('Severity: ')
type = input('Type/Category: ')
subtask = input('Subtask: ')
estimatedtime = input('Estimated work time: ')
creationdate = date.isoformat(date.today())
deadline = input('Deadline: ')
importance = input('Importance: ')
print ("id, task, priority, severity, type, subtask, estimatedtime, creationdate, deadline, importance")
print (id, task, priority, severity, type, subtask, estimatedtime, creationdate, deadline, importance)
c = conn.cursor()
c.execute('INSERT INTO tasks VALUES (?,?,?,?,?,?,?,?,?,?)', [(id), (task), (priority), (severity), (type), (subtask), (estimatedtime), (creationdate), (deadline), (importance)])
conn.commit()
conn.close()