From aba3ab980a03beb4e00ea58ef219701cafc3f77f Mon Sep 17 00:00:00 2001 From: Malar Kannan Date: Fri, 1 Sep 2017 10:28:56 +0530 Subject: [PATCH] update readme --- README.md | 2 ++ models.py | 4 +++- server.py | 8 +++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bea820b..e9f45c1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ start the server by running `$ http --session=./session.json -f POST http://127.0.0.1:5000/api/login username=user@example.com password=password` ### Update Attendance +The `time` is optional and it may contain values *'now'* or *ISO-8601 time-string* #### Student : `$ http --session=./session.json -f POST http://127.0.0.1:5000/api/attendance/student presence=absent identifier=2 time=now` #### Class : @@ -14,6 +15,7 @@ start the server by running ### Get Attendance +The `start_time` and `end_time` are optional and they may contain values *'now'* or **time string** #### Student: `$ http --session=./session.json GET "http://127.0.0.1:5000/api/attendance/student?identifier=2&start_time=now&end_time=now"` diff --git a/models.py b/models.py index 99c99b5..bc5884b 100644 --- a/models.py +++ b/models.py @@ -35,7 +35,9 @@ class Presence(Enum): """docstring for ResultType.""" PRESENT, ABSENT, SICK, VACATION = range(4) -presense_map = {i:str(i).replace('Presence.', '').upper() for i in Presence} + +presense_map = {i: str(i).replace('Presence.', '').upper() for i in Presence} + class Gradeclass(db.Model): id = db.Column(db.Integer, primary_key=True) diff --git a/server.py b/server.py index ee91113..8f573a1 100644 --- a/server.py +++ b/server.py @@ -26,8 +26,8 @@ security = Security(app, user_datastore) def auth_func(*args, **kwargs): - # if not current_user.is_authenticated: - # raise ProcessingException(description='Not authenticated', code=401) + if not current_user.is_authenticated: + raise ProcessingException(description='Not authenticated', code=401) return True @@ -81,8 +81,6 @@ def parse_time(time_str): def compute_attendance(request_type, object_id, start_time, end_time): - print('AttendanceUpdates for :', start_time, end_time) - def get_records(req_type, obj_id): return AttendanceUpdate.query.filter( AttendanceUpdate.update_type == req_type).filter( @@ -208,7 +206,7 @@ def logout(): @app.route('/') def home(): - return 'hello' + return 'welcome' if __name__ == '__main__':