From 4a945a53bbc395d1b980d804173e4fab74effa1e Mon Sep 17 00:00:00 2001 From: Cole Stowell Date: Sun, 30 Aug 2026 20:27:06 -0400 Subject: [PATCH] fix: check roomNumber key before indexing --- conditional/util/housing.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/conditional/util/housing.py b/conditional/util/housing.py index cf2d727e..82debc03 100644 --- a/conditional/util/housing.py +++ b/conditional/util/housing.py @@ -24,12 +24,17 @@ def get_housing_queue(is_eval_director=False): } queue = ldap.get_group_member_attributes(groups=['current_student'], - excluded_groups=[], attributes=['uid', 'housingPoints', 'cn']) + excluded_groups=[], + attributes=['uid', 'housingPoints', 'cn', 'roomNumber']) - # if the user is not evals, they should only see people in the cue without a room number + # if the user is not evals, they should only see people in the queue without a room number if not is_eval_director: - queue = list(filter(lambda member: member['uid'] in in_queue and member['roomNumber'] is not None, queue)) - + def member_in_queue(member): + return ( + member['uid'] in in_queue + and ('roomNumber' not in member or member['roomNumber'] is not None) + ) + queue = list(filter(member_in_queue, queue)) # set the time they were added to the queue # i'm sorry this is cursed, it's this way because of database structure or something