learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
82 stars 57 forks source link

Fix bug in selecting teachers of specific student #3757

Open milescalabresi opened 1 month ago

milescalabresi commented 1 month ago

Email (or usersearch more generally) to teachers of a specific student does not work due to changes in #3445. The traceback is as follows.

esp/esp/users/controllers/usersearch.py", line 234, in query_from_criteria
    if criteria.get('target_user', '').strip():
AttributeError: 'ESPUser' object has no attribute 'strip'

Fix is to identify what the previous code (criteria['target_user']) was checking for and restore that behavior, ideally while maintaining the performance of the new criteria.get() call.

Reported by Stanford