Skip to content

Commit

Permalink
[Feature:System] Don't set given names to empty string (#37)
Browse files Browse the repository at this point in the history
Currently this script is setting all users preferred names to an empty
string upon running, which causes many database queries to become
substantially longer to account for both values indicating no desired
preferred name.
  • Loading branch information
lavalleeale authored Jan 24, 2025
1 parent f283997 commit 31710c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions student_auto_feed/ssaf_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ class sql {
user_familyname,
user_preferred_givenname,
user_email
) VALUES ($1, $2, $3, $4, $5, $6)
) VALUES ($1, $2, $3, $4, NULLIF($5,''), $6)
ON CONFLICT (user_id) DO UPDATE
SET user_numeric_id=EXCLUDED.user_numeric_id,
user_givenname=EXCLUDED.user_givenname,
user_familyname=EXCLUDED.user_familyname,
user_preferred_givenname=
CASE WHEN users.user_updated=FALSE
AND users.instructor_updated=FALSE
AND COALESCE(users.user_preferred_givenname, '')=''
AND users.user_preferred_givenname IS NULL
THEN EXCLUDED.user_preferred_givenname
ELSE users.user_preferred_givenname
END,
Expand Down

0 comments on commit 31710c5

Please sign in to comment.