Skip to content

Conversation

@SahiruWithanage
Copy link

Description

This pull request implements the Staff Grant Extension backend feature for OnTrack.

It introduces a new API endpoint that allows staff members to grant extensions to students directly — even when no formal extension request exists. This supports special circumstances and improves flexibility in managing assessments.

The work also involved refactoring the existing student extension flow (extension_comments_api.rb) to use the same shared service (ExtensionService). Now, both staff- and student-initiated extension requests are handled using the same logic, ensuring consistency and reducing duplication.

Related project: Staff Grant Extension (Design + Requirements Documentation)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor (internal restructuring without changing behavior)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (update or new)

How Has This Been Tested?

The following tests have been written and run to verify correct behavior:

  • Unit tests in staff_grant_extension_test.rb
  • Verified that the service logic correctly mirrors the existing student flow
  • Confirmed that both staff and student flows now use ExtensionService
  • Confirmed that only authorized staff can access the endpoint
  • Tested handling of valid and invalid data

Note: This is backend-only work. Frontend integration is tracked separately.

Checklist

If involving code

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • My changes generate no new warnings

If modified config files

  • I have checked the following files for changes:
    • package.json
    • astro.config.mjs
    • netlify.toml
    • docker-compose.yml
    • custom.css

Folders and Files Added/Modified

Added:

  • app/api/staff_grant_extension_api.rb
  • app/services/extension_service.rb
  • test/api/staff_grant_extension_test.rb

Modified:

  • app/api/api_root.rb
  • app/models/unit.rb
  • app/api/extension_comments_api.rb

Sahiru Withanage and others added 4 commits May 11, 2025 14:05
Enable staff to grant extensions to multiple students without formal requests.
Reuse existing student extension logic through a new service for consistency.
Supports flexible academic support and streamlines staff workflows.

Relates to the OnTrack Staff Grant Extension design documentation.
…rpolated strings

This aligns the test file with the string formatting convention used in the rest of the codebase.
Single quotes are preferred when string interpolation is not needed, improving consistency.

Reviewed as part of peer feedback.
Linked extension_comments_api (student-requested extensions) to use the
shared ExtensionService, previously set up for staff-granted extensions.

This refactor ensures both student and staff extension flows use the
same logic, improving consistency and reducing duplication.
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.

1 participant