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'])
@login_required(groups=[USER])
def _getJob(**kwargs):
try:
if 'accToken' in kwargs:
accToken = kwargs['accToken']
data = request.get_json()
date = datetime.utcfromtimestamp(int(data['date']))
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
def _getUser(**kwargs):
data = request.get_json()
date = datetime.utcfromtimestamp(int(data['date']))
retVal = userController.getWorker(date)
print(retVal)
return jsonify(retVal)