Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions conditional/blueprints/slideshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from conditional.models.models import SpringEval
from conditional.util.auth import get_user
from conditional.util.flask import render_template
from conditional.util.ldap import ldap_is_intromember, ldap_set_failed, ldap_set_bad_standing, \
ldap_set_inactive, ldap_get_member, ldap_set_not_intro_member
from conditional.util.user_dict import user_dict_is_eval_director
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_get_housingpoints, ldap_set_housingpoints


logger = structlog.get_logger()

Expand Down Expand Up @@ -137,6 +137,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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

future: do we have handling of success/failure in ldap operations to give evals/rtps a list at the end of "here's all the results that need to be fixed"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have that anywhere. I think a new issue is in order for that

elif status == "Failed":
if ldap_is_intromember(account):
ldap_set_failed(account)
Expand Down
10 changes: 9 additions & 1 deletion conditional/util/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@ def ldap_is_current_student(account) -> bool:
return _ldap_is_member_of_group(account, 'current_student')


def ldap_set_housingpoints(account, housing_points) -> bool:
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()
ldap_get_member.cache_clear()
Expand Down
Loading