def add(self): statements = [ "Enter contact name: ", "Enter contact email: ", "Enter contact phone number: ", "Enter task id (optional): ", "Enter project_id: ", ] fields = console_input(statements) if (not fields[0]) or (not fields[1]) or (not fields[2]) or ( not fields[4]): print("[!] Please provide neccessary details") return None self._cursor.execute( """ INSERT into INTERNALS (name, email, phone, task_id, project_id) VALUES (?, ?, ?, ?, ?); """, (fields[0], fields[1], fields[2], fields[3], fields[4]), ) self._conn.commit() self.internal = InternalsStructure( self._cursor.lastrowid, fields[0], fields[1], fields[2], fields[3], fields[4], )
def add_task_log(self): if not self.task: self._select_task() if not self.task: return statements = ["Enter current status: ", "Enter status description"] fields = console_input(statements) if (not fields[0]) or (not fields[1]): print("[!] Please provide status and status description.") return None self._cursor.execute( """ INSERT INTO TASKLOGS (status, status_info, task_id, created_by) VALUES(?, ?, ?, ?); """, (fields[0], fields[1], self.task.key, self.author), ) self._cursor.execute( """UPDATE TASKS SET status = ?, status_info = ? WHERE id = ? ;""", (fields[0], fields[1], self.task.key), ) self._conn.commit()
def update_task(self): """ Update certain data about tasks """ if not self.task: self._select_task() if not self.task: return statements = [ "Enter task priority(0 for low, 1 for mid, 2 for high): ", "Enter end date (-1 for unknown) : ", "Enter task_id(s) separated by comma(,) if task depends on other tasks (-1 in any-other case): ", ] fields = console_input(statements) if (not fields[0]) or (not fields[1]) or (not fields[2]): print("[!] Please provide priority, end date, & dependent tasks.") return None self._cursor.execute( """ UPDATE TASKS set priority=?, end=?, dependent_on=? Where id=? VALUES(?, ?, ?, ?); """, (fields[0], fields[1], fields[2], self.task.key), ) self._conn.commit() self.task.priority = fields[0] self.task.end = fields[1] self.task.dependent_on = fields[2]
def add_task(self): """ Add task to projects """ statements = [ "Enter task priority(0 for low, 1 for mid, 2 for high): ", "Enter task objective: ", "Enter task description: ", "Enter start date: ", "Enter end date (-1 for unknown) : ", "Enter current status: ", "Enter status description: ", "Enter task_id(s) separated by comma(,) if task depends on other tasks (-1 in any-other case): ", ] fields = console_input(statements) if ((not fields[0]) or (not fields[1]) or (not fields[3]) or (not fields[5]) or (not fields[6]) or (not fields[7])): print( "[!] Please provide priority, objective, start date, current status & status description & dependent tasks." ) return None self._cursor.execute( """ INSERT INTO TASKS(priority, objective, description, start, end, status, status_info,dependent_on, project_id, created_by) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?); """, ( fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], fields[7], self.project_id, self.author, ), ) self.task = TaskStructure(self._cursor.lastrowid, fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], fields[7], self.project_id, self.author) self._conn.commit()
def add_external(self): statements = [ "Enter contact name: ", "Enter contact email: ", "Enter contact phone number: ", "Enter project_id: ", ] fields = console_input(statements) if (not fields[0]) or (not fields[1]) or (not fields[2]) or ( not fields[3]): print("[!] Please provide neccessary details") return None self._cursor.execute( """ INSERT into EXTERNALS (name, email, phone, project_id) VALUES (?, ?, ?, ?); """, (fields[0], fields[1], fields[2], fields[3]), ) self._conn.commit()