diff --git a/mysql/sql/init.sql b/mysql/sql/init.sql index 3ef8be9..39acac4 100644 --- a/mysql/sql/init.sql +++ b/mysql/sql/init.sql @@ -77,7 +77,7 @@ CREATE TABLE tasks ( title VARCHAR(200) NOT NULL, task_description VARCHAR(500), budget INT NOT NULL, - task_status VARCHAR(64) NOT NULL, -- This should be Waiting for delivery, Delivered and waiting for acceptance, Delivery has been accepted, awaiting payment, Payment for delivery is done or Declined delivery, please revise + task_status VARCHAR(64) NOT NULL, -- This should be Waiting for delivery, delivered, accepted and declined delivery feedback VARCHAR(500) NULL, PRIMARY KEY (taskid), FOREIGN KEY (teamid) REFERENCES teams(teamid), diff --git a/src/app/models/project.py b/src/app/models/project.py index c1e082c..ecd492c 100644 --- a/src/app/models/project.py +++ b/src/app/models/project.py @@ -64,6 +64,18 @@ def update_project_status(projectid, status): db.commit() cursor.close() +def get_user_permissions(userid, projectid): + cursor = db.cursor() + query = ("SELECT read_permission, write_permission, modify_permission \ + FROM projects_users WHERE projectid = \"" + projectid + + "\" AND userid = \"" + userid + "\"") + cursor.execute(query) + permissions = cursor.fetchall() + cursor.close() + if len(permissions): + return permissions[0] + return [0,0,0] + def get_projects_by_status_and_category(categoryid, project_status): """ Retrieve all projects from a category with a specific status @@ -145,6 +157,14 @@ def set_task(projectid, task_title, task_description, budget): db.commit() cursor.close +def update_task_status(taskid, status): + cursor = db.cursor() + query = ("UPDATE tasks SET task_status = \"" + status + + "\" WHERE taskid = \"" + taskid + "\"") + cursor.execute(query) + db.commit() + cursor.close() + def get_tasks_by_project_id(projectid): """ Get all tasks belonging to a project diff --git a/src/app/templates/project.html b/src/app/templates/project.html index 74e983c..914c441 100644 --- a/src/app/templates/project.html +++ b/src/app/templates/project.html @@ -1,4 +1,4 @@ -$def with (nav, project, tasks) +$def with (nav, project, tasks, permissions)