diff --git a/conditional/blueprints/slideshow.py b/conditional/blueprints/slideshow.py index c745e24..6d21b76 100644 --- a/conditional/blueprints/slideshow.py +++ b/conditional/blueprints/slideshow.py @@ -12,7 +12,7 @@ from conditional.util.auth import get_user from conditional.util.flask import render_template from conditional.util.ldap import ldap_is_eval_director, ldap_is_intromember, ldap_set_failed, ldap_set_bad_standing, \ - ldap_set_inactive, ldap_get_member, ldap_set_not_intro_member + ldap_set_inactive, ldap_get_member, ldap_set_not_intro_member, ldap_get_housingpoints, ldap_set_housingpoints logger = structlog.get_logger() @@ -136,6 +136,7 @@ def slideshow_spring_review(user_dict=None): if status == "Passed": if ldap_is_intromember(account): ldap_set_not_intro_member(account) + ldap_set_housingpoints(account, ldap_get_housingpoints(account) + 2) elif status == "Failed": if ldap_is_intromember(account): ldap_set_failed(account) diff --git a/conditional/util/ldap.py b/conditional/util/ldap.py index 98cb853..6bd1ecd 100644 --- a/conditional/util/ldap.py +++ b/conditional/util/ldap.py @@ -117,6 +117,14 @@ def ldap_is_current_student(account): return _ldap_is_member_of_group(account, 'current_student') +def ldap_get_housingpoints(account): + ldap_get_current_students.cache_clear() + ldap_get_member.cache_clear() + try: + return account.housingPoints + except AttributeError: + return 0 + def ldap_set_housingpoints(account, housing_points): account.housingPoints = housing_points ldap_get_current_students.cache_clear()