From fd2c9a2a7e4924a41d88430eb118c5de36b247e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 4 Jun 2020 13:19:00 +0200 Subject: [PATCH] =?UTF-8?q?diensteinladung=20und=20=C3=BCbertragung=20fert?= =?UTF-8?q?ig.=20User=20k=C3=B6nnen=20leute=20einladen,=20sich=20austragen?= =?UTF-8?q?,=20jobs=20abgeben=20usw.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit user können sehen, wenn es neue nachrichten gibt und sehen ob die einladung bzw. anfrage gesehen wurde. --- .../controller/databaseController/dbJobRequesController.py | 4 ++-- .../controller/mainController/mainJobRequestController.py | 3 ++- geruecht/user/routes.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/geruecht/controller/databaseController/dbJobRequesController.py b/geruecht/controller/databaseController/dbJobRequesController.py index b65e323..8f77752 100644 --- a/geruecht/controller/databaseController/dbJobRequesController.py +++ b/geruecht/controller/databaseController/dbJobRequesController.py @@ -68,7 +68,7 @@ class Base: def updateJobRequest(self, jobrequest): try: cursor = self.db.connection.cursor() - cursor.execute("update job_request set watched={}, answered={} where id={}".format(jobrequest['watched'], jobrequest['answered'], jobrequest['id'])) + cursor.execute("update job_request set watched={}, answered={}, accepted={} where id={}".format(jobrequest['watched'], jobrequest['answered'], jobrequest['accepted'], jobrequest['id'])) self.db.connection.commit() return self.getJobRequest(None, None, None, jobrequest['id']) except Exception as err: @@ -79,7 +79,7 @@ class Base: def updateAllJobRequest(self, jobrequest): try: cursor = self.db.connection.cursor() - cursor.execute("update job_request set answered={}, accepted={} where from_user={} and on_date='{}'".format(jobrequest['answered'], jobrequest['accepted'], jobrequest['from_user']['id'], jobrequest['on_date'])) + cursor.execute("update job_request set answered={} where from_user={} and on_date='{}'".format(jobrequest['answered'], jobrequest['from_user']['id'], jobrequest['on_date'])) self.db.connection.commit() except Exception as err: traceback.print_exc() diff --git a/geruecht/controller/mainController/mainJobRequestController.py b/geruecht/controller/mainController/mainJobRequestController.py index 8c7bc1f..05529a6 100644 --- a/geruecht/controller/mainController/mainJobRequestController.py +++ b/geruecht/controller/mainController/mainJobRequestController.py @@ -24,8 +24,9 @@ class Base: from_user = jobRequest['from_user'] to_user = jobRequest['to_user'] on_date = date(jobRequest['date']['year'], jobRequest['date']['month'], jobRequest['date']['day']) + job_kind = jobRequest['job_kind'] debug.info("set new JobRequest from_user {{ {} }}, to_user {{ {} }}, on_date {{ {} }}") - retVal.append(db.setJobRequest(from_user, to_user, on_date)) + retVal.append(db.setJobRequest(from_user, to_user, on_date, job_kind)) debug.debug("seted JobRequests are {{ {} }}".format(retVal)) return retVal diff --git a/geruecht/user/routes.py b/geruecht/user/routes.py index b48e5b3..e433798 100644 --- a/geruecht/user/routes.py +++ b/geruecht/user/routes.py @@ -360,12 +360,12 @@ def _JobRequests(**kwargs): try: debug.info("/user/JobRequests") data = request.get_json() - data['on_date'] = date(data['on_date']['year'], data['on_date']['month'], data['on_date']['day']) if request.method == 'PUT': mainController.setJobRequests(data) retVal = mainController.getJobRequests(kwargs['accToken'].user.toJSON(), None, datetime.now().date()) debug.debug("return {{ {} }}".format(retVal)) if request.method == 'POST': + data['on_date'] = date(data['on_date']['year'], data['on_date']['month'], data['on_date']['day']) retVal = mainController.updateJobRequests(data) return jsonify(retVal)