CSC/ECE 517 Spring 2025 - E2511. Reimplement participants controller.rb
About Expertiza
Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.
Introduction
This project aims to reimplement the participants_controller.rb
and participants_helper.rb
in the new Expertiza system. The participants_controller.rb
manages participants within assignments, and this reimplementation focuses on streamlining its methods, eliminating redundancy, and enhancing code readability and maintainability.
Requirements
- Implement
participants_controller.rb
Methods: Fully implement each controller method with the same functionality as the current controller. - Import from
participants_helper.rb
: Integrate relevant helper methods to streamline functionality and remove redundancy. - API Creation: Expose API endpoints for all necessary methods to enable seamless access and integration from the frontend. Ensure that each endpoint follows best practices for RESTful API design, including proper error handling and secure data access.
- Testing with rswag: Create test cases for all methods, focusing on edge cases, and generate rswag documentation.
- Swagger UI Video Documentation: Record a video walkthrough of API endpoints in Swagger UI, showcasing each method’s functionality.
Tasks to be Completed
- Implement participants_controller.rb Methods: Develop each method with the same functionality as the existing controller.
- Refactor and Integrate Helper Methods: Import relevant methods from participants_helper.rb to improve efficiency and eliminate code duplication.
- API Development: Expose RESTful API endpoints for necessary operations, ensuring proper error handling and secure data access.
- Testing with Rswag: Implement comprehensive test cases, including edge cases, and generate Rswag documentation.
- Swagger UI Documentation: Create a video walkthrough demonstrating API endpoints and their functionalities in Swagger UI.
- Make sure to write intuitive test cases for this controller using RSpec
Reimplement participants_controller.rb
participants_controller.rb Methods / API Calls
# | HTTP Method | Endpoint | Method Name | Description |
---|---|---|---|---|
1 | GET | /api/v1/participants | index | List all participants |
2 | POST | /api/v1/participants | create | Create a new participant |
3 | GET | /api/v1/participants/:id | show | Retrieve a participant by ID |
4 | PUT | /api/v1/participants/:id | update | Update a participant |
5 | DELETE | /api/v1/participants/:id | destroy | Delete a participant |
6 | GET | /api/v1/participants/user/:user_id | user_index | Get participants by user ID |
7 | GET | /api/v1/participants/assignment/:assignment_id | assignment_index | Get participants by assignment ID |
8 | POST | /api/v1/participants/:id/:authorization | add | Add a participant with authorization |
9 | PATCH | /api/v1/participants/:id/:authorization | update_authorization | Update participant authorization |
Removed Methods from participants_controller.rb
The following methods were removed as part of the reimplementation:
action_allowed?
– No impact on functionality.controller_locale
– No impact on functionality.inherit
– Redundant due to lack of direct relation between Course and Participant.bequeath_all
– Same reason as above.change_handle
– `User` model already has `handle`, so it's redundant.delete
– Replaced by `remove_participant` inassignments_controller.rb
.view_copyright_grants
– Old implementation was incorrect.get_user_info
– Covered by `belongs_to` relation in the `Participant` model.get_signup_topics_for_assignment
– Now handled by `sign_up_topics_controller.rb`.
Implementation Summary
Api::V1::ParticipantsController
was restructured to:
- Follow RESTful conventions (`index`, `show`, `create`, `update`, `destroy`)
- Add custom endpoints for `user_index`, `assignment_index`, and `update_authorization`
- Leverage strong parameters and `before_action` filters
- Integrate logic from `participants_helper.rb` (like `participant_permissions`)
- Improve error handling using status codes and JSON messages
Status
In Progress / Completed (choose one)
Resources
Team Members
- Vansh Dodiya (vkdodiya)
- Brian Huynh (bhhuynh)
- Akhil Adusumilli (aadusum)
Mentor
- Aniruddha Rajnekar