CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Added future plan)
Line 19: Line 19:


# <b>Enhancing Code Clarity:</b>
# <b>Enhancing Code Clarity:</b>
# - Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.
*Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.
# - Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.
*Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.
# - Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.
*Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.


# <b>Removing Unused Methods:</b>
# <b>Removing Unused Methods:</b>
# - Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.
*Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.
# - Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.
*Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.
# - Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.
*Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.


# <b>Refactor Action Allowed Logic:</b>
# <b>Refactor Action Allowed Logic:</b>
# - Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.
*Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.
# - Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.
*Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.
# - Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.
*Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.


# <b>Consolidate Helper Modules:</b>
# <b>Consolidate Helper Modules:</b>
# - Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.
*Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.
# - Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.
*Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.
# - Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.
*Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.


# <b>Streamline View Methods:</b>
# <b>Streamline View Methods:</b>
# - Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.
*Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.
# - Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.
*Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.
# - Optimize database queries: Review database queries within view methods and optimize them for performance where possible by eager loading associations and minimizing N+1 queries.
*Optimize database queries: Review database queries within view methods and optimize them for performance where possible by eager loading associations and minimizing N+1 queries.


# <b>Update Edit and Update Actions:</b>
# <b>Update Edit and Update Actions:</b>
# - Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.
*Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.
# - Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.
*Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.
# - Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.
*Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.


# <b>Optimize Chart Generation:</b>
# <b>Optimize Chart Generation:</b>
# - Improve chart rendering: Optimize the generation of charts and bar charts within the `make_chart` method by caching precomputed data and utilizing efficient charting libraries.
*Improve chart rendering: Optimize the generation of charts and bar charts within the `make_chart` method by caching precomputed data and utilizing efficient charting libraries.
# - Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.
*Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.
# - Utilize client-side rendering: Explore options for offloading chart rendering to the client side using JavaScript libraries like Chart.js to improve scalability and responsiveness.
*Utilize client-side rendering: Explore options for offloading chart rendering to the client side using JavaScript libraries like Chart.js to improve scalability and responsiveness.


# <b>Enhance Self-Review Logic:</b>
# <b>Enhance Self-Review Logic:</b>
# - Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.
*Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.
# - Address edge cases: Identify and address edge cases where self-review completion may not be accurately detected, updating the logic as necessary to ensure consistency.
*Address edge cases: Identify and address edge cases where self-review completion may not be accurately detected, updating the logic as necessary to ensure consistency.
# - Improve user feedback: Enhance feedback messages within the `self_review_finished?` method to guide users through the self-review process more effectively and provide clear instructions.
*Improve user feedback: Enhance feedback messages within the `self_review_finished?` method to guide users through the self-review process more effectively and provide clear instructions.


# <b>Improve Redirect Logic:</b>
# <b>Improve Redirect Logic:</b>
# - Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.
*Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.
# - Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.
*Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.
# - Optimize redirection: Streamline redirection logic to minimize unnecessary redirects and improve user experience, ensuring that users are directed to the appropriate pages based on their permissions.
*Optimize redirection: Streamline redirection logic to minimize unnecessary redirects and improve user experience, ensuring that users are directed to the appropriate pages based on their permissions.


# <b>Comprehensive Testing with RSwag:</b>
# <b>Comprehensive Testing with RSwag:</b>
# - Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.
*Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.
# - Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.
*Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.
# - Test coverage: Ensure that all endpoints and functionalities are thoroughly tested using RSwag, verifying that the API behaves as expected and adheres to the specified requirements.
*Test coverage: Ensure that all endpoints and functionalities are thoroughly tested using RSwag, verifying that the API behaves as expected and adheres to the specified requirements.


# <b>Create Video Demonstration:</b>
# <b>Create Video Demonstration:</b>
# - Record demonstration: Create a video demonstrating the integration of Swagger UI with the reimplemented GradesController, showcasing various features and endpoints.
*Record demonstration: Create a video demonstrating the integration of Swagger UI with the reimplemented GradesController, showcasing various features and endpoints.
# - Usage examples: Include usage examples and best practices for interacting with the API endpoints via Swagger UI, guiding users through the process effectively.
*Usage examples: Include usage examples and best practices for interacting with the API endpoints via Swagger UI, guiding users through the process effectively.
# - Documentation: Provide detailed documentation alongside the video, explaining the purpose of each endpoint, expected inputs, and responses, to aid users in understanding and utilizing the API effectively.
*Documentation: Provide detailed documentation alongside the video, explaining the purpose of each endpoint, expected inputs, and responses, to aid users in understanding and utilizing the API effectively.
 


==Team==
==Team==

Revision as of 19:50, 7 April 2024

Expertiza

Expertiza is an open-source web application built on Ruby on Rails that enables instructors to create customized assignments with topic lists for students to choose from. It facilitates team formation, allowing students to collaborate on assignments and projects. Expertiza supports peer review processes where students can provide feedback on each other's submissions across various document formats, including URLs and wiki pages. This freely available platform provides a flexible and comprehensive solution for managing assignments, teamwork, and peer evaluations.

Introduction

We're refactoring the grades_controller.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes thorough rswag testing of the grades_controller method and demonstrating Swagger UI integration.

Problem Statement

The reimplementation project entails:

  1. Refactoring Grades Controller: Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.
  2. Removing Redundant Methods: Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.
  3. CRUD Operations: Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.
  4. Adherence to DRY Principle: Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.
  5. Testing with RSwag: Writing comprehensive tests using RSwag for each controller method to ensure functionality and integration with Swagger UI, followed by a video demonstration showcasing the Swagger UI integration and functionality of the reimplemented controller.

Plan for Reimplementation of GradesController

  1. Enhancing Code Clarity:
  • Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.
  • Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.
  • Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.
  1. Removing Unused Methods:
  • Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.
  • Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.
  • Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.
  1. Refactor Action Allowed Logic:
  • Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.
  • Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.
  • Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.
  1. Consolidate Helper Modules:
  • Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.
  • Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.
  • Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.
  1. Streamline View Methods:
  • Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.
  • Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.
  • Optimize database queries: Review database queries within view methods and optimize them for performance where possible by eager loading associations and minimizing N+1 queries.
  1. Update Edit and Update Actions:
  • Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.
  • Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.
  • Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.
  1. Optimize Chart Generation:
  • Improve chart rendering: Optimize the generation of charts and bar charts within the `make_chart` method by caching precomputed data and utilizing efficient charting libraries.
  • Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.
  • Utilize client-side rendering: Explore options for offloading chart rendering to the client side using JavaScript libraries like Chart.js to improve scalability and responsiveness.
  1. Enhance Self-Review Logic:
  • Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.
  • Address edge cases: Identify and address edge cases where self-review completion may not be accurately detected, updating the logic as necessary to ensure consistency.
  • Improve user feedback: Enhance feedback messages within the `self_review_finished?` method to guide users through the self-review process more effectively and provide clear instructions.
  1. Improve Redirect Logic:
  • Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.
  • Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.
  • Optimize redirection: Streamline redirection logic to minimize unnecessary redirects and improve user experience, ensuring that users are directed to the appropriate pages based on their permissions.
  1. Comprehensive Testing with RSwag:
  • Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.
  • Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.
  • Test coverage: Ensure that all endpoints and functionalities are thoroughly tested using RSwag, verifying that the API behaves as expected and adheres to the specified requirements.
  1. Create Video Demonstration:
  • Record demonstration: Create a video demonstrating the integration of Swagger UI with the reimplemented GradesController, showcasing various features and endpoints.
  • Usage examples: Include usage examples and best practices for interacting with the API endpoints via Swagger UI, guiding users through the process effectively.
  • Documentation: Provide detailed documentation alongside the video, explaining the purpose of each endpoint, expected inputs, and responses, to aid users in understanding and utilizing the API effectively.

Team

Mentor
  • Kashika Malick
Members
  • Sravya Yepuri (syepuri@ncsu.edu)
  • Hasini Chenchala (hchench@ncsu.edu)
  • Chirag Hegde (chegde@ncsu.edu)