Skip to content

Commit

Permalink
Merge pull request #2083 from NCCE/2788/primary-users-completing-cour…
Browse files Browse the repository at this point in the history
…se-not-all-auto-enrolled

Trying to resolve issues around auto-enrolment
  • Loading branch information
msquance-stem authored Jul 15, 2024
2 parents b7d7cb7 + 79dc99e commit f20a800
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ def perform(user)

case course.attendance_status
when "attended"
any_marked_as_attended = true

achievement.complete!
begin
achievement.complete!
any_marked_as_attended = true
rescue Statesman::TransitionConflictError => e
Sentry.set_tags(achievement_id: achievement.id, user_id: user_id)
Sentry.capture_exception(e)
end
when "cancelled"
achievement.drop!
begin
achievement.drop!
rescue Statesman::TransitionConflictError => e
Sentry.set_tags(achievement_id: achievement.id, user_id: user_id)
Sentry.capture_exception(e)
end
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
expect(CertificatePendingTransitionJob).to have_been_enqueued.exactly(:once)
end

it "queues AutoEnrolJob" do
perform_job
expect(AutoEnrolJob).to have_been_enqueued.exactly(:once)
end

it "creates an achievement that belongs to the right activity" do
perform_job
expect(Achievement.where(activity_id: activity_one.id).exists?).to eq true
Expand Down

0 comments on commit f20a800

Please sign in to comment.