Skip to content

Commit

Permalink
Merge branch '7.0.x' into new/task-similarity
Browse files Browse the repository at this point in the history
  • Loading branch information
macite committed Mar 21, 2024
2 parents aa4d7e8 + 1445ddf commit aa6d23d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
33 changes: 30 additions & 3 deletions config/deakin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa6d23d

Please sign in to comment.