Skip to content

Make sync enrollments and sync assignments async with Good_job gem and Added good_job gem dashboard permission control#346

Open
gobears01 wants to merge 31 commits intomainfrom
gem-dashboards
Open

Make sync enrollments and sync assignments async with Good_job gem and Added good_job gem dashboard permission control#346
gobears01 wants to merge 31 commits intomainfrom
gem-dashboards

Conversation

@gobears01
Copy link
Copy Markdown

General Info

We need a framework to run async functions in the background (show status syncing). Async cast (sync enrollments/assignments should show status). We don’t want to wait 30/ 60s as per the current implementation.

Changes

Previously, "Sync Enrollments" and "Sync Assignments" were synchronous: the HTTP request would block until all Canvas API calls completed, which could take 30–60 seconds and risk timing out. This PR makes both operations asynchronous using GoodJob, a PostgreSQL-backed Active Job backend.
Added permission control for good_job gem admin dashboard to work in production

Background job infrastructure:
Added GoodJob gem and ran its migration to create the good_jobs table in Postgres
Configured config.active_job.queue_adapter = :good_job in application.rb
Added a Procfile so Heroku runs a separate worker dyno alongside web
Added dotenv-rails gem to support loading .env locally
Async sync behavior:
Course#sync_assignments and Course#sync_users_from_canvas now call perform_later instead of running inline; the controller returns immediately after enqueuing
Added GET /courses/:id/sync_status endpoint that returns the last roster_synced_at / assignments_synced_at timestamps from CourseToLms
Added good_job initializer
Fixed lograge controller scoping
UI:
Both sync buttons now disable and show a "Syncing..." label + spinner immediately on click
The Stimulus controllers poll /sync_status every 1 second and reload the page with a banner notification once the job's timestamp changes, confirming completion
On timeout (60s) or error, an alert flash is shown and the button re-enabled

Testing

Added a full RSpec spec for SyncUsersFromCanvasJob covering: user upsert, enrollment creation, role-based removal, multi-role sync, return values/persistence, and non-array Canvas error responses
Rewrote the stale pending spec for SyncAllCourseAssignmentsJob#sync_assignment to test the instance method directly (create, update, unchanged)
Updated course_spec to verify sync_users_from_canvas enqueues the job rather than running inline
Added Cucumber scenarios for both sync buttons: visibility, disabled state, and spinner appearance after clicking
Set config.good_job.execution_mode = :external in test.rb to prevent GoodJob from executing jobs in-process during tests (which would cause the page to reload before Capybara could assert on the loading state)

Documentation

No documentation needed

Checklist

  • Name of branch corresponds to story

cycomachead and others added 30 commits April 14, 2026 16:54
- Relocate export buttons below the table for better layout flow.
- Add a "Batch Edit" toggle to control selection column visibility.
- Update action buttons with specific labels and remove nested groups.
- Add checkmark indicators and improved alignment to column visibility menu.
- Remove redundant navigation links from the actions column.

Co-authored-by: Claude Code <noreply@anthropic.com>
Implement logic to group courses by semester on the dashboard, replacing the flat list with a categorized view. This includes a custom sorting algorithm to display semesters in reverse chronological order (Fall > Summer > Spring > Winter).

- Added `Course.sort_semesters` utility for season-aware chronological sorting
- Updated `CoursesController` to group teacher and student courses
- Added full-width semester header rows to the dashboard tables
- Removed redundant "Term" column in favor of group headers
- Added unit and controller specs for sorting and grouping logic

Co-authored-by: Claude Code <noreply@anthropic.com>
…8-improve-semester-dashboard/1

Improve Semester Display on Dashboard: Group Courses, Add Semester Headers, and Implement Sorting Logic
* main:
  gosh sprockets is frustrating
  WIP debugging JS / datatables
  Attemmpts at styling the course dashboard a little more
  Delint
  Delint
  Run db:migrate
  feat: group and sort dashboard courses by semester
…7-enhance-staff-requests-index/1

UX Improvements to the Instructor Requests Dashboard
Bumps [hypershield](https://github.com/ankane/hypershield) from 0.5.1 to 0.6.0.
- [Changelog](https://github.com/ankane/hypershield/blob/master/CHANGELOG.md)
- [Commits](ankane/hypershield@v0.5.1...v0.6.0)

---
updated-dependencies:
- dependency-name: hypershield
  dependency-version: 0.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [timecop](https://github.com/travisjeffery/timecop) from 0.9.10 to 0.9.11.
- [Changelog](https://github.com/travisjeffery/timecop/blob/master/History.md)
- [Commits](travisjeffery/timecop@v0.9.10...v0.9.11)

---
updated-dependencies:
- dependency-name: timecop
  dependency-version: 0.9.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.41.0 to 4.43.0.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
- [Commits](SeleniumHQ/selenium@selenium-4.41.0...selenium-4.43.0)

---
updated-dependencies:
- dependency-name: selenium-webdriver
  dependency-version: 4.43.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…ndler/selenium-webdriver-4.43.0

Bump selenium-webdriver from 4.41.0 to 4.43.0
…ndler/timecop-0.9.11

Bump timecop from 0.9.10 to 0.9.11
…ndler/hypershield-0.6.0

Bump hypershield from 0.5.1 to 0.6.0
Comment on lines +20 to +25
// For the requests table, we want to make the action buttons exactly the same size
// regardless of the icon used.
.action-btn i {
width: 12.5px;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// For the requests table, we want to make the action buttons exactly the same size
// regardless of the icon used.
.action-btn i {
width: 12.5px;
}

Whoops, this is my sloppiness. I should have deleted this.

@cycomachead
Copy link
Copy Markdown
Member

This looks good to me! Can you please merge the upstream changes in to the cs169 repo so this PR is a little smaller?

Also, I think it was a different PR or I didn't notice it, but on the user dropdown can we please add a heading "Admin Tools" above the dashboard/background jobs links? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants