Created
August 1, 2017 11:42
-
-
Save harveyslash/317d8e6cfc22f5e06004bebc13ea8c1f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def get_highest_score(test_id): | |
test_attempts = db.session.query(TestAttempt).filter_by(test_id=test_id) | |
scores = [] | |
if test_attempts.count() < 1: | |
return {'max_score': 0} | |
for each in test_attempts: | |
user_id = each.user_id | |
test_id = each.test_id | |
if each.is_complete: | |
k = get_college_test_attempt_score(test_id, user_id)['score'] | |
scores.append(k) | |
if len(scores): | |
max_score = max(scores) | |
return {'max_score': max_score} | |
return {'max_score': 0} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment