diff --git a/src/app/models/project.py b/src/app/models/project.py index 2a898e8..c1e082c 100644 --- a/src/app/models/project.py +++ b/src/app/models/project.py @@ -52,8 +52,18 @@ def get_project_by_id(projectid): projectid + "\"") cursor.execute(query) project = cursor.fetchall() + cursor.close() return project[0] +def update_project_status(projectid, status): + cursor = db.cursor() + query = ("UPDATE projects SET project_status = \"" + status + + "\" WHERE projectid = \"" + projectid + "\"") + print(query) + cursor.execute(query) + db.commit() + cursor.close() + def get_projects_by_status_and_category(categoryid, project_status): """ Retrieve all projects from a category with a specific status @@ -69,6 +79,7 @@ def get_projects_by_status_and_category(categoryid, project_status): project_status + "\" AND categoryid = \"" + categoryid + "\"") cursor.execute(query) projects = cursor.fetchall() + cursor.close() return projects def get_projects_by_owner(userid): diff --git a/src/app/views/apply.py b/src/app/views/apply.py index 222620a..f589312 100644 --- a/src/app/views/apply.py +++ b/src/app/views/apply.py @@ -60,7 +60,8 @@ class Apply: for applicant in applicants: print("Add", applicant, data.projectid) models.project.set_projects_user(data.projectid, str(applicant[0]), "TRUE", "TRUE", "FALSE") - raise web.seeother(('/project?projectid=' + data.projectid)) + models.project.update_project_status(data.projectid, "in progress") + raise web.seeother(('/project?projectid=' + str(data.projectid))) except Exception as e: raise diff --git a/src/app/views/index.py b/src/app/views/index.py index 2131610..20f0cc6 100644 --- a/src/app/views/index.py +++ b/src/app/views/index.py @@ -23,6 +23,7 @@ class Index: project_bulk_one = models.project.get_projects_by_status_and_owner(str(session.userid), "open") project_bulk_two = models.project.get_projects_by_status_and_owner(str(session.userid), "in progress") elif data.projects == 'customer': + # TODO: Can customer projects be open? project_bulk_one = models.project.get_projects_by_participant_and_status(str(session.userid), "open") project_bulk_two = models.project.get_projects_by_participant_and_status(str(session.userid), "in progress") elif data.projects == 'finished':