Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add 2 housing points when passing Spring Evals #366

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion conditional/blueprints/slideshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
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
8 changes: 8 additions & 0 deletions conditional/util/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def ldap_is_current_student(account):
return _ldap_is_member_of_group(account, 'current_student')


def ldap_get_housingpoints(account):
galenguyer marked this conversation as resolved.
Show resolved Hide resolved
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()
Expand Down