finished ##168

This commit is contained in:
Tim Gröger 2020-02-22 11:15:20 +01:00
parent e1b0d46771
commit e3bf18a927
1 changed files with 6 additions and 21 deletions

View File

@ -53,24 +53,9 @@ def _saveConfig(**kwargs):
@user.route("/user/job", methods=['POST']) @user.route("/user/job", methods=['POST'])
@login_required(groups=[USER]) @login_required(groups=[USER])
def _getJob(**kwargs): def _getUser(**kwargs):
try: data = request.get_json()
if 'accToken' in kwargs: date = datetime.utcfromtimestamp(int(data['date']))
accToken = kwargs['accToken'] retVal = userController.getWorker(date)
data = request.get_json() print(retVal)
date = datetime.utcfromtimestamp(int(data['date'])) return jsonify(retVal)
test = userController.getWorker(date, username=accToken.user.uid)
if test == [None]:
job = False
else:
job = True
if job:
workers = userController.getWorker(date)
for worker in workers:
if worker['user']['uid'] == accToken.user.uid:
workers.remove(worker)
return jsonify({'job': job, 'workers': workers})
return jsonify({'job': job})
except Exception as err:
traceback.print_exc()
return jsonify({"error": str(err)}), 409