-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
app.config['SENDGRID_DEFAULT_FROM'] = '[email protected]' | ||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER | ||
|
||
MONGO_URL = os.environ.get('DB_URI') | ||
MONGO_URL = os.environ.get('MONGODB_URI') | ||
app.config["MONGO_URI"] = MONGO_URL | ||
mongo = PyMongo(app) | ||
db = mongo.db | ||
|
@@ -181,19 +181,15 @@ def decorated(*args, **kwargs): | |
def getParentInfo(): | ||
curr_link = request.json['curr_link'] | ||
try: | ||
parentId = parentsDOM.get(currLink=curr_link) | ||
parent_id = parentsDOM.get(currLink=curr_link) | ||
except AssertionError as e: | ||
raise AuthError({'wrong link': True}, 401) | ||
|
||
if parentsDOM.isExpired(parent_id): | ||
emailParent(parent_id,'', 'Your updated link is below:') | ||
raise AuthError({'expired': True}, 426) | ||
|
||
parentInfo = parentsDOM.getParentProfile(parentId) | ||
|
||
if parentsDOM.isExpired(parentId): | ||
emailParent(parentId,'', 'Your updated link is below:') | ||
raise AuthError({'expired': True}, 426) | ||
parentInfo = parentsDOM.getParentProfile(parent_id) | ||
|
||
return { | ||
'first_name': parentInfo['first_name'], | ||
|
@@ -205,7 +201,7 @@ def getParentInfo(): | |
def getStudentsOfParent(): | ||
curr_link = request.json['curr_link'] | ||
try: | ||
parentId = parentsDOM.get(currLink=curr_link) | ||
parent_id = parentsDOM.get(currLink=curr_link) | ||
except AssertionError as e: | ||
raise AuthError({'wrong link': True}, 401) | ||
|
||
|
@@ -214,7 +210,7 @@ def getStudentsOfParent(): | |
raise AuthError({'expired': True}, 426) | ||
|
||
|
||
all_student_ids = parentsDOM.getStudentIds(parentId) | ||
all_student_ids = parentsDOM.getStudentIds(parent_id) | ||
unarchived_student_ids = [] | ||
for id in all_student_ids: | ||
if not studentsDOM.isArchived(id): | ||
|
@@ -233,7 +229,7 @@ def getStudentForms(): | |
student_id = ObjectId(request.json['student_id']) | ||
curr_link = request.json['parent_key'] | ||
try: | ||
parentId = parentsDOM.get(currLink=curr_link) | ||
parent_id = parentsDOM.get(currLink=curr_link) | ||
except AssertionError as e: | ||
raise AuthError({'wrong link': True}, 401) | ||
|
||
|
@@ -265,7 +261,7 @@ def getStudentForms(): | |
def getForm(): | ||
curr_link = request.json['curr_link'] | ||
try: | ||
parentId = parentsDOM.get(currLink=curr_link) | ||
parent_id = parentsDOM.get(currLink=curr_link) | ||
except AssertionError as e: | ||
raise AuthError({'wrong link': True}, 401) | ||
|
||
|
@@ -288,10 +284,14 @@ def getForm(): | |
def submitForm(): | ||
curr_link = request.json['curr_link'] | ||
try: | ||
parentId = parentsDOM.get(currLink=curr_link) | ||
parent_id = parentsDOM.get(currLink=curr_link) | ||
except AssertionError as e: | ||
raise AuthError({'wrong link': True}, 401) | ||
|
||
if parentsDOM.isExpired(parent_id): | ||
emailParent(parent_id,'', 'Your updated link is below:') | ||
raise AuthError({'expired': True}, 426) | ||
|
||
form_id = request.json['form_id'] | ||
answer_data = request.json['answer_data'] | ||
FormsDOM.updateFormData(form_id, answer_data) | ||
|