Skip to content

Commit

Permalink
fix 🥚
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Aug 9, 2023
1 parent a7593e4 commit 64556c9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions BookingSystem/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,16 @@ def get_user(userid: str) -> flask.Response:

@api.route('/users', methods=['POST'])
@login_required()
@handle_api_exception
def register_student() -> flask.Response:
"""Add/update a class in the database."""
con = sqlite3.connect(DATABASE)
cur = con.cursor()

selected_classroom = flask.request.form.get('classroom')
sanitize({'classroom': VALIDATORS.GROUP}, {'classroom': selected_classroom})
try:
sanitize({'classroom': VALIDATORS.GROUP}, {'classroom': selected_classroom})
except APIException as e:
return flask.abort(e.status_code, e.message)

data = {
'name': flask.session.get('user').name,
Expand Down Expand Up @@ -307,7 +309,7 @@ def email_report() -> flask.Response:
last_sent = datetime.fromtimestamp(float(mail.get_last_sent())).date()
if last_sent and (current_date - last_sent).days < int(interval):
raise APIException(f'Ikke sendt - mindre enn {interval} dager siden forrige rapport.', 200)

return mail.send_report()


Expand Down

0 comments on commit 64556c9

Please sign in to comment.