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)