From 41c5f406a10b420877eaaafbb3fec44e627b6f15 Mon Sep 17 00:00:00 2001 From: Andrew Cain Date: Fri, 1 Dec 2023 16:41:48 +1100 Subject: [PATCH 1/2] chore(release): 7.0.22 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35fdf8d4e..f5a4cb57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [7.0.22](https://github.com/macite/doubtfire-deploy/compare/v7.0.21...v7.0.22) (2023-12-01) + + +### Bug Fixes + +* change_task_comment_fail ([a86d1b0](https://github.com/macite/doubtfire-deploy/commit/a86d1b03cfa3db70007785182258c146bc91bc47)) + ### [7.0.21](https://github.com/macite/doubtfire-deploy/compare/v7.0.20...v7.0.21) (2023-09-04) From 1445ddfa26fc207609f40f84e8f8f92145e0e8cc Mon Sep 17 00:00:00 2001 From: Andrew Cain Date: Thu, 21 Mar 2024 11:51:22 +1100 Subject: [PATCH 2/2] fix: deakin username change for student id --- config/deakin.rb | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/config/deakin.rb b/config/deakin.rb index 40d95014b..1eb9ae9a1 100644 --- a/config/deakin.rb +++ b/config/deakin.rb @@ -265,10 +265,37 @@ def sync_student_user_from_callista(row_data) username_user elsif username_user.present? && student_id_user.present? - # Both present, but different + # Both present, but different... + # Most likely updated username with existing student id + if username_user.projects.count == 0 && student_id_user.projects.count > 0 + # Change the student id user to use the new username and email + student_id_user.username = username_user.username + student_id_user.email = username_user.email + student_id_user.login_id = nil + student_id_user.auth_tokens.destroy_all + + # Correct the new username user record - so we mark this as a duplicate and move to the old record + username_user.username = "OLD-#{username_user.username}" + username_user.email = "DUP-#{username_user.email}" + username_user.login_id = nil + + unless username_user.save + logger.error("Unable to fix user #{row_data} - username_user.save failed") + return nil + end + username_user.auth_tokens.destroy_all - logger.error("Unable to fix user #{row_data} - both username and student id users present. Need manual fix.") - nil + unless student_id_user.save + logger.error("Unable to fix user #{row_data} - student_id_user.save failed") + return nil + end + + # We keep the student id user... so return this + student_id_user + else + logger.error("Unable to fix user #{row_data} - both username and student id users present. Need manual fix.") + nil + end else logger.error("Unable to fix user #{row_data} - Need manual fix.") nil