<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Syepuri</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Syepuri"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Syepuri"/>
	<updated>2026-09-12T09:56:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156838</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156838"/>
		<updated>2024-04-24T04:11:23Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Endpoints and Test Scenarios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4_uml.png|800px|UML Diagram]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
==Reimplementation of GradesController ==&lt;br /&gt;
&lt;br /&gt;
=== Implementation of APIs ===&lt;br /&gt;
&lt;br /&gt;
In the context of the project &amp;quot;E2443. Reimplement grades_controller&amp;quot; for the Expertiza platform, the modifications made to the routes.rb file for the GradesController are intended to streamline and enhance the existing functionality related to grading. These routing configurations play a critical role in structuring how grade-related requests are processed and responded to within the application.&lt;br /&gt;
&lt;br /&gt;
The specific routes added under the grades resource leverage a nested structure to facilitate clear and organized handling of various grade-related actions, ensuring that each action pertains directly to individual grade entities identified by :id, being the participant ID. &lt;br /&gt;
&lt;br /&gt;
====Breakdown of Routes====&lt;br /&gt;
&lt;br /&gt;
*View Team (:id/view_team) - This endpoint retrieves detailed information about the team associated with a specific assignment participant. It is crucial for scenarios where assessments or grades are team-based. The API fetches the participant's team and provides comprehensive details, including the team members and their contributions to assignments. This functionality supports collaborative assessments and enhances transparency in team-based grading.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def view_team&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questions = retrieve_questions(questionnaires, assignment.id)&lt;br /&gt;
    pscore = participant_scores(participant, questions)&lt;br /&gt;
    render json: { participant:, assignment:, team:, questions:, pscore:}&lt;br /&gt;
end  &lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_team_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
*View Grade Details (:id/view) - This endpoint allows for viewing all relevant details of an assignment for a particular participant. It aggregates data such as related questionnaires, questions, and scores, providing a holistic view of the grading criteria and results. This function is particularly valuable for providing a comprehensive breakdown of scores across different review rounds, assisting in a deeper understanding of how grades were allocated.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    assignment = Assignment.find(params[:id])&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    if assignment.num_review_rounds &amp;gt; 1&lt;br /&gt;
      questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    else&lt;br /&gt;
      questions = {}&lt;br /&gt;
      questionnaires.each do |questionnaire|&lt;br /&gt;
        questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    scores = review_grades(assignment, questions)&lt;br /&gt;
    num_reviewers_assigned_scores = scores[:teams].length&lt;br /&gt;
    averages = vector(scores)&lt;br /&gt;
    avg_of_avg = mean(averages)&lt;br /&gt;
    render json: { scores:, averages:, avg_of_avg:, num_reviewers_assigned_scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*View Scores (:id/view_scores) - This API endpoint is designed to show scores for a specific assignment participant. It provides detailed insights into how participants are performing in the ongoing assignments and the various stages of assignment completion. This is essential for tracking academic progress and identifying areas where students may need additional support or recognition.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view_scores&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    # questionnaires = assignment.questionnaires&lt;br /&gt;
    # questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    # pscore = participant_scores(participant, questions)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.assignment.id, participant.user_id)&lt;br /&gt;
    stage = assignment.current_stage(topic_id)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_scores.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Update Grade (:id/update) - This endpoint enables updating the grade for a participant. It accepts a new grade value and updates the participant’s record if the new grade differs from the existing one. This API is crucial for situations where grades need to be revised or corrected, ensuring that grading remains dynamic and reflective of actual student performance and any subsequent reviews or reassessments.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def update&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    total_score = params[:total_score]&lt;br /&gt;
    unless format('%.2f', total_score) == params[:participant][:grade]&lt;br /&gt;
      participant.update_attribute(:grade, params[:participant][:grade])&lt;br /&gt;
      message = if participant.grade.nil?&lt;br /&gt;
                  &amp;quot;The computed score will be used for #{participant.user.name}.&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  &amp;quot;A score of #{params[:participant][:grade]}% has been saved for #{participant.user.name}.&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
    end&lt;br /&gt;
    render json: { message: message}&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Update_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Show Grade (:id) - This endpoint provides a detailed view of a participant's assignment by fetching and displaying all relevant information such as the assignment details, participant info, related questions, and scores. This function is a vital read operation that allows instructors and students to access complete information on a participant's performance in a specific assignment.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def show&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    questions = list_questions(assignment)&lt;br /&gt;
    scores = participant_scores(participant, questions)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant:, assignment:, questions:, scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Show_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Action Allowed (:id/action_allowed) - This endpoint checks if a particular action is allowed for the current user, based on the user’s role and the specific action they intend to perform (like viewing scores). It ensures that operations are conducted within established permissions, enhancing security and role-based access control within the application. This is critical for maintaining the integrity of the grading process and ensuring that only authorized actions are executed.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def action_allowed&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'view_scores'&lt;br /&gt;
      if current_user_has_student_privileges? &amp;amp;&amp;amp;&lt;br /&gt;
        are_needed_authorizations_present?(params[:id], 'reader', 'reviewer') &amp;amp;&amp;amp;&lt;br /&gt;
        self_review_finished?&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
      end&lt;br /&gt;
    when 'view_team'&lt;br /&gt;
      if current_user_is_a? 'Student'&lt;br /&gt;
        participant = AssignmentParticipant.find_by(id: params[:id])&lt;br /&gt;
        if participant &amp;amp;&amp;amp; current_user_is_assignment_participant?(participant.assignment.id)&lt;br /&gt;
          render json: { allowed: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      if current_user_has_ta_privileges?&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Action_allowed_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Save Grade and Comment (:id/save_grade_and_comment_for_submission) - This API allows for the saving of grades and comments for a specific submission. It is designed to capture both quantitative and qualitative feedback, storing this information securely and making it accessible for review. This endpoint is particularly important for providing feedback that is integral to educational environments, fostering a constructive and informative feedback loop.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def save_grade_and_comment_for_submission&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @team = participant.team&lt;br /&gt;
    @team.grade_for_submission = params[:grade]&lt;br /&gt;
    @team.comment_for_submission = params[:comment]&lt;br /&gt;
    begin&lt;br /&gt;
      @team.save!&lt;br /&gt;
      render json: { success: &amp;quot;Grade \'#{params[:grade]}\' and comment \'#{params[:comment]}\' for submission successfully saved.&amp;quot; }&lt;br /&gt;
    rescue StandardError =&amp;gt; e&lt;br /&gt;
      render json: { error: e.message }, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Save_grade_and_comment.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
These routes collectively support the essential CRUD operations needed for managing grades within the Expertiza system. By carefully defining these routes, the project ensures that grade management is handled in a structured and efficient manner, thereby reducing redundancy and enhancing the overall system architecture. This reimplementation fosters better scalability and easier maintenance, adhering to improved software design principles and practices.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Spec file  ===&lt;br /&gt;
The specification file for the Grades API provides comprehensive testing scenarios for various endpoints within the Api::V1::GradesController. This document is crafted using RSpec, a popular testing framework for Ruby applications, and employs the Swagger tool to describe and document the API endpoints. The focus is on ensuring that the controller behaves as expected across different use cases, adhering to both functional and non-functional requirements. Here is a detailed explanation of the test cases outlined in the specification:&lt;br /&gt;
&lt;br /&gt;
====Testing Framework and Tools====&lt;br /&gt;
*RSpec is utilized for writing and executing the test cases, providing a DSL (Domain-Specific Language) that is readable and expressive.&lt;br /&gt;
*Swagger helps in documenting the API, which not only serves for testing but also acts as a live documentation for developers and users of the API.&lt;br /&gt;
====Endpoints and Test Scenarios====&lt;br /&gt;
*GET /api/v1/grades/{id}/view - This endpoint tests the functionality to view detailed grade information for a specific ID.The test ensures that upon receiving a valid ID, the system returns a 200 status code indicating a successful operation.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_team - Tests the ability to retrieve team details associated with a specific grade.A 200 status code response is expected when valid data is provided, confirming the correct retrieval of team information.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_scores - Focuses on viewing scores for a specific grade.The test confirms that the endpoint returns a 200 status when executed with a correct ID, displaying the scores accurately.&lt;br /&gt;
*PUT /api/v1/grades/{id}/update - Tests the grade update functionality. This endpoint expects a JSON body with grade details.Two scenarios are tested: successful grade update (200 status) and failure due to missing required attributes (422 status), ensuring robust error handling and data validation.&lt;br /&gt;
*GET /api/v1/grades/{id} - Simple retrieval of grade details. The test verifies that the endpoint fetches and returns the correct grade information, indicated by a 200 success status.&lt;br /&gt;
*GET /api/v1/grades/{id}/action_allowed - Checks if a certain action is permissible for a given grade ID. It tests for both allowed (200 status) and not allowed scenarios (403 status), important for validating access control mechanisms.&lt;br /&gt;
*POST /api/v1/grades/{id}/save_grade_and_comment_for_submission - This test ensures that grades and comments can be successfully saved for a submission. The parameters are passed via query strings, and the test checks for a successful save operation (200 status).&lt;br /&gt;
&lt;br /&gt;
====Importance of These Tests====&lt;br /&gt;
The specified tests are essential for maintaining the integrity and reliability of the Grades API. They ensure that:&lt;br /&gt;
&lt;br /&gt;
*The API responds correctly under various conditions.&lt;br /&gt;
*Data integrity is maintained with correct inputs and handling of incorrect or partial inputs.&lt;br /&gt;
*Security and access control measures are effective, particularly in verifying user permissions.&lt;br /&gt;
This meticulous testing setup reflects a commitment to quality and robustness in the software development lifecycle, crucial for applications like Expertiza that are used in educational settings. These tests contribute directly to the project's aim of enhancing maintainability, readability, and adherence to the DRY principle within the grades_controller.&lt;br /&gt;
&lt;br /&gt;
===Swagger File Implementation===&lt;br /&gt;
The Swagger file uses YAML format to describe the HTTP routes, parameters, and responses for the API. Each path is clearly defined with required parameters and expected responses, facilitating automatic documentation generation and client code generation.&lt;br /&gt;
&lt;br /&gt;
====GET /grades/{id}/view_team====&lt;br /&gt;
Summary: Retrieve team details associated with a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Indicates successful retrieval of the team details.&lt;br /&gt;
Parameter: id (integer, required) - the unique identifier for a grade.&lt;br /&gt;
====GET /grades/{id}/view====&lt;br /&gt;
Summary: Fetch comprehensive details about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, returning complete grade details.&lt;br /&gt;
====GET /grades/{id}/view_scores====&lt;br /&gt;
Summary: Obtain scoring details for a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful retrieval of score data.&lt;br /&gt;
====PUT /grades/{id}/update====&lt;br /&gt;
Summary: Update details of a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Confirmation of successful update.&lt;br /&gt;
====GET /grades/{id}====&lt;br /&gt;
Summary: Access detailed information about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, showing detailed grade data.&lt;br /&gt;
====GET /grades/{id}/action_allowed====&lt;br /&gt;
Summary: Check permissions for performing certain actions on a grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful verification of allowed actions.&lt;br /&gt;
====POST /grades/{id}/save_grade_and_comment_for_submission====&lt;br /&gt;
Summary: Save a grade along with a comment for a specific submission.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successfully saved the grade and comment.&lt;br /&gt;
&lt;br /&gt;
====Importance and Usage====&lt;br /&gt;
*Standardization and Documentation: Swagger files like this one help in standardizing API practices across development teams, providing a consistent and predictable interface. It ensures that all team members, including backend and frontend developers, understand the API’s functionality and constraints without diving into the codebase.&lt;br /&gt;
*Client SDK Generation: Tools such as Swagger Codegen can utilize this file to automatically generate client libraries in various programming languages, which can accelerate development and integration efforts.&lt;br /&gt;
*Interactive API Documentation: Swagger UI can render this file into interactive API documentation that allows developers to perform live API calls for testing purposes, greatly enhancing the developer experience and easing troubleshooting and testing.&lt;br /&gt;
The careful organization and detailed descriptions in the Swagger file are critical for maintaining the robustness and reliability of the API, aligning with best practices in API design and documentation. This approach supports the project's goal to improve maintainability and readability of the grades_controller, ensuring that the API is both accessible and functional.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Helper Files ===&lt;br /&gt;
&lt;br /&gt;
The recently implemented helper modules—AssignmentHelper, AuthorizationHelper, GradesHelper, PenaltyHelper, and StudentTaskHelper—serve as foundational components that augment the functionality of the Expertiza system. Each module encapsulates specific, reusable logic that interfaces with various aspects of the system, promoting a modular, maintainable, and DRY codebase. Here’s a comprehensive breakdown of each helper module:&lt;br /&gt;
&lt;br /&gt;
====AssignmentHelper====&lt;br /&gt;
This module provides utility functions tailored to manage and manipulate course and assignment data:&lt;br /&gt;
&lt;br /&gt;
*course_options: Generates a list of courses available to the user based on their role, such as teaching assistants seeing only their courses, while administrators can view all courses.&lt;br /&gt;
*questionnaire_options: Filters questionnaires based on visibility and association with the instructor, allowing users to select questionnaires relevant to their role.&lt;br /&gt;
*review_strategy_options and due_date: These functions assist in setting up review strategies for assignments and managing due dates respectively, essential for assignment creation and editing.&lt;br /&gt;
====AuthorizationHelper====&lt;br /&gt;
Focused on security, this module determines the access level of users within the system:&lt;br /&gt;
&lt;br /&gt;
*current_user_has_..._privileges? methods check the user’s role against required privileges, ensuring actions are permitted before proceeding.&lt;br /&gt;
*current_user_is_assignment_participant? and similar methods validate user participation in specific contexts, crucial for enforcing role-based actions within assignments.&lt;br /&gt;
====GradesHelper====&lt;br /&gt;
This module aids in the handling and display of grades and related functionalities:&lt;br /&gt;
&lt;br /&gt;
*accordion_title and score_vector: These functions manage the display of structured data, such as grouping related responses under a common header in the UI.&lt;br /&gt;
*vector and mean: Utilized for statistical calculations to derive insights from grade data, supporting detailed analytical features like average scores.&lt;br /&gt;
====PenaltyHelper====&lt;br /&gt;
Manages the calculation of penalties based on assignment deadlines and submission timelines:&lt;br /&gt;
&lt;br /&gt;
*calculate_penalty and its associated methods (calculate_submission_penalty, calculate_review_penalty, etc.) assess penalties for late submissions and incomplete reviews, ensuring students are graded fairly based on timeliness and compliance with deadlines.&lt;br /&gt;
====StudentTaskHelper====&lt;br /&gt;
Enhances the student interaction with tasks and reviews:&lt;br /&gt;
&lt;br /&gt;
*get_review_grade_info and get_awarded_badges: Provide visual feedback and recognition for students’ efforts, which are crucial for motivation and engagement.&lt;br /&gt;
*check_reviewable_topics and unsubmitted_self_review?: These functions check for reviewable topics and monitor the submission status of self-reviews, critical for maintaining the integrity and progression of peer reviews.&lt;br /&gt;
&lt;br /&gt;
====Integration and Impact====&lt;br /&gt;
The integration of these helper modules significantly enhances the system's robustness by segregating responsibilities into distinct, manageable components. This approach not only simplifies the main application logic but also enhances code readability and maintenance—core aims of the project. By refining the backend architecture through these helpers, the system can more easily adapt to new requirements and facilitate smoother updates and enhancements.&lt;br /&gt;
&lt;br /&gt;
Incorporating these modules into the Expertiza platform effectively addresses key project objectives, including adherence to DRY principles, improved maintainability, and ensuring a scalable architecture that can handle the evolving needs of educational environments. These improvements directly contribute to a more stable, efficient, and user-friendly grading system.&lt;br /&gt;
&lt;br /&gt;
===Implementation of Migration files===&lt;br /&gt;
These migration files represent changes to the database schema in a Ruby on Rails application using ActiveRecord. Let's go through each migration file and explain its purpose:&lt;br /&gt;
&lt;br /&gt;
*CreateDeadlineTypes: This migration creates a table called deadline_types with a name column. It also inserts some initial data into this table.&lt;br /&gt;
*CreateLatePolicies: This migration creates a table called late_policies with columns for penalty period, penalty per unit, whether the penalty is expressed as a percentage, and maximum penalty. It also inserts initial data into this table and adds an index on the penalty_period_in_minutes column.&lt;br /&gt;
*CreateDueDates: This migration creates a table called due_dates with columns for due date, deadline type ID, assignment ID, late policy ID, and flags for submission, review, resubmission, rereview, and review of review permissions. It adds foreign key constraints to reference other tables and indexes on various columns.&lt;br /&gt;
*ChangeAssignmentIdInDueDatesTableToParentId: This migration renames the assignment_id column in the due_dates table to parent_id and removes the foreign key constraint on it. This seems to be part of a restructuring where assignment_id is renamed to parent_id in several tables.&lt;br /&gt;
*CreateTeams: This migration creates a table called teams with a name column and an assignment_id column, which references the assignments table. It adds a foreign key constraint on the assignment_id column.&lt;br /&gt;
*ChangeAssignmentIdInParticipantsTableToParentId: This migration renames the assignment_id column in the participants table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*ChangeAssignmentIdInTeamsTableToParentId: This migration renames the assignment_id column in the teams table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*AddUsedInRoundToAssignmentQuestionnaires: This migration adds a column called used_in_round to the assignment_questionnaires table.&lt;br /&gt;
*UpdateParticipants: This migration adds columns for grade, comments_to_student, and private_instructor_comments to the participants table.&lt;br /&gt;
*CreateTeamsUsers: This migration creates a join table called teams_users to establish a many-to-many relationship between teams and users. It adds foreign key constraints for both team_id and user_id.&lt;br /&gt;
&lt;br /&gt;
=== Use of Design and Dry Principles===&lt;br /&gt;
In the provided GradesController code, several design principles and DRY (Don't Repeat Yourself) principles have been applied to ensure a clean and maintainable codebase. Let's break down the implementation and discuss how these principles are reflected:&lt;br /&gt;
&lt;br /&gt;
====Modularization and Inclusion of Concerns====&lt;br /&gt;
The controller includes several modules like Scoring, PenaltyHelper, StudentTaskHelper, AssignmentHelper, GradesHelper, and AuthorizationHelper. This modularization helps in organizing related functionalities into separate files, promoting better code organization and reusability.&lt;br /&gt;
Each module encapsulates related methods and concerns, promoting separation of concerns and making the codebase more modular.&lt;br /&gt;
====Single Responsibility Principle (SRP)====&lt;br /&gt;
Methods within the controller have clear and specific responsibilities. For example, view, view_scores, view_team, edit, show, update, and save_grade_and_comment_for_submission methods handle specific actions related to grading, viewing, and updating grades.&lt;br /&gt;
This adherence to SRP makes the code easier to understand, test, and maintain as each method focuses on a single task.&lt;br /&gt;
====Conditional Handling with Case Statements====&lt;br /&gt;
The action_allowed method utilizes a case statement to handle different actions based on the parameters received. This approach makes the code more readable and maintainable compared to using multiple nested if-else statements.&lt;br /&gt;
Each case in the statement handles a specific action, improving code organization and readability.&lt;br /&gt;
====Code Reuse and DRY Principle====&lt;br /&gt;
Common functionalities are abstracted into helper modules (GradesHelper, PenaltyHelper, etc.) and included where needed. For example, methods like participant_scores, calculate_penalty, retrieve_questions, etc., are reused across different controller actions.&lt;br /&gt;
By extracting shared functionalities into helper modules, the code adheres to the DRY principle, reducing redundancy and promoting code reuse.&lt;br /&gt;
====Comments and Documentation====&lt;br /&gt;
The code includes comments explaining the purpose of methods, API endpoints, and complex logic. Comments are used judiciously to provide clarity where necessary.&lt;br /&gt;
While comments are helpful, they should ideally focus on explaining why certain decisions were made or complex logic was implemented rather than simply restating what the code does.&lt;br /&gt;
====Private Methods for Encapsulation====&lt;br /&gt;
Private methods like set_assignment, list_questions, and self_review_finished? encapsulate internal implementation details and are not accessible outside the controller. This encapsulation hides complexity and promotes cleaner interfaces.&lt;br /&gt;
====Error Handling====&lt;br /&gt;
Error handling is implemented using rescue_from for ActiveRecord::RecordNotFound and StandardError. This ensures graceful handling of exceptions and provides meaningful error responses to clients.&lt;br /&gt;
Overall, the GradesController demonstrates good adherence to design principles like SRP, modularity, DRY, encapsulation, and error handling. The code is well-structured, readable, and follows best practices for building maintainable Rails applications.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
Pull Request : https://github.com/expertiza/reimplementation-back-end/pull/97&lt;br /&gt;
&lt;br /&gt;
Demonstration : https://drive.google.com/drive/folders/1bfh348t-zbcLZ-VlpTCAGRtoSgVimTnU?usp=sharing&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156836</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156836"/>
		<updated>2024-04-24T04:10:30Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Reimplementation of GradesController */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4_uml.png|800px|UML Diagram]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
==Reimplementation of GradesController ==&lt;br /&gt;
&lt;br /&gt;
=== Implementation of APIs ===&lt;br /&gt;
&lt;br /&gt;
In the context of the project &amp;quot;E2443. Reimplement grades_controller&amp;quot; for the Expertiza platform, the modifications made to the routes.rb file for the GradesController are intended to streamline and enhance the existing functionality related to grading. These routing configurations play a critical role in structuring how grade-related requests are processed and responded to within the application.&lt;br /&gt;
&lt;br /&gt;
The specific routes added under the grades resource leverage a nested structure to facilitate clear and organized handling of various grade-related actions, ensuring that each action pertains directly to individual grade entities identified by :id, being the participant ID. &lt;br /&gt;
&lt;br /&gt;
====Breakdown of Routes====&lt;br /&gt;
&lt;br /&gt;
*View Team (:id/view_team) - This endpoint retrieves detailed information about the team associated with a specific assignment participant. It is crucial for scenarios where assessments or grades are team-based. The API fetches the participant's team and provides comprehensive details, including the team members and their contributions to assignments. This functionality supports collaborative assessments and enhances transparency in team-based grading.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def view_team&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questions = retrieve_questions(questionnaires, assignment.id)&lt;br /&gt;
    pscore = participant_scores(participant, questions)&lt;br /&gt;
    render json: { participant:, assignment:, team:, questions:, pscore:}&lt;br /&gt;
end  &lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_team_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
*View Grade Details (:id/view) - This endpoint allows for viewing all relevant details of an assignment for a particular participant. It aggregates data such as related questionnaires, questions, and scores, providing a holistic view of the grading criteria and results. This function is particularly valuable for providing a comprehensive breakdown of scores across different review rounds, assisting in a deeper understanding of how grades were allocated.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    assignment = Assignment.find(params[:id])&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    if assignment.num_review_rounds &amp;gt; 1&lt;br /&gt;
      questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    else&lt;br /&gt;
      questions = {}&lt;br /&gt;
      questionnaires.each do |questionnaire|&lt;br /&gt;
        questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    scores = review_grades(assignment, questions)&lt;br /&gt;
    num_reviewers_assigned_scores = scores[:teams].length&lt;br /&gt;
    averages = vector(scores)&lt;br /&gt;
    avg_of_avg = mean(averages)&lt;br /&gt;
    render json: { scores:, averages:, avg_of_avg:, num_reviewers_assigned_scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*View Scores (:id/view_scores) - This API endpoint is designed to show scores for a specific assignment participant. It provides detailed insights into how participants are performing in the ongoing assignments and the various stages of assignment completion. This is essential for tracking academic progress and identifying areas where students may need additional support or recognition.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view_scores&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    # questionnaires = assignment.questionnaires&lt;br /&gt;
    # questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    # pscore = participant_scores(participant, questions)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.assignment.id, participant.user_id)&lt;br /&gt;
    stage = assignment.current_stage(topic_id)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_scores.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Update Grade (:id/update) - This endpoint enables updating the grade for a participant. It accepts a new grade value and updates the participant’s record if the new grade differs from the existing one. This API is crucial for situations where grades need to be revised or corrected, ensuring that grading remains dynamic and reflective of actual student performance and any subsequent reviews or reassessments.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def update&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    total_score = params[:total_score]&lt;br /&gt;
    unless format('%.2f', total_score) == params[:participant][:grade]&lt;br /&gt;
      participant.update_attribute(:grade, params[:participant][:grade])&lt;br /&gt;
      message = if participant.grade.nil?&lt;br /&gt;
                  &amp;quot;The computed score will be used for #{participant.user.name}.&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  &amp;quot;A score of #{params[:participant][:grade]}% has been saved for #{participant.user.name}.&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
    end&lt;br /&gt;
    render json: { message: message}&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Update_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Show Grade (:id) - This endpoint provides a detailed view of a participant's assignment by fetching and displaying all relevant information such as the assignment details, participant info, related questions, and scores. This function is a vital read operation that allows instructors and students to access complete information on a participant's performance in a specific assignment.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def show&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    questions = list_questions(assignment)&lt;br /&gt;
    scores = participant_scores(participant, questions)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant:, assignment:, questions:, scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Show_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Action Allowed (:id/action_allowed) - This endpoint checks if a particular action is allowed for the current user, based on the user’s role and the specific action they intend to perform (like viewing scores). It ensures that operations are conducted within established permissions, enhancing security and role-based access control within the application. This is critical for maintaining the integrity of the grading process and ensuring that only authorized actions are executed.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def action_allowed&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'view_scores'&lt;br /&gt;
      if current_user_has_student_privileges? &amp;amp;&amp;amp;&lt;br /&gt;
        are_needed_authorizations_present?(params[:id], 'reader', 'reviewer') &amp;amp;&amp;amp;&lt;br /&gt;
        self_review_finished?&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
      end&lt;br /&gt;
    when 'view_team'&lt;br /&gt;
      if current_user_is_a? 'Student'&lt;br /&gt;
        participant = AssignmentParticipant.find_by(id: params[:id])&lt;br /&gt;
        if participant &amp;amp;&amp;amp; current_user_is_assignment_participant?(participant.assignment.id)&lt;br /&gt;
          render json: { allowed: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      if current_user_has_ta_privileges?&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Action_allowed_grade.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Save Grade and Comment (:id/save_grade_and_comment_for_submission) - This API allows for the saving of grades and comments for a specific submission. It is designed to capture both quantitative and qualitative feedback, storing this information securely and making it accessible for review. This endpoint is particularly important for providing feedback that is integral to educational environments, fostering a constructive and informative feedback loop.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def save_grade_and_comment_for_submission&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @team = participant.team&lt;br /&gt;
    @team.grade_for_submission = params[:grade]&lt;br /&gt;
    @team.comment_for_submission = params[:comment]&lt;br /&gt;
    begin&lt;br /&gt;
      @team.save!&lt;br /&gt;
      render json: { success: &amp;quot;Grade \'#{params[:grade]}\' and comment \'#{params[:comment]}\' for submission successfully saved.&amp;quot; }&lt;br /&gt;
    rescue StandardError =&amp;gt; e&lt;br /&gt;
      render json: { error: e.message }, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Save_grade_and_comment.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
These routes collectively support the essential CRUD operations needed for managing grades within the Expertiza system. By carefully defining these routes, the project ensures that grade management is handled in a structured and efficient manner, thereby reducing redundancy and enhancing the overall system architecture. This reimplementation fosters better scalability and easier maintenance, adhering to improved software design principles and practices.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Spec file  ===&lt;br /&gt;
The specification file for the Grades API provides comprehensive testing scenarios for various endpoints within the Api::V1::GradesController. This document is crafted using RSpec, a popular testing framework for Ruby applications, and employs the Swagger tool to describe and document the API endpoints. The focus is on ensuring that the controller behaves as expected across different use cases, adhering to both functional and non-functional requirements. Here is a detailed explanation of the test cases outlined in the specification:&lt;br /&gt;
&lt;br /&gt;
====Testing Framework and Tools====&lt;br /&gt;
*RSpec is utilized for writing and executing the test cases, providing a DSL (Domain-Specific Language) that is readable and expressive.&lt;br /&gt;
*Swagger helps in documenting the API, which not only serves for testing but also acts as a live documentation for developers and users of the API.&lt;br /&gt;
====Endpoints and Test Scenarios====&lt;br /&gt;
*GET /api/v1/grades/{id}/view - This endpoint tests the functionality to view detailed grade information for a specific ID.The test ensures that upon receiving a valid ID, the system returns a 200 status code indicating a successful operation.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_team - Tests the ability to retrieve team details associated with a specific grade.A 200 status code response is expected when valid data is provided, confirming the correct retrieval of team information.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_scores - Focuses on viewing scores for a specific grade.The test confirms that the endpoint returns a 200 status when executed with a correct ID, displaying the scores accurately.&lt;br /&gt;
*PUT /api/v1/grades/{id}/update - Tests the grade update functionality. This endpoint expects a JSON body with grade details.Two scenarios are tested: successful grade update (200 status) and failure due to missing required attributes (422 status), ensuring robust error handling and data validation.&lt;br /&gt;
*GET /api/v1/grades/{id} - Simple retrieval of grade details. The test verifies that the endpoint fetches and returns the correct grade information, indicated by a 200 success status.&lt;br /&gt;
*GET /api/v1/grades/{id}/action_allowed - Checks if a certain action is permissible for a given grade ID. It tests for both allowed (200 status) and not allowed scenarios (403 status), important for validating access control mechanisms.&lt;br /&gt;
*PUT /api/v1/grades/{id}/save_grade_and_comment_for_submission - This test ensures that grades and comments can be successfully saved for a submission. The parameters are passed via query strings, and the test checks for a successful save operation (200 status).&lt;br /&gt;
&lt;br /&gt;
====Importance of These Tests====&lt;br /&gt;
The specified tests are essential for maintaining the integrity and reliability of the Grades API. They ensure that:&lt;br /&gt;
&lt;br /&gt;
*The API responds correctly under various conditions.&lt;br /&gt;
*Data integrity is maintained with correct inputs and handling of incorrect or partial inputs.&lt;br /&gt;
*Security and access control measures are effective, particularly in verifying user permissions.&lt;br /&gt;
This meticulous testing setup reflects a commitment to quality and robustness in the software development lifecycle, crucial for applications like Expertiza that are used in educational settings. These tests contribute directly to the project's aim of enhancing maintainability, readability, and adherence to the DRY principle within the grades_controller.&lt;br /&gt;
&lt;br /&gt;
===Swagger File Implementation===&lt;br /&gt;
The Swagger file uses YAML format to describe the HTTP routes, parameters, and responses for the API. Each path is clearly defined with required parameters and expected responses, facilitating automatic documentation generation and client code generation.&lt;br /&gt;
&lt;br /&gt;
====GET /grades/{id}/view_team====&lt;br /&gt;
Summary: Retrieve team details associated with a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Indicates successful retrieval of the team details.&lt;br /&gt;
Parameter: id (integer, required) - the unique identifier for a grade.&lt;br /&gt;
====GET /grades/{id}/view====&lt;br /&gt;
Summary: Fetch comprehensive details about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, returning complete grade details.&lt;br /&gt;
====GET /grades/{id}/view_scores====&lt;br /&gt;
Summary: Obtain scoring details for a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful retrieval of score data.&lt;br /&gt;
====PUT /grades/{id}/update====&lt;br /&gt;
Summary: Update details of a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Confirmation of successful update.&lt;br /&gt;
====GET /grades/{id}====&lt;br /&gt;
Summary: Access detailed information about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, showing detailed grade data.&lt;br /&gt;
====GET /grades/{id}/action_allowed====&lt;br /&gt;
Summary: Check permissions for performing certain actions on a grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful verification of allowed actions.&lt;br /&gt;
====POST /grades/{id}/save_grade_and_comment_for_submission====&lt;br /&gt;
Summary: Save a grade along with a comment for a specific submission.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successfully saved the grade and comment.&lt;br /&gt;
&lt;br /&gt;
====Importance and Usage====&lt;br /&gt;
*Standardization and Documentation: Swagger files like this one help in standardizing API practices across development teams, providing a consistent and predictable interface. It ensures that all team members, including backend and frontend developers, understand the API’s functionality and constraints without diving into the codebase.&lt;br /&gt;
*Client SDK Generation: Tools such as Swagger Codegen can utilize this file to automatically generate client libraries in various programming languages, which can accelerate development and integration efforts.&lt;br /&gt;
*Interactive API Documentation: Swagger UI can render this file into interactive API documentation that allows developers to perform live API calls for testing purposes, greatly enhancing the developer experience and easing troubleshooting and testing.&lt;br /&gt;
The careful organization and detailed descriptions in the Swagger file are critical for maintaining the robustness and reliability of the API, aligning with best practices in API design and documentation. This approach supports the project's goal to improve maintainability and readability of the grades_controller, ensuring that the API is both accessible and functional.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Helper Files ===&lt;br /&gt;
&lt;br /&gt;
The recently implemented helper modules—AssignmentHelper, AuthorizationHelper, GradesHelper, PenaltyHelper, and StudentTaskHelper—serve as foundational components that augment the functionality of the Expertiza system. Each module encapsulates specific, reusable logic that interfaces with various aspects of the system, promoting a modular, maintainable, and DRY codebase. Here’s a comprehensive breakdown of each helper module:&lt;br /&gt;
&lt;br /&gt;
====AssignmentHelper====&lt;br /&gt;
This module provides utility functions tailored to manage and manipulate course and assignment data:&lt;br /&gt;
&lt;br /&gt;
*course_options: Generates a list of courses available to the user based on their role, such as teaching assistants seeing only their courses, while administrators can view all courses.&lt;br /&gt;
*questionnaire_options: Filters questionnaires based on visibility and association with the instructor, allowing users to select questionnaires relevant to their role.&lt;br /&gt;
*review_strategy_options and due_date: These functions assist in setting up review strategies for assignments and managing due dates respectively, essential for assignment creation and editing.&lt;br /&gt;
====AuthorizationHelper====&lt;br /&gt;
Focused on security, this module determines the access level of users within the system:&lt;br /&gt;
&lt;br /&gt;
*current_user_has_..._privileges? methods check the user’s role against required privileges, ensuring actions are permitted before proceeding.&lt;br /&gt;
*current_user_is_assignment_participant? and similar methods validate user participation in specific contexts, crucial for enforcing role-based actions within assignments.&lt;br /&gt;
====GradesHelper====&lt;br /&gt;
This module aids in the handling and display of grades and related functionalities:&lt;br /&gt;
&lt;br /&gt;
*accordion_title and score_vector: These functions manage the display of structured data, such as grouping related responses under a common header in the UI.&lt;br /&gt;
*vector and mean: Utilized for statistical calculations to derive insights from grade data, supporting detailed analytical features like average scores.&lt;br /&gt;
====PenaltyHelper====&lt;br /&gt;
Manages the calculation of penalties based on assignment deadlines and submission timelines:&lt;br /&gt;
&lt;br /&gt;
*calculate_penalty and its associated methods (calculate_submission_penalty, calculate_review_penalty, etc.) assess penalties for late submissions and incomplete reviews, ensuring students are graded fairly based on timeliness and compliance with deadlines.&lt;br /&gt;
====StudentTaskHelper====&lt;br /&gt;
Enhances the student interaction with tasks and reviews:&lt;br /&gt;
&lt;br /&gt;
*get_review_grade_info and get_awarded_badges: Provide visual feedback and recognition for students’ efforts, which are crucial for motivation and engagement.&lt;br /&gt;
*check_reviewable_topics and unsubmitted_self_review?: These functions check for reviewable topics and monitor the submission status of self-reviews, critical for maintaining the integrity and progression of peer reviews.&lt;br /&gt;
&lt;br /&gt;
====Integration and Impact====&lt;br /&gt;
The integration of these helper modules significantly enhances the system's robustness by segregating responsibilities into distinct, manageable components. This approach not only simplifies the main application logic but also enhances code readability and maintenance—core aims of the project. By refining the backend architecture through these helpers, the system can more easily adapt to new requirements and facilitate smoother updates and enhancements.&lt;br /&gt;
&lt;br /&gt;
Incorporating these modules into the Expertiza platform effectively addresses key project objectives, including adherence to DRY principles, improved maintainability, and ensuring a scalable architecture that can handle the evolving needs of educational environments. These improvements directly contribute to a more stable, efficient, and user-friendly grading system.&lt;br /&gt;
&lt;br /&gt;
===Implementation of Migration files===&lt;br /&gt;
These migration files represent changes to the database schema in a Ruby on Rails application using ActiveRecord. Let's go through each migration file and explain its purpose:&lt;br /&gt;
&lt;br /&gt;
*CreateDeadlineTypes: This migration creates a table called deadline_types with a name column. It also inserts some initial data into this table.&lt;br /&gt;
*CreateLatePolicies: This migration creates a table called late_policies with columns for penalty period, penalty per unit, whether the penalty is expressed as a percentage, and maximum penalty. It also inserts initial data into this table and adds an index on the penalty_period_in_minutes column.&lt;br /&gt;
*CreateDueDates: This migration creates a table called due_dates with columns for due date, deadline type ID, assignment ID, late policy ID, and flags for submission, review, resubmission, rereview, and review of review permissions. It adds foreign key constraints to reference other tables and indexes on various columns.&lt;br /&gt;
*ChangeAssignmentIdInDueDatesTableToParentId: This migration renames the assignment_id column in the due_dates table to parent_id and removes the foreign key constraint on it. This seems to be part of a restructuring where assignment_id is renamed to parent_id in several tables.&lt;br /&gt;
*CreateTeams: This migration creates a table called teams with a name column and an assignment_id column, which references the assignments table. It adds a foreign key constraint on the assignment_id column.&lt;br /&gt;
*ChangeAssignmentIdInParticipantsTableToParentId: This migration renames the assignment_id column in the participants table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*ChangeAssignmentIdInTeamsTableToParentId: This migration renames the assignment_id column in the teams table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*AddUsedInRoundToAssignmentQuestionnaires: This migration adds a column called used_in_round to the assignment_questionnaires table.&lt;br /&gt;
*UpdateParticipants: This migration adds columns for grade, comments_to_student, and private_instructor_comments to the participants table.&lt;br /&gt;
*CreateTeamsUsers: This migration creates a join table called teams_users to establish a many-to-many relationship between teams and users. It adds foreign key constraints for both team_id and user_id.&lt;br /&gt;
&lt;br /&gt;
=== Use of Design and Dry Principles===&lt;br /&gt;
In the provided GradesController code, several design principles and DRY (Don't Repeat Yourself) principles have been applied to ensure a clean and maintainable codebase. Let's break down the implementation and discuss how these principles are reflected:&lt;br /&gt;
&lt;br /&gt;
====Modularization and Inclusion of Concerns====&lt;br /&gt;
The controller includes several modules like Scoring, PenaltyHelper, StudentTaskHelper, AssignmentHelper, GradesHelper, and AuthorizationHelper. This modularization helps in organizing related functionalities into separate files, promoting better code organization and reusability.&lt;br /&gt;
Each module encapsulates related methods and concerns, promoting separation of concerns and making the codebase more modular.&lt;br /&gt;
====Single Responsibility Principle (SRP)====&lt;br /&gt;
Methods within the controller have clear and specific responsibilities. For example, view, view_scores, view_team, edit, show, update, and save_grade_and_comment_for_submission methods handle specific actions related to grading, viewing, and updating grades.&lt;br /&gt;
This adherence to SRP makes the code easier to understand, test, and maintain as each method focuses on a single task.&lt;br /&gt;
====Conditional Handling with Case Statements====&lt;br /&gt;
The action_allowed method utilizes a case statement to handle different actions based on the parameters received. This approach makes the code more readable and maintainable compared to using multiple nested if-else statements.&lt;br /&gt;
Each case in the statement handles a specific action, improving code organization and readability.&lt;br /&gt;
====Code Reuse and DRY Principle====&lt;br /&gt;
Common functionalities are abstracted into helper modules (GradesHelper, PenaltyHelper, etc.) and included where needed. For example, methods like participant_scores, calculate_penalty, retrieve_questions, etc., are reused across different controller actions.&lt;br /&gt;
By extracting shared functionalities into helper modules, the code adheres to the DRY principle, reducing redundancy and promoting code reuse.&lt;br /&gt;
====Comments and Documentation====&lt;br /&gt;
The code includes comments explaining the purpose of methods, API endpoints, and complex logic. Comments are used judiciously to provide clarity where necessary.&lt;br /&gt;
While comments are helpful, they should ideally focus on explaining why certain decisions were made or complex logic was implemented rather than simply restating what the code does.&lt;br /&gt;
====Private Methods for Encapsulation====&lt;br /&gt;
Private methods like set_assignment, list_questions, and self_review_finished? encapsulate internal implementation details and are not accessible outside the controller. This encapsulation hides complexity and promotes cleaner interfaces.&lt;br /&gt;
====Error Handling====&lt;br /&gt;
Error handling is implemented using rescue_from for ActiveRecord::RecordNotFound and StandardError. This ensures graceful handling of exceptions and provides meaningful error responses to clients.&lt;br /&gt;
Overall, the GradesController demonstrates good adherence to design principles like SRP, modularity, DRY, encapsulation, and error handling. The code is well-structured, readable, and follows best practices for building maintainable Rails applications.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
Pull Request : https://github.com/expertiza/reimplementation-back-end/pull/97&lt;br /&gt;
&lt;br /&gt;
Demonstration : https://drive.google.com/drive/folders/1bfh348t-zbcLZ-VlpTCAGRtoSgVimTnU?usp=sharing&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156833</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156833"/>
		<updated>2024-04-24T04:08:23Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added postman working images&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4_uml.png|800px|UML Diagram]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
==Reimplementation of GradesController ==&lt;br /&gt;
&lt;br /&gt;
=== Implementation of APIs ===&lt;br /&gt;
&lt;br /&gt;
In the context of the project &amp;quot;E2443. Reimplement grades_controller&amp;quot; for the Expertiza platform, the modifications made to the routes.rb file for the GradesController are intended to streamline and enhance the existing functionality related to grading. These routing configurations play a critical role in structuring how grade-related requests are processed and responded to within the application.&lt;br /&gt;
&lt;br /&gt;
The specific routes added under the grades resource leverage a nested structure to facilitate clear and organized handling of various grade-related actions, ensuring that each action pertains directly to individual grade entities identified by :id, being the participant ID. &lt;br /&gt;
&lt;br /&gt;
====Breakdown of Routes====&lt;br /&gt;
&lt;br /&gt;
*View Team (:id/view_team) - This endpoint retrieves detailed information about the team associated with a specific assignment participant. It is crucial for scenarios where assessments or grades are team-based. The API fetches the participant's team and provides comprehensive details, including the team members and their contributions to assignments. This functionality supports collaborative assessments and enhances transparency in team-based grading.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def view_team&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questions = retrieve_questions(questionnaires, assignment.id)&lt;br /&gt;
    pscore = participant_scores(participant, questions)&lt;br /&gt;
    render json: { participant:, assignment:, team:, questions:, pscore:}&lt;br /&gt;
end  &lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_team_grade.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
*View Grade Details (:id/view) - This endpoint allows for viewing all relevant details of an assignment for a particular participant. It aggregates data such as related questionnaires, questions, and scores, providing a holistic view of the grading criteria and results. This function is particularly valuable for providing a comprehensive breakdown of scores across different review rounds, assisting in a deeper understanding of how grades were allocated.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    assignment = Assignment.find(params[:id])&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    if assignment.num_review_rounds &amp;gt; 1&lt;br /&gt;
      questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    else&lt;br /&gt;
      questions = {}&lt;br /&gt;
      questionnaires.each do |questionnaire|&lt;br /&gt;
        questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    scores = review_grades(assignment, questions)&lt;br /&gt;
    num_reviewers_assigned_scores = scores[:teams].length&lt;br /&gt;
    averages = vector(scores)&lt;br /&gt;
    avg_of_avg = mean(averages)&lt;br /&gt;
    render json: { scores:, averages:, avg_of_avg:, num_reviewers_assigned_scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_grade.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
*View Scores (:id/view_scores) - This API endpoint is designed to show scores for a specific assignment participant. It provides detailed insights into how participants are performing in the ongoing assignments and the various stages of assignment completion. This is essential for tracking academic progress and identifying areas where students may need additional support or recognition.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view_scores&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    # questionnaires = assignment.questionnaires&lt;br /&gt;
    # questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    # pscore = participant_scores(participant, questions)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.assignment.id, participant.user_id)&lt;br /&gt;
    stage = assignment.current_stage(topic_id)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:View_scores.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Update Grade (:id/update) - This endpoint enables updating the grade for a participant. It accepts a new grade value and updates the participant’s record if the new grade differs from the existing one. This API is crucial for situations where grades need to be revised or corrected, ensuring that grading remains dynamic and reflective of actual student performance and any subsequent reviews or reassessments.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def update&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    total_score = params[:total_score]&lt;br /&gt;
    unless format('%.2f', total_score) == params[:participant][:grade]&lt;br /&gt;
      participant.update_attribute(:grade, params[:participant][:grade])&lt;br /&gt;
      message = if participant.grade.nil?&lt;br /&gt;
                  &amp;quot;The computed score will be used for #{participant.user.name}.&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  &amp;quot;A score of #{params[:participant][:grade]}% has been saved for #{participant.user.name}.&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
    end&lt;br /&gt;
    render json: { message: message}&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Update_grade.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Show Grade (:id) - This endpoint provides a detailed view of a participant's assignment by fetching and displaying all relevant information such as the assignment details, participant info, related questions, and scores. This function is a vital read operation that allows instructors and students to access complete information on a participant's performance in a specific assignment.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def show&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    questions = list_questions(assignment)&lt;br /&gt;
    scores = participant_scores(participant, questions)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant:, assignment:, questions:, scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Show_grade.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Action Allowed (:id/action_allowed) - This endpoint checks if a particular action is allowed for the current user, based on the user’s role and the specific action they intend to perform (like viewing scores). It ensures that operations are conducted within established permissions, enhancing security and role-based access control within the application. This is critical for maintaining the integrity of the grading process and ensuring that only authorized actions are executed.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def action_allowed&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'view_scores'&lt;br /&gt;
      if current_user_has_student_privileges? &amp;amp;&amp;amp;&lt;br /&gt;
        are_needed_authorizations_present?(params[:id], 'reader', 'reviewer') &amp;amp;&amp;amp;&lt;br /&gt;
        self_review_finished?&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
      end&lt;br /&gt;
    when 'view_team'&lt;br /&gt;
      if current_user_is_a? 'Student'&lt;br /&gt;
        participant = AssignmentParticipant.find_by(id: params[:id])&lt;br /&gt;
        if participant &amp;amp;&amp;amp; current_user_is_assignment_participant?(participant.assignment.id)&lt;br /&gt;
          render json: { allowed: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      if current_user_has_ta_privileges?&lt;br /&gt;
        render json: { allowed: true }&lt;br /&gt;
      else&lt;br /&gt;
        render json: { allowed: false, error: 'Unauthorized' }, status: :forbidden&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Action_allowed_grade.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
*Save Grade and Comment (:id/save_grade_and_comment_for_submission) - This API allows for the saving of grades and comments for a specific submission. It is designed to capture both quantitative and qualitative feedback, storing this information securely and making it accessible for review. This endpoint is particularly important for providing feedback that is integral to educational environments, fostering a constructive and informative feedback loop.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def save_grade_and_comment_for_submission&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @team = participant.team&lt;br /&gt;
    @team.grade_for_submission = params[:grade]&lt;br /&gt;
    @team.comment_for_submission = params[:comment]&lt;br /&gt;
    begin&lt;br /&gt;
      @team.save!&lt;br /&gt;
      render json: { success: &amp;quot;Grade \'#{params[:grade]}\' and comment \'#{params[:comment]}\' for submission successfully saved.&amp;quot; }&lt;br /&gt;
    rescue StandardError =&amp;gt; e&lt;br /&gt;
      render json: { error: e.message }, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Working in Postman:&lt;br /&gt;
&lt;br /&gt;
[[File:Save_grade_and_comment.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
These routes collectively support the essential CRUD operations needed for managing grades within the Expertiza system. By carefully defining these routes, the project ensures that grade management is handled in a structured and efficient manner, thereby reducing redundancy and enhancing the overall system architecture. This reimplementation fosters better scalability and easier maintenance, adhering to improved software design principles and practices.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Spec file  ===&lt;br /&gt;
The specification file for the Grades API provides comprehensive testing scenarios for various endpoints within the Api::V1::GradesController. This document is crafted using RSpec, a popular testing framework for Ruby applications, and employs the Swagger tool to describe and document the API endpoints. The focus is on ensuring that the controller behaves as expected across different use cases, adhering to both functional and non-functional requirements. Here is a detailed explanation of the test cases outlined in the specification:&lt;br /&gt;
&lt;br /&gt;
====Testing Framework and Tools====&lt;br /&gt;
*RSpec is utilized for writing and executing the test cases, providing a DSL (Domain-Specific Language) that is readable and expressive.&lt;br /&gt;
*Swagger helps in documenting the API, which not only serves for testing but also acts as a live documentation for developers and users of the API.&lt;br /&gt;
====Endpoints and Test Scenarios====&lt;br /&gt;
*GET /api/v1/grades/{id}/view - This endpoint tests the functionality to view detailed grade information for a specific ID.The test ensures that upon receiving a valid ID, the system returns a 200 status code indicating a successful operation.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_team - Tests the ability to retrieve team details associated with a specific grade.A 200 status code response is expected when valid data is provided, confirming the correct retrieval of team information.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_scores - Focuses on viewing scores for a specific grade.The test confirms that the endpoint returns a 200 status when executed with a correct ID, displaying the scores accurately.&lt;br /&gt;
*PUT /api/v1/grades/{id}/update - Tests the grade update functionality. This endpoint expects a JSON body with grade details.Two scenarios are tested: successful grade update (200 status) and failure due to missing required attributes (422 status), ensuring robust error handling and data validation.&lt;br /&gt;
*GET /api/v1/grades/{id} - Simple retrieval of grade details. The test verifies that the endpoint fetches and returns the correct grade information, indicated by a 200 success status.&lt;br /&gt;
*GET /api/v1/grades/{id}/action_allowed - Checks if a certain action is permissible for a given grade ID. It tests for both allowed (200 status) and not allowed scenarios (403 status), important for validating access control mechanisms.&lt;br /&gt;
*PUT /api/v1/grades/{id}/save_grade_and_comment_for_submission - This test ensures that grades and comments can be successfully saved for a submission. The parameters are passed via query strings, and the test checks for a successful save operation (200 status).&lt;br /&gt;
&lt;br /&gt;
====Importance of These Tests====&lt;br /&gt;
The specified tests are essential for maintaining the integrity and reliability of the Grades API. They ensure that:&lt;br /&gt;
&lt;br /&gt;
*The API responds correctly under various conditions.&lt;br /&gt;
*Data integrity is maintained with correct inputs and handling of incorrect or partial inputs.&lt;br /&gt;
*Security and access control measures are effective, particularly in verifying user permissions.&lt;br /&gt;
This meticulous testing setup reflects a commitment to quality and robustness in the software development lifecycle, crucial for applications like Expertiza that are used in educational settings. These tests contribute directly to the project's aim of enhancing maintainability, readability, and adherence to the DRY principle within the grades_controller.&lt;br /&gt;
&lt;br /&gt;
===Swagger File Implementation===&lt;br /&gt;
The Swagger file uses YAML format to describe the HTTP routes, parameters, and responses for the API. Each path is clearly defined with required parameters and expected responses, facilitating automatic documentation generation and client code generation.&lt;br /&gt;
&lt;br /&gt;
====GET /grades/{id}/view_team====&lt;br /&gt;
Summary: Retrieve team details associated with a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Indicates successful retrieval of the team details.&lt;br /&gt;
Parameter: id (integer, required) - the unique identifier for a grade.&lt;br /&gt;
====GET /grades/{id}/view====&lt;br /&gt;
Summary: Fetch comprehensive details about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, returning complete grade details.&lt;br /&gt;
====GET /grades/{id}/view_scores====&lt;br /&gt;
Summary: Obtain scoring details for a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful retrieval of score data.&lt;br /&gt;
====PUT /grades/{id}/update====&lt;br /&gt;
Summary: Update details of a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Confirmation of successful update.&lt;br /&gt;
====GET /grades/{id}====&lt;br /&gt;
Summary: Access detailed information about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, showing detailed grade data.&lt;br /&gt;
====GET /grades/{id}/action_allowed====&lt;br /&gt;
Summary: Check permissions for performing certain actions on a grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful verification of allowed actions.&lt;br /&gt;
====POST /grades/{id}/save_grade_and_comment_for_submission====&lt;br /&gt;
Summary: Save a grade along with a comment for a specific submission.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successfully saved the grade and comment.&lt;br /&gt;
&lt;br /&gt;
====Importance and Usage====&lt;br /&gt;
*Standardization and Documentation: Swagger files like this one help in standardizing API practices across development teams, providing a consistent and predictable interface. It ensures that all team members, including backend and frontend developers, understand the API’s functionality and constraints without diving into the codebase.&lt;br /&gt;
*Client SDK Generation: Tools such as Swagger Codegen can utilize this file to automatically generate client libraries in various programming languages, which can accelerate development and integration efforts.&lt;br /&gt;
*Interactive API Documentation: Swagger UI can render this file into interactive API documentation that allows developers to perform live API calls for testing purposes, greatly enhancing the developer experience and easing troubleshooting and testing.&lt;br /&gt;
The careful organization and detailed descriptions in the Swagger file are critical for maintaining the robustness and reliability of the API, aligning with best practices in API design and documentation. This approach supports the project's goal to improve maintainability and readability of the grades_controller, ensuring that the API is both accessible and functional.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Helper Files ===&lt;br /&gt;
&lt;br /&gt;
The recently implemented helper modules—AssignmentHelper, AuthorizationHelper, GradesHelper, PenaltyHelper, and StudentTaskHelper—serve as foundational components that augment the functionality of the Expertiza system. Each module encapsulates specific, reusable logic that interfaces with various aspects of the system, promoting a modular, maintainable, and DRY codebase. Here’s a comprehensive breakdown of each helper module:&lt;br /&gt;
&lt;br /&gt;
====AssignmentHelper====&lt;br /&gt;
This module provides utility functions tailored to manage and manipulate course and assignment data:&lt;br /&gt;
&lt;br /&gt;
*course_options: Generates a list of courses available to the user based on their role, such as teaching assistants seeing only their courses, while administrators can view all courses.&lt;br /&gt;
*questionnaire_options: Filters questionnaires based on visibility and association with the instructor, allowing users to select questionnaires relevant to their role.&lt;br /&gt;
*review_strategy_options and due_date: These functions assist in setting up review strategies for assignments and managing due dates respectively, essential for assignment creation and editing.&lt;br /&gt;
====AuthorizationHelper====&lt;br /&gt;
Focused on security, this module determines the access level of users within the system:&lt;br /&gt;
&lt;br /&gt;
*current_user_has_..._privileges? methods check the user’s role against required privileges, ensuring actions are permitted before proceeding.&lt;br /&gt;
*current_user_is_assignment_participant? and similar methods validate user participation in specific contexts, crucial for enforcing role-based actions within assignments.&lt;br /&gt;
====GradesHelper====&lt;br /&gt;
This module aids in the handling and display of grades and related functionalities:&lt;br /&gt;
&lt;br /&gt;
*accordion_title and score_vector: These functions manage the display of structured data, such as grouping related responses under a common header in the UI.&lt;br /&gt;
*vector and mean: Utilized for statistical calculations to derive insights from grade data, supporting detailed analytical features like average scores.&lt;br /&gt;
====PenaltyHelper====&lt;br /&gt;
Manages the calculation of penalties based on assignment deadlines and submission timelines:&lt;br /&gt;
&lt;br /&gt;
*calculate_penalty and its associated methods (calculate_submission_penalty, calculate_review_penalty, etc.) assess penalties for late submissions and incomplete reviews, ensuring students are graded fairly based on timeliness and compliance with deadlines.&lt;br /&gt;
====StudentTaskHelper====&lt;br /&gt;
Enhances the student interaction with tasks and reviews:&lt;br /&gt;
&lt;br /&gt;
*get_review_grade_info and get_awarded_badges: Provide visual feedback and recognition for students’ efforts, which are crucial for motivation and engagement.&lt;br /&gt;
*check_reviewable_topics and unsubmitted_self_review?: These functions check for reviewable topics and monitor the submission status of self-reviews, critical for maintaining the integrity and progression of peer reviews.&lt;br /&gt;
&lt;br /&gt;
====Integration and Impact====&lt;br /&gt;
The integration of these helper modules significantly enhances the system's robustness by segregating responsibilities into distinct, manageable components. This approach not only simplifies the main application logic but also enhances code readability and maintenance—core aims of the project. By refining the backend architecture through these helpers, the system can more easily adapt to new requirements and facilitate smoother updates and enhancements.&lt;br /&gt;
&lt;br /&gt;
Incorporating these modules into the Expertiza platform effectively addresses key project objectives, including adherence to DRY principles, improved maintainability, and ensuring a scalable architecture that can handle the evolving needs of educational environments. These improvements directly contribute to a more stable, efficient, and user-friendly grading system.&lt;br /&gt;
&lt;br /&gt;
===Implementation of Migration files===&lt;br /&gt;
These migration files represent changes to the database schema in a Ruby on Rails application using ActiveRecord. Let's go through each migration file and explain its purpose:&lt;br /&gt;
&lt;br /&gt;
*CreateDeadlineTypes: This migration creates a table called deadline_types with a name column. It also inserts some initial data into this table.&lt;br /&gt;
*CreateLatePolicies: This migration creates a table called late_policies with columns for penalty period, penalty per unit, whether the penalty is expressed as a percentage, and maximum penalty. It also inserts initial data into this table and adds an index on the penalty_period_in_minutes column.&lt;br /&gt;
*CreateDueDates: This migration creates a table called due_dates with columns for due date, deadline type ID, assignment ID, late policy ID, and flags for submission, review, resubmission, rereview, and review of review permissions. It adds foreign key constraints to reference other tables and indexes on various columns.&lt;br /&gt;
*ChangeAssignmentIdInDueDatesTableToParentId: This migration renames the assignment_id column in the due_dates table to parent_id and removes the foreign key constraint on it. This seems to be part of a restructuring where assignment_id is renamed to parent_id in several tables.&lt;br /&gt;
*CreateTeams: This migration creates a table called teams with a name column and an assignment_id column, which references the assignments table. It adds a foreign key constraint on the assignment_id column.&lt;br /&gt;
*ChangeAssignmentIdInParticipantsTableToParentId: This migration renames the assignment_id column in the participants table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*ChangeAssignmentIdInTeamsTableToParentId: This migration renames the assignment_id column in the teams table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*AddUsedInRoundToAssignmentQuestionnaires: This migration adds a column called used_in_round to the assignment_questionnaires table.&lt;br /&gt;
*UpdateParticipants: This migration adds columns for grade, comments_to_student, and private_instructor_comments to the participants table.&lt;br /&gt;
*CreateTeamsUsers: This migration creates a join table called teams_users to establish a many-to-many relationship between teams and users. It adds foreign key constraints for both team_id and user_id.&lt;br /&gt;
&lt;br /&gt;
=== Use of Design and Dry Principles===&lt;br /&gt;
In the provided GradesController code, several design principles and DRY (Don't Repeat Yourself) principles have been applied to ensure a clean and maintainable codebase. Let's break down the implementation and discuss how these principles are reflected:&lt;br /&gt;
&lt;br /&gt;
====Modularization and Inclusion of Concerns====&lt;br /&gt;
The controller includes several modules like Scoring, PenaltyHelper, StudentTaskHelper, AssignmentHelper, GradesHelper, and AuthorizationHelper. This modularization helps in organizing related functionalities into separate files, promoting better code organization and reusability.&lt;br /&gt;
Each module encapsulates related methods and concerns, promoting separation of concerns and making the codebase more modular.&lt;br /&gt;
====Single Responsibility Principle (SRP)====&lt;br /&gt;
Methods within the controller have clear and specific responsibilities. For example, view, view_scores, view_team, edit, show, update, and save_grade_and_comment_for_submission methods handle specific actions related to grading, viewing, and updating grades.&lt;br /&gt;
This adherence to SRP makes the code easier to understand, test, and maintain as each method focuses on a single task.&lt;br /&gt;
====Conditional Handling with Case Statements====&lt;br /&gt;
The action_allowed method utilizes a case statement to handle different actions based on the parameters received. This approach makes the code more readable and maintainable compared to using multiple nested if-else statements.&lt;br /&gt;
Each case in the statement handles a specific action, improving code organization and readability.&lt;br /&gt;
====Code Reuse and DRY Principle====&lt;br /&gt;
Common functionalities are abstracted into helper modules (GradesHelper, PenaltyHelper, etc.) and included where needed. For example, methods like participant_scores, calculate_penalty, retrieve_questions, etc., are reused across different controller actions.&lt;br /&gt;
By extracting shared functionalities into helper modules, the code adheres to the DRY principle, reducing redundancy and promoting code reuse.&lt;br /&gt;
====Comments and Documentation====&lt;br /&gt;
The code includes comments explaining the purpose of methods, API endpoints, and complex logic. Comments are used judiciously to provide clarity where necessary.&lt;br /&gt;
While comments are helpful, they should ideally focus on explaining why certain decisions were made or complex logic was implemented rather than simply restating what the code does.&lt;br /&gt;
====Private Methods for Encapsulation====&lt;br /&gt;
Private methods like set_assignment, list_questions, and self_review_finished? encapsulate internal implementation details and are not accessible outside the controller. This encapsulation hides complexity and promotes cleaner interfaces.&lt;br /&gt;
====Error Handling====&lt;br /&gt;
Error handling is implemented using rescue_from for ActiveRecord::RecordNotFound and StandardError. This ensures graceful handling of exceptions and provides meaningful error responses to clients.&lt;br /&gt;
Overall, the GradesController demonstrates good adherence to design principles like SRP, modularity, DRY, encapsulation, and error handling. The code is well-structured, readable, and follows best practices for building maintainable Rails applications.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
Pull Request : https://github.com/expertiza/reimplementation-back-end/pull/97&lt;br /&gt;
&lt;br /&gt;
Demonstration : https://drive.google.com/drive/folders/1bfh348t-zbcLZ-VlpTCAGRtoSgVimTnU?usp=sharing&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:View_team_grade.jpeg&amp;diff=156826</id>
		<title>File:View team grade.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:View_team_grade.jpeg&amp;diff=156826"/>
		<updated>2024-04-24T04:03:45Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:View_scores.jpeg&amp;diff=156824</id>
		<title>File:View scores.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:View_scores.jpeg&amp;diff=156824"/>
		<updated>2024-04-24T04:03:06Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:View_grade.jpeg&amp;diff=156823</id>
		<title>File:View grade.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:View_grade.jpeg&amp;diff=156823"/>
		<updated>2024-04-24T04:02:48Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Update_grade.jpeg&amp;diff=156822</id>
		<title>File:Update grade.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Update_grade.jpeg&amp;diff=156822"/>
		<updated>2024-04-24T04:02:35Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Show_grade.jpeg&amp;diff=156820</id>
		<title>File:Show grade.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Show_grade.jpeg&amp;diff=156820"/>
		<updated>2024-04-24T04:02:10Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Action_allowed_grade.jpeg&amp;diff=156819</id>
		<title>File:Action allowed grade.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Action_allowed_grade.jpeg&amp;diff=156819"/>
		<updated>2024-04-24T04:01:55Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Save_grade_and_comment.jpeg&amp;diff=156817</id>
		<title>File:Save grade and comment.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Save_grade_and_comment.jpeg&amp;diff=156817"/>
		<updated>2024-04-24T04:01:24Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156674</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=156674"/>
		<updated>2024-04-24T03:11:40Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Breakdown of Routes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
[[File:Oss4_uml.png|800px|UML Diagram]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
==Reimplementation of GradesController ==&lt;br /&gt;
&lt;br /&gt;
=== Implementation of APIs ===&lt;br /&gt;
&lt;br /&gt;
In the context of the project &amp;quot;E2443. Reimplement grades_controller&amp;quot; for the Expertiza platform, the modifications made to the routes.rb file for the GradesController are intended to streamline and enhance the existing functionality related to grading. These routing configurations play a critical role in structuring how grade-related requests are processed and responded to within the application.&lt;br /&gt;
&lt;br /&gt;
The specific routes added under the grades resource leverage a nested structure to facilitate clear and organized handling of various grade-related actions, ensuring that each action pertains directly to individual grade entities identified by :id, being the participant ID. &lt;br /&gt;
&lt;br /&gt;
====Breakdown of Routes====&lt;br /&gt;
&lt;br /&gt;
*View Team (:id/view_team) - This endpoint retrieves detailed information about the team associated with a specific assignment participant. It is crucial for scenarios where assessments or grades are team-based. The API fetches the participant's team and provides comprehensive details, including the team members and their contributions to assignments. This functionality supports collaborative assessments and enhances transparency in team-based grading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view_team&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questions = retrieve_questions(questionnaires, assignment.id)&lt;br /&gt;
    pscore = participant_scores(participant, questions)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant:, assignment:, team:, questions:, pscore:}&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*View Grade Details (:id/view) - This endpoint allows for viewing all relevant details of an assignment for a particular participant. It aggregates data such as related questionnaires, questions, and scores, providing a holistic view of the grading criteria and results. This function is particularly valuable for providing a comprehensive breakdown of scores across different review rounds, assisting in a deeper understanding of how grades were allocated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    assignment = Assignment.find(params[:id])&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    if assignment.num_review_rounds &amp;gt; 1&lt;br /&gt;
      questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    else&lt;br /&gt;
      questions = {}&lt;br /&gt;
      questionnaires.each do |questionnaire|&lt;br /&gt;
        questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    scores = review_grades(assignment, questions)&lt;br /&gt;
    num_reviewers_assigned_scores = scores[:teams].length&lt;br /&gt;
    averages = vector(scores)&lt;br /&gt;
    avg_of_avg = mean(averages)&lt;br /&gt;
    render json: { scores:, averages:, avg_of_avg:, num_reviewers_assigned_scores: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*View Scores (:id/view_scores) - This API endpoint is designed to show scores for a specific assignment participant. It provides detailed insights into how participants are performing in the ongoing assignments and the various stages of assignment completion. This is essential for tracking academic progress and identifying areas where students may need additional support or recognition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  def view_scores&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    # questionnaires = assignment.questionnaires&lt;br /&gt;
    # questions = retrieve_questions questionnaires, assignment.id&lt;br /&gt;
    # pscore = participant_scores(participant, questions)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.assignment.id, participant.user_id)&lt;br /&gt;
    stage = assignment.current_stage(topic_id)&lt;br /&gt;
&lt;br /&gt;
    render json: { participant: }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Update Grade (:id/update) - This endpoint enables updating the grade for a participant. It accepts a new grade value and updates the participant’s record if the new grade differs from the existing one. This API is crucial for situations where grades need to be revised or corrected, ensuring that grading remains dynamic and reflective of actual student performance and any subsequent reviews or reassessments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Show Grade (:id) - This endpoint provides a detailed view of a participant's assignment by fetching and displaying all relevant information such as the assignment details, participant info, related questions, and scores. This function is a vital read operation that allows instructors and students to access complete information on a participant's performance in a specific assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Action Allowed (:id/action_allowed) - This endpoint checks if a particular action is allowed for the current user, based on the user’s role and the specific action they intend to perform (like viewing scores). It ensures that operations are conducted within established permissions, enhancing security and role-based access control within the application. This is critical for maintaining the integrity of the grading process and ensuring that only authorized actions are executed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Save Grade and Comment (:id/save_grade_and_comment_for_submission) - This API allows for the saving of grades and comments for a specific submission. It is designed to capture both quantitative and qualitative feedback, storing this information securely and making it accessible for review. This endpoint is particularly important for providing feedback that is integral to educational environments, fostering a constructive and informative feedback loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These routes collectively support the essential CRUD operations needed for managing grades within the Expertiza system. By carefully defining these routes, the project ensures that grade management is handled in a structured and efficient manner, thereby reducing redundancy and enhancing the overall system architecture. This reimplementation fosters better scalability and easier maintenance, adhering to improved software design principles and practices.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Spec file  ===&lt;br /&gt;
The specification file for the Grades API provides comprehensive testing scenarios for various endpoints within the Api::V1::GradesController. This document is crafted using RSpec, a popular testing framework for Ruby applications, and employs the Swagger tool to describe and document the API endpoints. The focus is on ensuring that the controller behaves as expected across different use cases, adhering to both functional and non-functional requirements. Here is a detailed explanation of the test cases outlined in the specification:&lt;br /&gt;
&lt;br /&gt;
====Testing Framework and Tools====&lt;br /&gt;
*RSpec is utilized for writing and executing the test cases, providing a DSL (Domain-Specific Language) that is readable and expressive.&lt;br /&gt;
*Swagger helps in documenting the API, which not only serves for testing but also acts as a live documentation for developers and users of the API.&lt;br /&gt;
====Endpoints and Test Scenarios====&lt;br /&gt;
*GET /api/v1/grades/{id}/view - This endpoint tests the functionality to view detailed grade information for a specific ID.The test ensures that upon receiving a valid ID, the system returns a 200 status code indicating a successful operation.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_team - Tests the ability to retrieve team details associated with a specific grade.A 200 status code response is expected when valid data is provided, confirming the correct retrieval of team information.&lt;br /&gt;
*GET /api/v1/grades/{id}/view_scores - Focuses on viewing scores for a specific grade.The test confirms that the endpoint returns a 200 status when executed with a correct ID, displaying the scores accurately.&lt;br /&gt;
*PUT /api/v1/grades/{id}/update - Tests the grade update functionality. This endpoint expects a JSON body with grade details.Two scenarios are tested: successful grade update (200 status) and failure due to missing required attributes (422 status), ensuring robust error handling and data validation.&lt;br /&gt;
*GET /api/v1/grades/{id} - Simple retrieval of grade details. The test verifies that the endpoint fetches and returns the correct grade information, indicated by a 200 success status.&lt;br /&gt;
*GET /api/v1/grades/{id}/action_allowed - Checks if a certain action is permissible for a given grade ID. It tests for both allowed (200 status) and not allowed scenarios (403 status), important for validating access control mechanisms.&lt;br /&gt;
*PUT /api/v1/grades/{id}/save_grade_and_comment_for_submission - This test ensures that grades and comments can be successfully saved for a submission. The parameters are passed via query strings, and the test checks for a successful save operation (200 status).&lt;br /&gt;
&lt;br /&gt;
====Importance of These Tests====&lt;br /&gt;
The specified tests are essential for maintaining the integrity and reliability of the Grades API. They ensure that:&lt;br /&gt;
&lt;br /&gt;
*The API responds correctly under various conditions.&lt;br /&gt;
*Data integrity is maintained with correct inputs and handling of incorrect or partial inputs.&lt;br /&gt;
*Security and access control measures are effective, particularly in verifying user permissions.&lt;br /&gt;
This meticulous testing setup reflects a commitment to quality and robustness in the software development lifecycle, crucial for applications like Expertiza that are used in educational settings. These tests contribute directly to the project's aim of enhancing maintainability, readability, and adherence to the DRY principle within the grades_controller.&lt;br /&gt;
&lt;br /&gt;
===Swagger File Implementation===&lt;br /&gt;
The Swagger file uses YAML format to describe the HTTP routes, parameters, and responses for the API. Each path is clearly defined with required parameters and expected responses, facilitating automatic documentation generation and client code generation.&lt;br /&gt;
&lt;br /&gt;
====GET /grades/{id}/view_team====&lt;br /&gt;
Summary: Retrieve team details associated with a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Indicates successful retrieval of the team details.&lt;br /&gt;
Parameter: id (integer, required) - the unique identifier for a grade.&lt;br /&gt;
====GET /grades/{id}/view====&lt;br /&gt;
Summary: Fetch comprehensive details about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, returning complete grade details.&lt;br /&gt;
====GET /grades/{id}/view_scores====&lt;br /&gt;
Summary: Obtain scoring details for a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful retrieval of score data.&lt;br /&gt;
====PUT /grades/{id}/update====&lt;br /&gt;
Summary: Update details of a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Confirmation of successful update.&lt;br /&gt;
====GET /grades/{id}====&lt;br /&gt;
Summary: Access detailed information about a specific grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful operation, showing detailed grade data.&lt;br /&gt;
====GET /grades/{id}/action_allowed====&lt;br /&gt;
Summary: Check permissions for performing certain actions on a grade.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successful verification of allowed actions.&lt;br /&gt;
====POST /grades/{id}/save_grade_and_comment_for_submission====&lt;br /&gt;
Summary: Save a grade along with a comment for a specific submission.&lt;br /&gt;
&lt;br /&gt;
Response 200: Successfully saved the grade and comment.&lt;br /&gt;
&lt;br /&gt;
====Importance and Usage====&lt;br /&gt;
*Standardization and Documentation: Swagger files like this one help in standardizing API practices across development teams, providing a consistent and predictable interface. It ensures that all team members, including backend and frontend developers, understand the API’s functionality and constraints without diving into the codebase.&lt;br /&gt;
*Client SDK Generation: Tools such as Swagger Codegen can utilize this file to automatically generate client libraries in various programming languages, which can accelerate development and integration efforts.&lt;br /&gt;
*Interactive API Documentation: Swagger UI can render this file into interactive API documentation that allows developers to perform live API calls for testing purposes, greatly enhancing the developer experience and easing troubleshooting and testing.&lt;br /&gt;
The careful organization and detailed descriptions in the Swagger file are critical for maintaining the robustness and reliability of the API, aligning with best practices in API design and documentation. This approach supports the project's goal to improve maintainability and readability of the grades_controller, ensuring that the API is both accessible and functional.&lt;br /&gt;
&lt;br /&gt;
=== Implementation of Helper Files ===&lt;br /&gt;
&lt;br /&gt;
The recently implemented helper modules—AssignmentHelper, AuthorizationHelper, GradesHelper, PenaltyHelper, and StudentTaskHelper—serve as foundational components that augment the functionality of the Expertiza system. Each module encapsulates specific, reusable logic that interfaces with various aspects of the system, promoting a modular, maintainable, and DRY codebase. Here’s a comprehensive breakdown of each helper module:&lt;br /&gt;
&lt;br /&gt;
====AssignmentHelper====&lt;br /&gt;
This module provides utility functions tailored to manage and manipulate course and assignment data:&lt;br /&gt;
&lt;br /&gt;
*course_options: Generates a list of courses available to the user based on their role, such as teaching assistants seeing only their courses, while administrators can view all courses.&lt;br /&gt;
*questionnaire_options: Filters questionnaires based on visibility and association with the instructor, allowing users to select questionnaires relevant to their role.&lt;br /&gt;
*review_strategy_options and due_date: These functions assist in setting up review strategies for assignments and managing due dates respectively, essential for assignment creation and editing.&lt;br /&gt;
====AuthorizationHelper====&lt;br /&gt;
Focused on security, this module determines the access level of users within the system:&lt;br /&gt;
&lt;br /&gt;
*current_user_has_..._privileges? methods check the user’s role against required privileges, ensuring actions are permitted before proceeding.&lt;br /&gt;
*current_user_is_assignment_participant? and similar methods validate user participation in specific contexts, crucial for enforcing role-based actions within assignments.&lt;br /&gt;
====GradesHelper====&lt;br /&gt;
This module aids in the handling and display of grades and related functionalities:&lt;br /&gt;
&lt;br /&gt;
*accordion_title and score_vector: These functions manage the display of structured data, such as grouping related responses under a common header in the UI.&lt;br /&gt;
*vector and mean: Utilized for statistical calculations to derive insights from grade data, supporting detailed analytical features like average scores.&lt;br /&gt;
====PenaltyHelper====&lt;br /&gt;
Manages the calculation of penalties based on assignment deadlines and submission timelines:&lt;br /&gt;
&lt;br /&gt;
*calculate_penalty and its associated methods (calculate_submission_penalty, calculate_review_penalty, etc.) assess penalties for late submissions and incomplete reviews, ensuring students are graded fairly based on timeliness and compliance with deadlines.&lt;br /&gt;
====StudentTaskHelper====&lt;br /&gt;
Enhances the student interaction with tasks and reviews:&lt;br /&gt;
&lt;br /&gt;
*get_review_grade_info and get_awarded_badges: Provide visual feedback and recognition for students’ efforts, which are crucial for motivation and engagement.&lt;br /&gt;
*check_reviewable_topics and unsubmitted_self_review?: These functions check for reviewable topics and monitor the submission status of self-reviews, critical for maintaining the integrity and progression of peer reviews.&lt;br /&gt;
&lt;br /&gt;
====Integration and Impact====&lt;br /&gt;
The integration of these helper modules significantly enhances the system's robustness by segregating responsibilities into distinct, manageable components. This approach not only simplifies the main application logic but also enhances code readability and maintenance—core aims of the project. By refining the backend architecture through these helpers, the system can more easily adapt to new requirements and facilitate smoother updates and enhancements.&lt;br /&gt;
&lt;br /&gt;
Incorporating these modules into the Expertiza platform effectively addresses key project objectives, including adherence to DRY principles, improved maintainability, and ensuring a scalable architecture that can handle the evolving needs of educational environments. These improvements directly contribute to a more stable, efficient, and user-friendly grading system.&lt;br /&gt;
&lt;br /&gt;
===Implementation of Migration files===&lt;br /&gt;
These migration files represent changes to the database schema in a Ruby on Rails application using ActiveRecord. Let's go through each migration file and explain its purpose:&lt;br /&gt;
&lt;br /&gt;
*CreateDeadlineTypes: This migration creates a table called deadline_types with a name column. It also inserts some initial data into this table.&lt;br /&gt;
*CreateLatePolicies: This migration creates a table called late_policies with columns for penalty period, penalty per unit, whether the penalty is expressed as a percentage, and maximum penalty. It also inserts initial data into this table and adds an index on the penalty_period_in_minutes column.&lt;br /&gt;
*CreateDueDates: This migration creates a table called due_dates with columns for due date, deadline type ID, assignment ID, late policy ID, and flags for submission, review, resubmission, rereview, and review of review permissions. It adds foreign key constraints to reference other tables and indexes on various columns.&lt;br /&gt;
*ChangeAssignmentIdInDueDatesTableToParentId: This migration renames the assignment_id column in the due_dates table to parent_id and removes the foreign key constraint on it. This seems to be part of a restructuring where assignment_id is renamed to parent_id in several tables.&lt;br /&gt;
*CreateTeams: This migration creates a table called teams with a name column and an assignment_id column, which references the assignments table. It adds a foreign key constraint on the assignment_id column.&lt;br /&gt;
*ChangeAssignmentIdInParticipantsTableToParentId: This migration renames the assignment_id column in the participants table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*ChangeAssignmentIdInTeamsTableToParentId: This migration renames the assignment_id column in the teams table to parent_id and removes the foreign key constraint on it.&lt;br /&gt;
*AddUsedInRoundToAssignmentQuestionnaires: This migration adds a column called used_in_round to the assignment_questionnaires table.&lt;br /&gt;
*UpdateParticipants: This migration adds columns for grade, comments_to_student, and private_instructor_comments to the participants table.&lt;br /&gt;
*CreateTeamsUsers: This migration creates a join table called teams_users to establish a many-to-many relationship between teams and users. It adds foreign key constraints for both team_id and user_id.&lt;br /&gt;
&lt;br /&gt;
=== Use of Design and Dry Principles===&lt;br /&gt;
In the provided GradesController code, several design principles and DRY (Don't Repeat Yourself) principles have been applied to ensure a clean and maintainable codebase. Let's break down the implementation and discuss how these principles are reflected:&lt;br /&gt;
&lt;br /&gt;
====Modularization and Inclusion of Concerns====&lt;br /&gt;
The controller includes several modules like Scoring, PenaltyHelper, StudentTaskHelper, AssignmentHelper, GradesHelper, and AuthorizationHelper. This modularization helps in organizing related functionalities into separate files, promoting better code organization and reusability.&lt;br /&gt;
Each module encapsulates related methods and concerns, promoting separation of concerns and making the codebase more modular.&lt;br /&gt;
====Single Responsibility Principle (SRP)====&lt;br /&gt;
Methods within the controller have clear and specific responsibilities. For example, view, view_scores, view_team, edit, show, update, and save_grade_and_comment_for_submission methods handle specific actions related to grading, viewing, and updating grades.&lt;br /&gt;
This adherence to SRP makes the code easier to understand, test, and maintain as each method focuses on a single task.&lt;br /&gt;
====Conditional Handling with Case Statements====&lt;br /&gt;
The action_allowed method utilizes a case statement to handle different actions based on the parameters received. This approach makes the code more readable and maintainable compared to using multiple nested if-else statements.&lt;br /&gt;
Each case in the statement handles a specific action, improving code organization and readability.&lt;br /&gt;
====Code Reuse and DRY Principle====&lt;br /&gt;
Common functionalities are abstracted into helper modules (GradesHelper, PenaltyHelper, etc.) and included where needed. For example, methods like participant_scores, calculate_penalty, retrieve_questions, etc., are reused across different controller actions.&lt;br /&gt;
By extracting shared functionalities into helper modules, the code adheres to the DRY principle, reducing redundancy and promoting code reuse.&lt;br /&gt;
====Comments and Documentation====&lt;br /&gt;
The code includes comments explaining the purpose of methods, API endpoints, and complex logic. Comments are used judiciously to provide clarity where necessary.&lt;br /&gt;
While comments are helpful, they should ideally focus on explaining why certain decisions were made or complex logic was implemented rather than simply restating what the code does.&lt;br /&gt;
====Private Methods for Encapsulation====&lt;br /&gt;
Private methods like set_assignment, list_questions, and self_review_finished? encapsulate internal implementation details and are not accessible outside the controller. This encapsulation hides complexity and promotes cleaner interfaces.&lt;br /&gt;
====Error Handling====&lt;br /&gt;
Error handling is implemented using rescue_from for ActiveRecord::RecordNotFound and StandardError. This ensures graceful handling of exceptions and provides meaningful error responses to clients.&lt;br /&gt;
Overall, the GradesController demonstrates good adherence to design principles like SRP, modularity, DRY, encapsulation, and error handling. The code is well-structured, readable, and follows best practices for building maintainable Rails applications.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
== Initial Attempt in re-implementation ==&lt;br /&gt;
&lt;br /&gt;
The initial implementation of the grades_controller in the API namespace enhances the code structure, readability, and maintainability through a series of thoughtful improvements. These changes align with the principles of modularity, reusability, and clarity, ensuring the controller's effectiveness in handling grading-related tasks within the application.&lt;br /&gt;
&lt;br /&gt;
One significant improvement is the organization of controller actions, each serving a specific purpose and adhering to RESTful conventions. Actions such as `view`, `view_my_scores`, `view_team`, `edit`, `update`, and `save_grade_and_comment_for_submission` are clearly defined and encapsulate distinct functionalities. This structured approach enhances code readability and makes it easier to understand the controller's responsibilities at a glance.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def view&lt;br /&gt;
        @assignment = Assignment.find(params[:id])&lt;br /&gt;
        @scores = review_grades(@assignment, retrieve_questions(@assignment.questionnaires, @assignment.id))&lt;br /&gt;
        render json: grading_report_data(@assignment, @scores)&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_my_scores&lt;br /&gt;
        @questions = retrieve_questions(@participant.assignment.questionnaires, @participant.assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        make_chart&lt;br /&gt;
        @summary = prepare_feedback_summary&lt;br /&gt;
        render json: my_scores_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_team&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        @team = @participant.team&lt;br /&gt;
        @team_id = @team.id&lt;br /&gt;
        @questions = retrieve_questions(@assignment.questionnaires, @assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        @penalties = calculate_penalty(@participant.id)&lt;br /&gt;
        @vmlist = populate_view_models&lt;br /&gt;
        @current_role_name = current_role_name&lt;br /&gt;
        render json: team_view_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit&lt;br /&gt;
        @questions = list_questions(@participant.assignment)&lt;br /&gt;
        @scores = participant_scores(@participant, @questions)&lt;br /&gt;
        render json: edit_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def update&lt;br /&gt;
        if @participant.update(participant_params)&lt;br /&gt;
          render json: @participant&lt;br /&gt;
        else&lt;br /&gt;
          render json: @participant.errors, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def save_grade_and_comment_for_submission&lt;br /&gt;
        if @participant.team.update(grade_for_submission: params[:grade_for_submission], comment_for_submission: params[:comment_for_submission])&lt;br /&gt;
          render json: { success: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { success: false, errors: @participant.team.errors.full_messages }, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Furthermore, the controller leverages `before_action` callbacks to set the participant before executing certain actions, reducing redundancy and promoting DRY (Don't Repeat Yourself) principles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class GradesController &amp;lt; ApplicationController&lt;br /&gt;
    before_action :set_participant, only: [:view_my_scores, :view_team, :edit, :update, :save_grade_and_comment_for_submission]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
By defining the `set_participant` method as a callback for actions that require participant data, the controller avoids repetitive code and ensures consistency in handling participant-related tasks across different actions.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    def set_participant&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The use of private helper methods encapsulates logic that is specific to each action, promoting code reuse and modularity. These methods, such as `grading_report_data`, `my_scores_data`, `team_view_data`, `edit_data`, `prepare_feedback_summary`, and `populate_view_models`, encapsulate data preparation and processing tasks, keeping the controller actions focused and concise.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def grading_report_data(assignment, scores)&lt;br /&gt;
        {&lt;br /&gt;
          assignment: assignment,&lt;br /&gt;
          scores: scores,&lt;br /&gt;
          num_reviewers_assigned_scores: scores[:teams].length,&lt;br /&gt;
          average_chart: bar_chart(vector(scores)),&lt;br /&gt;
          avg_of_avg: mean(vector(scores)),&lt;br /&gt;
          penalties: penalties(assignment.id),&lt;br /&gt;
          show_reputation: false&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def my_scores_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          summary: @summary,&lt;br /&gt;
          avg_scores_by_round: @summary.avg_scores_by_round,&lt;br /&gt;
          avg_scores_by_criterion: @summary.avg_scores_by_criterion&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def team_view_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          assignment: @assignment,&lt;br /&gt;
          team: @team,&lt;br /&gt;
          team_id: @team_id,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          penalties: @penalties,&lt;br /&gt;
          vmlist: @vmlist,&lt;br /&gt;
          current_role_name: @current_role_name&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          scores: @scores&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def prepare_feedback_summary&lt;br /&gt;
        summary_ws_url = WEBSERVICE_CONFIG['summary_webservice_url']&lt;br /&gt;
        sum = SummaryHelper::Summary.new.summarize_reviews_by_reviewee(@questions, @participant.assignment, @team_id, summary_ws_url, session)&lt;br /&gt;
        sum.summary&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def populate_view_models&lt;br /&gt;
        vmlist = []&lt;br /&gt;
        counter_for_same_rubric = 0&lt;br /&gt;
        if @assignment.vary_by_topic?&lt;br /&gt;
          topic_id = SignedUpTeam.topic_id_by_team_id(@team_id)&lt;br /&gt;
          topic_specific_questionnaire = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id).first.questionnaire&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(topic_specific_questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        @assignment.questionnaires.each do |questionnaire|&lt;br /&gt;
          @round = nil&lt;br /&gt;
          next if @assignment.vary_by_topic? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
  &lt;br /&gt;
          if @assignment.varying_rubrics_by_round? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
            questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
            if questionnaires.count &amp;gt; 1&lt;br /&gt;
              @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
              counter_for_same_rubric += 1&lt;br /&gt;
            else&lt;br /&gt;
              @round = questionnaires[0].used_in_round&lt;br /&gt;
              counter_for_same_rubric = 0&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        vmlist&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Additionally, the controller follows strong parameter conventions by using the `participant_params` method to permit specific attributes for participant updates. This helps mitigate security risks associated with mass assignment vulnerabilities and ensures that only permitted attributes can be modified through API requests.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def participant_params&lt;br /&gt;
        params.require(:participant).permit(:grade, :other_params)&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155559</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155559"/>
		<updated>2024-04-09T02:31:30Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Initial Attempt in re-implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
== Initial Attempt in re-implementation ==&lt;br /&gt;
&lt;br /&gt;
The initial implementation of the grades_controller in the API namespace enhances the code structure, readability, and maintainability through a series of thoughtful improvements. These changes align with the principles of modularity, reusability, and clarity, ensuring the controller's effectiveness in handling grading-related tasks within the application.&lt;br /&gt;
&lt;br /&gt;
One significant improvement is the organization of controller actions, each serving a specific purpose and adhering to RESTful conventions. Actions such as `view`, `view_my_scores`, `view_team`, `edit`, `update`, and `save_grade_and_comment_for_submission` are clearly defined and encapsulate distinct functionalities. This structured approach enhances code readability and makes it easier to understand the controller's responsibilities at a glance.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def view&lt;br /&gt;
        @assignment = Assignment.find(params[:id])&lt;br /&gt;
        @scores = review_grades(@assignment, retrieve_questions(@assignment.questionnaires, @assignment.id))&lt;br /&gt;
        render json: grading_report_data(@assignment, @scores)&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_my_scores&lt;br /&gt;
        @questions = retrieve_questions(@participant.assignment.questionnaires, @participant.assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        make_chart&lt;br /&gt;
        @summary = prepare_feedback_summary&lt;br /&gt;
        render json: my_scores_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_team&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        @team = @participant.team&lt;br /&gt;
        @team_id = @team.id&lt;br /&gt;
        @questions = retrieve_questions(@assignment.questionnaires, @assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        @penalties = calculate_penalty(@participant.id)&lt;br /&gt;
        @vmlist = populate_view_models&lt;br /&gt;
        @current_role_name = current_role_name&lt;br /&gt;
        render json: team_view_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit&lt;br /&gt;
        @questions = list_questions(@participant.assignment)&lt;br /&gt;
        @scores = participant_scores(@participant, @questions)&lt;br /&gt;
        render json: edit_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def update&lt;br /&gt;
        if @participant.update(participant_params)&lt;br /&gt;
          render json: @participant&lt;br /&gt;
        else&lt;br /&gt;
          render json: @participant.errors, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def save_grade_and_comment_for_submission&lt;br /&gt;
        if @participant.team.update(grade_for_submission: params[:grade_for_submission], comment_for_submission: params[:comment_for_submission])&lt;br /&gt;
          render json: { success: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { success: false, errors: @participant.team.errors.full_messages }, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Furthermore, the controller leverages `before_action` callbacks to set the participant before executing certain actions, reducing redundancy and promoting DRY (Don't Repeat Yourself) principles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class GradesController &amp;lt; ApplicationController&lt;br /&gt;
    before_action :set_participant, only: [:view_my_scores, :view_team, :edit, :update, :save_grade_and_comment_for_submission]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
By defining the `set_participant` method as a callback for actions that require participant data, the controller avoids repetitive code and ensures consistency in handling participant-related tasks across different actions.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    def set_participant&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The use of private helper methods encapsulates logic that is specific to each action, promoting code reuse and modularity. These methods, such as `grading_report_data`, `my_scores_data`, `team_view_data`, `edit_data`, `prepare_feedback_summary`, and `populate_view_models`, encapsulate data preparation and processing tasks, keeping the controller actions focused and concise.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def grading_report_data(assignment, scores)&lt;br /&gt;
        {&lt;br /&gt;
          assignment: assignment,&lt;br /&gt;
          scores: scores,&lt;br /&gt;
          num_reviewers_assigned_scores: scores[:teams].length,&lt;br /&gt;
          average_chart: bar_chart(vector(scores)),&lt;br /&gt;
          avg_of_avg: mean(vector(scores)),&lt;br /&gt;
          penalties: penalties(assignment.id),&lt;br /&gt;
          show_reputation: false&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def my_scores_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          summary: @summary,&lt;br /&gt;
          avg_scores_by_round: @summary.avg_scores_by_round,&lt;br /&gt;
          avg_scores_by_criterion: @summary.avg_scores_by_criterion&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def team_view_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          assignment: @assignment,&lt;br /&gt;
          team: @team,&lt;br /&gt;
          team_id: @team_id,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          penalties: @penalties,&lt;br /&gt;
          vmlist: @vmlist,&lt;br /&gt;
          current_role_name: @current_role_name&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          scores: @scores&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def prepare_feedback_summary&lt;br /&gt;
        summary_ws_url = WEBSERVICE_CONFIG['summary_webservice_url']&lt;br /&gt;
        sum = SummaryHelper::Summary.new.summarize_reviews_by_reviewee(@questions, @participant.assignment, @team_id, summary_ws_url, session)&lt;br /&gt;
        sum.summary&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def populate_view_models&lt;br /&gt;
        vmlist = []&lt;br /&gt;
        counter_for_same_rubric = 0&lt;br /&gt;
        if @assignment.vary_by_topic?&lt;br /&gt;
          topic_id = SignedUpTeam.topic_id_by_team_id(@team_id)&lt;br /&gt;
          topic_specific_questionnaire = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id).first.questionnaire&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(topic_specific_questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        @assignment.questionnaires.each do |questionnaire|&lt;br /&gt;
          @round = nil&lt;br /&gt;
          next if @assignment.vary_by_topic? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
  &lt;br /&gt;
          if @assignment.varying_rubrics_by_round? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
            questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
            if questionnaires.count &amp;gt; 1&lt;br /&gt;
              @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
              counter_for_same_rubric += 1&lt;br /&gt;
            else&lt;br /&gt;
              @round = questionnaires[0].used_in_round&lt;br /&gt;
              counter_for_same_rubric = 0&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        vmlist&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Additionally, the controller follows strong parameter conventions by using the `participant_params` method to permit specific attributes for participant updates. This helps mitigate security risks associated with mass assignment vulnerabilities and ensures that only permitted attributes can be modified through API requests.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def participant_params&lt;br /&gt;
        params.require(:participant).permit(:grade, :other_params)&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155558</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155558"/>
		<updated>2024-04-09T02:30:59Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Initial Attempt in re-implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
== Initial Attempt in re-implementation ==&lt;br /&gt;
&lt;br /&gt;
The initial implementation of the grades_controller in the API namespace enhances the code structure, readability, and maintainability through a series of thoughtful improvements. These changes align with the principles of modularity, reusability, and clarity, ensuring the controller's effectiveness in handling grading-related tasks within the application.&lt;br /&gt;
&lt;br /&gt;
One significant improvement is the organization of controller actions, each serving a specific purpose and adhering to RESTful conventions. Actions such as `view`, `view_my_scores`, `view_team`, `edit`, `update`, and `save_grade_and_comment_for_submission` are clearly defined and encapsulate distinct functionalities. This structured approach enhances code readability and makes it easier to understand the controller's responsibilities at a glance.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def view&lt;br /&gt;
        @assignment = Assignment.find(params[:id])&lt;br /&gt;
        @scores = review_grades(@assignment, retrieve_questions(@assignment.questionnaires, @assignment.id))&lt;br /&gt;
        render json: grading_report_data(@assignment, @scores)&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_my_scores&lt;br /&gt;
        @questions = retrieve_questions(@participant.assignment.questionnaires, @participant.assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        make_chart&lt;br /&gt;
        @summary = prepare_feedback_summary&lt;br /&gt;
        render json: my_scores_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_team&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        @team = @participant.team&lt;br /&gt;
        @team_id = @team.id&lt;br /&gt;
        @questions = retrieve_questions(@assignment.questionnaires, @assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        @penalties = calculate_penalty(@participant.id)&lt;br /&gt;
        @vmlist = populate_view_models&lt;br /&gt;
        @current_role_name = current_role_name&lt;br /&gt;
        render json: team_view_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit&lt;br /&gt;
        @questions = list_questions(@participant.assignment)&lt;br /&gt;
        @scores = participant_scores(@participant, @questions)&lt;br /&gt;
        render json: edit_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def update&lt;br /&gt;
        if @participant.update(participant_params)&lt;br /&gt;
          render json: @participant&lt;br /&gt;
        else&lt;br /&gt;
          render json: @participant.errors, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def save_grade_and_comment_for_submission&lt;br /&gt;
        if @participant.team.update(grade_for_submission: params[:grade_for_submission], comment_for_submission: params[:comment_for_submission])&lt;br /&gt;
          render json: { success: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { success: false, errors: @participant.team.errors.full_messages }, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Furthermore, the controller leverages `before_action` callbacks to set the participant before executing certain actions, reducing redundancy and promoting DRY (Don't Repeat Yourself) principles.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class GradesController &amp;lt; ApplicationController&lt;br /&gt;
    before_action :set_participant, only: [:view_my_scores, :view_team, :edit, :update, :save_grade_and_comment_for_submission]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
By defining the `set_participant` method as a callback for actions that require participant data, the controller avoids repetitive code and ensures consistency in handling participant-related tasks across different actions.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    def set_participant&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The use of private helper methods encapsulates logic that is specific to each action, promoting code reuse and modularity. These methods, such as `grading_report_data`, `my_scores_data`, `team_view_data`, `edit_data`, `prepare_feedback_summary`, and `populate_view_models`, encapsulate data preparation and processing tasks, keeping the controller actions focused and concise.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def grading_report_data(assignment, scores)&lt;br /&gt;
        {&lt;br /&gt;
          assignment: assignment,&lt;br /&gt;
          scores: scores,&lt;br /&gt;
          num_reviewers_assigned_scores: scores[:teams].length,&lt;br /&gt;
          average_chart: bar_chart(vector(scores)),&lt;br /&gt;
          avg_of_avg: mean(vector(scores)),&lt;br /&gt;
          penalties: penalties(assignment.id),&lt;br /&gt;
          show_reputation: false&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def my_scores_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          summary: @summary,&lt;br /&gt;
          avg_scores_by_round: @summary.avg_scores_by_round,&lt;br /&gt;
          avg_scores_by_criterion: @summary.avg_scores_by_criterion&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def team_view_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          assignment: @assignment,&lt;br /&gt;
          team: @team,&lt;br /&gt;
          team_id: @team_id,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          penalties: @penalties,&lt;br /&gt;
          vmlist: @vmlist,&lt;br /&gt;
          current_role_name: @current_role_name&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          scores: @scores&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def prepare_feedback_summary&lt;br /&gt;
        summary_ws_url = WEBSERVICE_CONFIG['summary_webservice_url']&lt;br /&gt;
        sum = SummaryHelper::Summary.new.summarize_reviews_by_reviewee(@questions, @participant.assignment, @team_id, summary_ws_url, session)&lt;br /&gt;
        sum.summary&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def populate_view_models&lt;br /&gt;
        vmlist = []&lt;br /&gt;
        counter_for_same_rubric = 0&lt;br /&gt;
        if @assignment.vary_by_topic?&lt;br /&gt;
          topic_id = SignedUpTeam.topic_id_by_team_id(@team_id)&lt;br /&gt;
          topic_specific_questionnaire = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id).first.questionnaire&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(topic_specific_questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        @assignment.questionnaires.each do |questionnaire|&lt;br /&gt;
          @round = nil&lt;br /&gt;
          next if @assignment.vary_by_topic? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
  &lt;br /&gt;
          if @assignment.varying_rubrics_by_round? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
            questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
            if questionnaires.count &amp;gt; 1&lt;br /&gt;
              @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
              counter_for_same_rubric += 1&lt;br /&gt;
            else&lt;br /&gt;
              @round = questionnaires[0].used_in_round&lt;br /&gt;
              counter_for_same_rubric = 0&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        vmlist&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Additionally, the controller follows strong parameter conventions by using the `participant_params` method to permit specific attributes for participant updates. This helps mitigate security risks associated with mass assignment vulnerabilities and ensures that only permitted attributes can be modified through API requests.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def participant_params&lt;br /&gt;
        params.require(:participant).permit(:grade, :other_params)&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155557</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155557"/>
		<updated>2024-04-09T02:30:01Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Initial Attempt in re-implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
== Initial Attempt in re-implementation ==&lt;br /&gt;
&lt;br /&gt;
The initial implementation of the grades_controller in the API namespace enhances the code structure, readability, and maintainability through a series of thoughtful improvements. These changes align with the principles of modularity, reusability, and clarity, ensuring the controller's effectiveness in handling grading-related tasks within the application.&lt;br /&gt;
&lt;br /&gt;
One significant improvement is the organization of controller actions, each serving a specific purpose and adhering to RESTful conventions. Actions such as `view`, `view_my_scores`, `view_team`, `edit`, `update`, and `save_grade_and_comment_for_submission` are clearly defined and encapsulate distinct functionalities. This structured approach enhances code readability and makes it easier to understand the controller's responsibilities at a glance.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def view&lt;br /&gt;
        @assignment = Assignment.find(params[:id])&lt;br /&gt;
        @scores = review_grades(@assignment, retrieve_questions(@assignment.questionnaires, @assignment.id))&lt;br /&gt;
        render json: grading_report_data(@assignment, @scores)&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_my_scores&lt;br /&gt;
        @questions = retrieve_questions(@participant.assignment.questionnaires, @participant.assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        make_chart&lt;br /&gt;
        @summary = prepare_feedback_summary&lt;br /&gt;
        render json: my_scores_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_team&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        @team = @participant.team&lt;br /&gt;
        @team_id = @team.id&lt;br /&gt;
        @questions = retrieve_questions(@assignment.questionnaires, @assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        @penalties = calculate_penalty(@participant.id)&lt;br /&gt;
        @vmlist = populate_view_models&lt;br /&gt;
        @current_role_name = current_role_name&lt;br /&gt;
        render json: team_view_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit&lt;br /&gt;
        @questions = list_questions(@participant.assignment)&lt;br /&gt;
        @scores = participant_scores(@participant, @questions)&lt;br /&gt;
        render json: edit_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def update&lt;br /&gt;
        if @participant.update(participant_params)&lt;br /&gt;
          render json: @participant&lt;br /&gt;
        else&lt;br /&gt;
          render json: @participant.errors, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def save_grade_and_comment_for_submission&lt;br /&gt;
        if @participant.team.update(grade_for_submission: params[:grade_for_submission], comment_for_submission: params[:comment_for_submission])&lt;br /&gt;
          render json: { success: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { success: false, errors: @participant.team.errors.full_messages }, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Furthermore, the controller leverages `before_action` callbacks to set the participant before executing certain actions, reducing redundancy and promoting DRY (Don't Repeat Yourself) principles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class GradesController &amp;lt; ApplicationController&lt;br /&gt;
    before_action :set_participant, only: [:view_my_scores, :view_team, :edit, :update, :save_grade_and_comment_for_submission]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By defining the `set_participant` method as a callback for actions that require participant data, the controller avoids repetitive code and ensures consistency in handling participant-related tasks across different actions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    def set_participant&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The use of private helper methods encapsulates logic that is specific to each action, promoting code reuse and modularity. These methods, such as `grading_report_data`, `my_scores_data`, `team_view_data`, `edit_data`, `prepare_feedback_summary`, and `populate_view_models`, encapsulate data preparation and processing tasks, keeping the controller actions focused and concise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def grading_report_data(assignment, scores)&lt;br /&gt;
        {&lt;br /&gt;
          assignment: assignment,&lt;br /&gt;
          scores: scores,&lt;br /&gt;
          num_reviewers_assigned_scores: scores[:teams].length,&lt;br /&gt;
          average_chart: bar_chart(vector(scores)),&lt;br /&gt;
          avg_of_avg: mean(vector(scores)),&lt;br /&gt;
          penalties: penalties(assignment.id),&lt;br /&gt;
          show_reputation: false&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def my_scores_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          summary: @summary,&lt;br /&gt;
          avg_scores_by_round: @summary.avg_scores_by_round,&lt;br /&gt;
          avg_scores_by_criterion: @summary.avg_scores_by_criterion&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def team_view_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          assignment: @assignment,&lt;br /&gt;
          team: @team,&lt;br /&gt;
          team_id: @team_id,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          penalties: @penalties,&lt;br /&gt;
          vmlist: @vmlist,&lt;br /&gt;
          current_role_name: @current_role_name&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          scores: @scores&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def prepare_feedback_summary&lt;br /&gt;
        summary_ws_url = WEBSERVICE_CONFIG['summary_webservice_url']&lt;br /&gt;
        sum = SummaryHelper::Summary.new.summarize_reviews_by_reviewee(@questions, @participant.assignment, @team_id, summary_ws_url, session)&lt;br /&gt;
        sum.summary&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def populate_view_models&lt;br /&gt;
        vmlist = []&lt;br /&gt;
        counter_for_same_rubric = 0&lt;br /&gt;
        if @assignment.vary_by_topic?&lt;br /&gt;
          topic_id = SignedUpTeam.topic_id_by_team_id(@team_id)&lt;br /&gt;
          topic_specific_questionnaire = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id).first.questionnaire&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(topic_specific_questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        @assignment.questionnaires.each do |questionnaire|&lt;br /&gt;
          @round = nil&lt;br /&gt;
          next if @assignment.vary_by_topic? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
  &lt;br /&gt;
          if @assignment.varying_rubrics_by_round? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
            questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
            if questionnaires.count &amp;gt; 1&lt;br /&gt;
              @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
              counter_for_same_rubric += 1&lt;br /&gt;
            else&lt;br /&gt;
              @round = questionnaires[0].used_in_round&lt;br /&gt;
              counter_for_same_rubric = 0&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        vmlist&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the controller follows strong parameter conventions by using the `participant_params` method to permit specific attributes for participant updates. This helps mitigate security risks associated with mass assignment vulnerabilities and ensures that only permitted attributes can be modified through API requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def participant_params&lt;br /&gt;
        params.require(:participant).permit(:grade, :other_params)&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155555</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155555"/>
		<updated>2024-04-09T02:29:39Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Initial Attempt in re-implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
== Initial Attempt in re-implementation ==&lt;br /&gt;
&lt;br /&gt;
The initial implementation of the grades_controller in the API namespace enhances the code structure, readability, and maintainability through a series of thoughtful improvements. These changes align with the principles of modularity, reusability, and clarity, ensuring the controller's effectiveness in handling grading-related tasks within the application.&lt;br /&gt;
&lt;br /&gt;
One significant improvement is the organization of controller actions, each serving a specific purpose and adhering to RESTful conventions. Actions such as `view`, `view_my_scores`, `view_team`, `edit`, `update`, and `save_grade_and_comment_for_submission` are clearly defined and encapsulate distinct functionalities. This structured approach enhances code readability and makes it easier to understand the controller's responsibilities at a glance.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def view&lt;br /&gt;
        @assignment = Assignment.find(params[:id])&lt;br /&gt;
        @scores = review_grades(@assignment, retrieve_questions(@assignment.questionnaires, @assignment.id))&lt;br /&gt;
        render json: grading_report_data(@assignment, @scores)&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_my_scores&lt;br /&gt;
        @questions = retrieve_questions(@participant.assignment.questionnaires, @participant.assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        make_chart&lt;br /&gt;
        @summary = prepare_feedback_summary&lt;br /&gt;
        render json: my_scores_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_team&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        @team = @participant.team&lt;br /&gt;
        @team_id = @team.id&lt;br /&gt;
        @questions = retrieve_questions(@assignment.questionnaires, @assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        @penalties = calculate_penalty(@participant.id)&lt;br /&gt;
        @vmlist = populate_view_models&lt;br /&gt;
        @current_role_name = current_role_name&lt;br /&gt;
        render json: team_view_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit&lt;br /&gt;
        @questions = list_questions(@participant.assignment)&lt;br /&gt;
        @scores = participant_scores(@participant, @questions)&lt;br /&gt;
        render json: edit_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def update&lt;br /&gt;
        if @participant.update(participant_params)&lt;br /&gt;
          render json: @participant&lt;br /&gt;
        else&lt;br /&gt;
          render json: @participant.errors, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def save_grade_and_comment_for_submission&lt;br /&gt;
        if @participant.team.update(grade_for_submission: params[:grade_for_submission], comment_for_submission: params[:comment_for_submission])&lt;br /&gt;
          render json: { success: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { success: false, errors: @participant.team.errors.full_messages }, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Furthermore, the controller leverages `before_action` callbacks to set the participant before executing certain actions, reducing redundancy and promoting DRY (Don't Repeat Yourself) principles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class GradesController &amp;lt; ApplicationController&lt;br /&gt;
    before_action :set_participant, only: [:view_my_scores, :view_team, :edit, :update, :save_grade_and_comment_for_submission]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By defining the `set_participant` method as a callback for actions that require participant data, the controller avoids repetitive code and ensures consistency in handling participant-related tasks across different actions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    def set_participant&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The use of private helper methods encapsulates logic that is specific to each action, promoting code reuse and modularity. These methods, such as `grading_report_data`, `my_scores_data`, `team_view_data`, `edit_data`, `prepare_feedback_summary`, and `populate_view_models`, encapsulate data preparation and processing tasks, keeping the controller actions focused and concise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def grading_report_data(assignment, scores)&lt;br /&gt;
        {&lt;br /&gt;
          assignment: assignment,&lt;br /&gt;
          scores: scores,&lt;br /&gt;
          num_reviewers_assigned_scores: scores[:teams].length,&lt;br /&gt;
          average_chart: bar_chart(vector(scores)),&lt;br /&gt;
          avg_of_avg: mean(vector(scores)),&lt;br /&gt;
          penalties: penalties(assignment.id),&lt;br /&gt;
          show_reputation: false&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def my_scores_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          summary: @summary,&lt;br /&gt;
          avg_scores_by_round: @summary.avg_scores_by_round,&lt;br /&gt;
          avg_scores_by_criterion: @summary.avg_scores_by_criterion&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def team_view_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          assignment: @assignment,&lt;br /&gt;
          team: @team,&lt;br /&gt;
          team_id: @team_id,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          penalties: @penalties,&lt;br /&gt;
          vmlist: @vmlist,&lt;br /&gt;
          current_role_name: @current_role_name&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          scores: @scores&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def prepare_feedback_summary&lt;br /&gt;
        summary_ws_url = WEBSERVICE_CONFIG['summary_webservice_url']&lt;br /&gt;
        sum = SummaryHelper::Summary.new.summarize_reviews_by_reviewee(@questions, @participant.assignment, @team_id, summary_ws_url, session)&lt;br /&gt;
        sum.summary&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def populate_view_models&lt;br /&gt;
        vmlist = []&lt;br /&gt;
        counter_for_same_rubric = 0&lt;br /&gt;
        if @assignment.vary_by_topic?&lt;br /&gt;
          topic_id = SignedUpTeam.topic_id_by_team_id(@team_id)&lt;br /&gt;
          topic_specific_questionnaire = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id).first.questionnaire&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(topic_specific_questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        @assignment.questionnaires.each do |questionnaire|&lt;br /&gt;
          @round = nil&lt;br /&gt;
          next if @assignment.vary_by_topic? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
  &lt;br /&gt;
          if @assignment.varying_rubrics_by_round? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
            questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
            if questionnaires.count &amp;gt; 1&lt;br /&gt;
              @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
              counter_for_same_rubric += 1&lt;br /&gt;
            else&lt;br /&gt;
              @round = questionnaires[0].used_in_round&lt;br /&gt;
              counter_for_same_rubric = 0&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        vmlist&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the controller follows strong parameter conventions by using the `participant_params` method to permit specific attributes for participant updates. This helps mitigate security risks associated with mass assignment vulnerabilities and ensures that only permitted attributes can be modified through API requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def participant_params&lt;br /&gt;
        params.require(:participant).permit(:grade, :other_params)&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155552</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155552"/>
		<updated>2024-04-09T02:28:05Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added initial implementation details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
== Initial Attempt in re-implementation ==&lt;br /&gt;
&lt;br /&gt;
The initial implementation of the grades_controller in the API namespace enhances the code structure, readability, and maintainability through a series of thoughtful improvements. These changes align with the principles of modularity, reusability, and clarity, ensuring the controller's effectiveness in handling grading-related tasks within the application.&lt;br /&gt;
&lt;br /&gt;
One significant improvement is the organization of controller actions, each serving a specific purpose and adhering to RESTful conventions. Actions such as `view`, `view_my_scores`, `view_team`, `edit`, `update`, and `save_grade_and_comment_for_submission` are clearly defined and encapsulate distinct functionalities. This structured approach enhances code readability and makes it easier to understand the controller's responsibilities at a glance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def view&lt;br /&gt;
        @assignment = Assignment.find(params[:id])&lt;br /&gt;
        @scores = review_grades(@assignment, retrieve_questions(@assignment.questionnaires, @assignment.id))&lt;br /&gt;
        render json: grading_report_data(@assignment, @scores)&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_my_scores&lt;br /&gt;
        @questions = retrieve_questions(@participant.assignment.questionnaires, @participant.assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        make_chart&lt;br /&gt;
        @summary = prepare_feedback_summary&lt;br /&gt;
        render json: my_scores_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def view_team&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        @team = @participant.team&lt;br /&gt;
        @team_id = @team.id&lt;br /&gt;
        @questions = retrieve_questions(@assignment.questionnaires, @assignment.id)&lt;br /&gt;
        @pscore = participant_scores(@participant, @questions)&lt;br /&gt;
        @penalties = calculate_penalty(@participant.id)&lt;br /&gt;
        @vmlist = populate_view_models&lt;br /&gt;
        @current_role_name = current_role_name&lt;br /&gt;
        render json: team_view_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit&lt;br /&gt;
        @questions = list_questions(@participant.assignment)&lt;br /&gt;
        @scores = participant_scores(@participant, @questions)&lt;br /&gt;
        render json: edit_data&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def update&lt;br /&gt;
        if @participant.update(participant_params)&lt;br /&gt;
          render json: @participant&lt;br /&gt;
        else&lt;br /&gt;
          render json: @participant.errors, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def save_grade_and_comment_for_submission&lt;br /&gt;
        if @participant.team.update(grade_for_submission: params[:grade_for_submission], comment_for_submission: params[:comment_for_submission])&lt;br /&gt;
          render json: { success: true }&lt;br /&gt;
        else&lt;br /&gt;
          render json: { success: false, errors: @participant.team.errors.full_messages }, status: :unprocessable_entity&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore, the controller leverages `before_action` callbacks to set the participant before executing certain actions, reducing redundancy and promoting DRY (Don't Repeat Yourself) principles.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    class GradesController &amp;lt; ApplicationController&lt;br /&gt;
      before_action :set_participant, only: [:view_my_scores, :view_team, :edit, :update, :save_grade_and_comment_for_submission]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By defining the `set_participant` method as a callback for actions that require participant data, the controller avoids repetitive code and ensures consistency in handling participant-related tasks across different actions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
def set_participant&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The use of private helper methods encapsulates logic that is specific to each action, promoting code reuse and modularity. These methods, such as `grading_report_data`, `my_scores_data`, `team_view_data`, `edit_data`, `prepare_feedback_summary`, and `populate_view_models`, encapsulate data preparation and processing tasks, keeping the controller actions focused and concise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def grading_report_data(assignment, scores)&lt;br /&gt;
        {&lt;br /&gt;
          assignment: assignment,&lt;br /&gt;
          scores: scores,&lt;br /&gt;
          num_reviewers_assigned_scores: scores[:teams].length,&lt;br /&gt;
          average_chart: bar_chart(vector(scores)),&lt;br /&gt;
          avg_of_avg: mean(vector(scores)),&lt;br /&gt;
          penalties: penalties(assignment.id),&lt;br /&gt;
          show_reputation: false&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def my_scores_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          summary: @summary,&lt;br /&gt;
          avg_scores_by_round: @summary.avg_scores_by_round,&lt;br /&gt;
          avg_scores_by_criterion: @summary.avg_scores_by_criterion&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def team_view_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          assignment: @assignment,&lt;br /&gt;
          team: @team,&lt;br /&gt;
          team_id: @team_id,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          pscore: @pscore,&lt;br /&gt;
          penalties: @penalties,&lt;br /&gt;
          vmlist: @vmlist,&lt;br /&gt;
          current_role_name: @current_role_name&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def edit_data&lt;br /&gt;
        {&lt;br /&gt;
          participant: @participant,&lt;br /&gt;
          questions: @questions,&lt;br /&gt;
          scores: @scores&lt;br /&gt;
        }&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def prepare_feedback_summary&lt;br /&gt;
        summary_ws_url = WEBSERVICE_CONFIG['summary_webservice_url']&lt;br /&gt;
        sum = SummaryHelper::Summary.new.summarize_reviews_by_reviewee(@questions, @participant.assignment, @team_id, summary_ws_url, session)&lt;br /&gt;
        sum.summary&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      def populate_view_models&lt;br /&gt;
        vmlist = []&lt;br /&gt;
        counter_for_same_rubric = 0&lt;br /&gt;
        if @assignment.vary_by_topic?&lt;br /&gt;
          topic_id = SignedUpTeam.topic_id_by_team_id(@team_id)&lt;br /&gt;
          topic_specific_questionnaire = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id).first.questionnaire&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(topic_specific_questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        @assignment.questionnaires.each do |questionnaire|&lt;br /&gt;
          @round = nil&lt;br /&gt;
          next if @assignment.vary_by_topic? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
  &lt;br /&gt;
          if @assignment.varying_rubrics_by_round? &amp;amp;&amp;amp; questionnaire.type == 'ReviewQuestionnaire'&lt;br /&gt;
            questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
            if questionnaires.count &amp;gt; 1&lt;br /&gt;
              @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
              counter_for_same_rubric += 1&lt;br /&gt;
            else&lt;br /&gt;
              @round = questionnaires[0].used_in_round&lt;br /&gt;
              counter_for_same_rubric = 0&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          vmlist &amp;lt;&amp;lt; populate_view_model(questionnaire)&lt;br /&gt;
        end&lt;br /&gt;
        vmlist&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the controller follows strong parameter conventions by using the `participant_params` method to permit specific attributes for participant updates. This helps mitigate security risks associated with mass assignment vulnerabilities and ensures that only permitted attributes can be modified through API requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
      def participant_params&lt;br /&gt;
        params.require(:participant).permit(:grade, :other_params)&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155389</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155389"/>
		<updated>2024-04-09T01:07:11Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Code Clarity: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155026</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=155026"/>
		<updated>2024-04-08T18:44:39Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Plan for Reimplementation of GradesController */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Code Clarity:====&lt;br /&gt;
&lt;br /&gt;
Existing methods such as &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; will undergo refinement to improve clarity and readability. This includes adding inline comments within complex methods to provide better understanding. Additionally, loops within &amp;lt;code&amp;gt;populate_view_model&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; will be streamlined for improved performance, while conditional statements within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be simplified for easier comprehension.&lt;br /&gt;
&lt;br /&gt;
====Authorization Logic:====&lt;br /&gt;
&lt;br /&gt;
Authorization logic within controller actions will be refined to simplify the process and improve error handling. This involves extracting authorization concerns into separate methods like &amp;lt;code&amp;gt;student_privileges_allowed?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ta_privileges_allowed?&amp;lt;/code&amp;gt;, etc. Furthermore, error messages within &amp;lt;code&amp;gt;action_allowed?&amp;lt;/code&amp;gt; will be enhanced to provide clearer feedback to users in case of access denial.&lt;br /&gt;
&lt;br /&gt;
====View Method Optimization:====&lt;br /&gt;
&lt;br /&gt;
In view methods like &amp;lt;code&amp;gt;view&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;view_my_scores&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;, efforts will be made to streamline code and reduce dependencies. This includes optimizing database queries to improve performance and removing redundant code to enhance maintainability. &lt;br /&gt;
&lt;br /&gt;
====Edit and Update Actions:====&lt;br /&gt;
&lt;br /&gt;
Edit and update actions such as &amp;lt;code&amp;gt;edit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; will be enhanced to adhere to RESTful conventions. Specifically, parameter handling will be simplified to ensure consistency and robust error handling will be implemented to gracefully handle invalid input.&lt;br /&gt;
&lt;br /&gt;
====Chart Generation Optimization:====&lt;br /&gt;
&lt;br /&gt;
Chart generation methods will be optimized to improve efficiency and scalability. This includes implementing caching mechanisms for precomputed data within &amp;lt;code&amp;gt;make_chart&amp;lt;/code&amp;gt; to enhance responsiveness. Additionally, exploration of client-side rendering using JavaScript libraries like Chart.js will be considered to further improve performance.&lt;br /&gt;
&lt;br /&gt;
====Self-Review Logic Enhancement:====&lt;br /&gt;
&lt;br /&gt;
Self-review logic within &amp;lt;code&amp;gt;self_review_finished?&amp;lt;/code&amp;gt; will undergo validation to ensure accuracy and effectiveness. This includes refining edge cases where self-review completion may not be accurately detected and enhancing user guidance for a smoother experience.&lt;br /&gt;
&lt;br /&gt;
====Redirection Logic Improvement:====&lt;br /&gt;
&lt;br /&gt;
Redirection logic within &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; will be improved to simplify and consolidate redirection processes. This involves enhancing error handling to provide clearer feedback to users and optimizing redirection logic to minimize unnecessary redirects.&lt;br /&gt;
&lt;br /&gt;
====Comprehensive Testing with RSwag:====&lt;br /&gt;
&lt;br /&gt;
Comprehensive testing with RSwag will be conducted to validate API endpoints and ensure thorough test coverage. This includes writing tests for each controller method, covering both positive and negative test cases, and integrating automated testing into the CI pipeline for consistency and reliability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154997</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154997"/>
		<updated>2024-04-08T17:33:13Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
==== Enhancing Code Clarity: ==== &lt;br /&gt;
*Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.&lt;br /&gt;
*Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.&lt;br /&gt;
*Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.&lt;br /&gt;
&lt;br /&gt;
==== Removing Unused Methods: ==== &lt;br /&gt;
*Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.&lt;br /&gt;
*Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.&lt;br /&gt;
*Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.&lt;br /&gt;
&lt;br /&gt;
==== Refactor Action Allowed Logic: ==== &lt;br /&gt;
*Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.&lt;br /&gt;
*Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.&lt;br /&gt;
*Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.&lt;br /&gt;
&lt;br /&gt;
==== Consolidate Helper Modules: ==== &lt;br /&gt;
*Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.&lt;br /&gt;
*Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.&lt;br /&gt;
*Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Streamline View Methods: ==== &lt;br /&gt;
*Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.&lt;br /&gt;
*Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==== Update Edit and Update Actions: ==== &lt;br /&gt;
*Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.&lt;br /&gt;
*Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.&lt;br /&gt;
*Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.&lt;br /&gt;
&lt;br /&gt;
==== Optimize Chart Generation: ==== &lt;br /&gt;
*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.&lt;br /&gt;
*Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==== Enhance Self-Review Logic: ==== &lt;br /&gt;
*Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.&lt;br /&gt;
*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.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==== Improve Redirect Logic: ==== &lt;br /&gt;
*Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.&lt;br /&gt;
*Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==== Comprehensive Testing with RSwag: ==== &lt;br /&gt;
*Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.&lt;br /&gt;
*Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
*Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
*Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
*For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
*Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
*Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
*Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
*Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
*The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
*Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
*Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
*CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
*RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
*Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
*Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
*Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
*Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
*Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
*API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
*Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
*Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
*Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
*API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
*Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154883</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154883"/>
		<updated>2024-04-07T20:00:44Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added Design Principles to be followed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
=== Enhancing Code Clarity: === &lt;br /&gt;
*Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.&lt;br /&gt;
*Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.&lt;br /&gt;
*Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.&lt;br /&gt;
&lt;br /&gt;
=== Removing Unused Methods: === &lt;br /&gt;
*Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.&lt;br /&gt;
*Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.&lt;br /&gt;
*Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.&lt;br /&gt;
&lt;br /&gt;
=== Refactor Action Allowed Logic: === &lt;br /&gt;
*Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.&lt;br /&gt;
*Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.&lt;br /&gt;
*Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.&lt;br /&gt;
&lt;br /&gt;
=== Consolidate Helper Modules: === &lt;br /&gt;
*Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.&lt;br /&gt;
*Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.&lt;br /&gt;
*Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.&lt;br /&gt;
&lt;br /&gt;
=== Streamline View Methods: === &lt;br /&gt;
*Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.&lt;br /&gt;
*Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Update Edit and Update Actions: === &lt;br /&gt;
*Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.&lt;br /&gt;
*Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.&lt;br /&gt;
*Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.&lt;br /&gt;
&lt;br /&gt;
=== Optimize Chart Generation: === &lt;br /&gt;
*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.&lt;br /&gt;
*Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Enhance Self-Review Logic: === &lt;br /&gt;
*Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.&lt;br /&gt;
*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.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Improve Redirect Logic: === &lt;br /&gt;
*Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.&lt;br /&gt;
*Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Comprehensive Testing with RSwag: === &lt;br /&gt;
*Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.&lt;br /&gt;
*Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
==== Single Responsibility Principle (SRP): ====&lt;br /&gt;
- Each action in the GradesController will be responsible for a specific task related to managing grades.&lt;br /&gt;
- Actions will be refactored to separate concerns such as data retrieval, computation, and view rendering.&lt;br /&gt;
- For example, the `view` action will focus solely on retrieving grading data and rendering the grading report.&lt;br /&gt;
&lt;br /&gt;
==== Don't Repeat Yourself (DRY) Principle: ====&lt;br /&gt;
- Code duplication in the GradesController will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
- Repetitive logic, such as retrieving questions or calculating penalties, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
==== Encapsulation: ====&lt;br /&gt;
- Data and behavior within the GradesController will be encapsulated within appropriate methods and classes to minimize dependencies.&lt;br /&gt;
- Access to instance variables and controller actions will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
==== Dependency Inversion Principle (DIP): ====&lt;br /&gt;
- The GradesController will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
- Dependency injection or inversion of control will be used to decouple the controller from specific database or service implementations.&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==== Integration Testing: ====&lt;br /&gt;
- Integration tests using RSwag will be written to verify the behavior of each controller action, including `view`, `view_my_scores`, and `view_team`.&lt;br /&gt;
- CRUD operations (Create, Read, Update, Delete) will be tested to ensure proper data management and interaction with the database.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI Integration: ====&lt;br /&gt;
- RSwag will be integrated with Swagger UI to provide a user-friendly interface for interacting with API endpoints.&lt;br /&gt;
- Swagger UI will accurately reflect the API documentation and allow users to test endpoints interactively.&lt;br /&gt;
&lt;br /&gt;
==== Parameter Validation: ====&lt;br /&gt;
- Endpoint parameters, such as assignment IDs and participant IDs, will be tested with various input values to ensure proper handling and error reporting.&lt;br /&gt;
- Input parameters such as IDs, query parameters, and request bodies will be validated to ensure data integrity.&lt;br /&gt;
&lt;br /&gt;
==== Error Handling: ====&lt;br /&gt;
- Error handling scenarios, including validation errors, resource not found, unauthorized access, and server errors, will be tested.&lt;br /&gt;
- Error responses will contain appropriate status codes, error messages, and error details as per the API contract.&lt;br /&gt;
&lt;br /&gt;
==== Security Testing: ====&lt;br /&gt;
- API endpoints will be assessed for vulnerabilities such as SQL injection, cross-site scripting (XSS), and sensitive data exposure.&lt;br /&gt;
- Authentication and authorization mechanisms will be evaluated for effectiveness to ensure secure access to grading functionalities.&lt;br /&gt;
&lt;br /&gt;
==== Performance Testing: ====&lt;br /&gt;
- Performance of API endpoints under various load conditions will be evaluated using tools like JMeter or Gatling.&lt;br /&gt;
- Response times, throughput, and resource utilization will be measured to identify performance bottlenecks and optimize critical paths.&lt;br /&gt;
&lt;br /&gt;
==== Documentation Verification: ====&lt;br /&gt;
- API documentation generated by RSwag will be validated to accurately reflect implemented endpoints, parameters, and responses.&lt;br /&gt;
- Documentation will be kept up-to-date and aligned with the behavior of API endpoints.&lt;br /&gt;
&lt;br /&gt;
By following these design principles and testing strategies, the reimplementation of the GradesController will result in a well-designed, maintainable, and thoroughly tested component, meeting project requirements effectively.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154882</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154882"/>
		<updated>2024-04-07T19:54:54Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Plan for Reimplementation of GradesController */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
=== Enhancing Code Clarity: === &lt;br /&gt;
*Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.&lt;br /&gt;
*Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.&lt;br /&gt;
*Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.&lt;br /&gt;
&lt;br /&gt;
=== Removing Unused Methods: === &lt;br /&gt;
*Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.&lt;br /&gt;
*Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.&lt;br /&gt;
*Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.&lt;br /&gt;
&lt;br /&gt;
=== Refactor Action Allowed Logic: === &lt;br /&gt;
*Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.&lt;br /&gt;
*Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.&lt;br /&gt;
*Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.&lt;br /&gt;
&lt;br /&gt;
=== Consolidate Helper Modules: === &lt;br /&gt;
*Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.&lt;br /&gt;
*Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.&lt;br /&gt;
*Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.&lt;br /&gt;
&lt;br /&gt;
=== Streamline View Methods: === &lt;br /&gt;
*Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.&lt;br /&gt;
*Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Update Edit and Update Actions: === &lt;br /&gt;
*Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.&lt;br /&gt;
*Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.&lt;br /&gt;
*Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.&lt;br /&gt;
&lt;br /&gt;
=== Optimize Chart Generation: === &lt;br /&gt;
*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.&lt;br /&gt;
*Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Enhance Self-Review Logic: === &lt;br /&gt;
*Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.&lt;br /&gt;
*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.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Improve Redirect Logic: === &lt;br /&gt;
*Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.&lt;br /&gt;
*Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== Comprehensive Testing with RSwag: === &lt;br /&gt;
*Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.&lt;br /&gt;
*Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154881</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154881"/>
		<updated>2024-04-07T19:54:14Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Plan for Reimplementation of GradesController */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.&lt;br /&gt;
*Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.&lt;br /&gt;
*Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Removing Unused Methods:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.&lt;br /&gt;
*Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.&lt;br /&gt;
*Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Refactor Action Allowed Logic:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.&lt;br /&gt;
*Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.&lt;br /&gt;
*Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Consolidate Helper Modules:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.&lt;br /&gt;
*Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.&lt;br /&gt;
*Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Streamline View Methods:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.&lt;br /&gt;
*Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Update Edit and Update Actions:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.&lt;br /&gt;
*Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.&lt;br /&gt;
*Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Optimize Chart Generation:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*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.&lt;br /&gt;
*Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Enhance Self-Review Logic:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.&lt;br /&gt;
*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.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Improve Redirect Logic:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.&lt;br /&gt;
*Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;b&amp;gt;Comprehensive Testing with RSwag:&amp;lt;/b&amp;gt; === &lt;br /&gt;
*Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.&lt;br /&gt;
*Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154879</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154879"/>
		<updated>2024-04-07T19:50:55Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Plan for Reimplementation of GradesController */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.&lt;br /&gt;
*Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.&lt;br /&gt;
*Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Removing Unused Methods:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.&lt;br /&gt;
*Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.&lt;br /&gt;
*Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Refactor Action Allowed Logic:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.&lt;br /&gt;
*Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.&lt;br /&gt;
*Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Consolidate Helper Modules:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.&lt;br /&gt;
*Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.&lt;br /&gt;
*Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Streamline View Methods:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.&lt;br /&gt;
*Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Update Edit and Update Actions:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.&lt;br /&gt;
*Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.&lt;br /&gt;
*Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Optimize Chart Generation:&amp;lt;/b&amp;gt;&lt;br /&gt;
*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.&lt;br /&gt;
*Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Enhance Self-Review Logic:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.&lt;br /&gt;
*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.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Improve Redirect Logic:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.&lt;br /&gt;
*Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Comprehensive Testing with RSwag:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.&lt;br /&gt;
*Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Create Video Demonstration:&amp;lt;/b&amp;gt;&lt;br /&gt;
*Record demonstration: Create a video demonstrating the integration of Swagger UI with the reimplemented GradesController, showcasing various features and endpoints.&lt;br /&gt;
*Usage examples: Include usage examples and best practices for interacting with the API endpoints via Swagger UI, guiding users through the process effectively.&lt;br /&gt;
*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.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154877</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154877"/>
		<updated>2024-04-07T19:49:29Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added future plan&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of GradesController==&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Rename ambiguous methods: Identify and rename methods like `review_grades`, `penalties`, and `make_chart` to reflect their specific functionalities.&lt;br /&gt;
# - Add comments: Document complex logic within methods like `action_allowed?`, `view_my_scores`, and `view_team` to improve understanding for future developers.&lt;br /&gt;
# - Simplify loops: Optimize loops within methods like `populate_view_model` and `make_chart` for better readability and performance.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Removing Unused Methods:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Identify unused methods: Analyze the codebase to find methods like `instructor_review` and `assign_all_penalties` that are no longer being called.&lt;br /&gt;
# - Remove redundant code: Eliminate redundant methods to reduce complexity, such as `list_questions` which duplicates functionality already present in `retrieve_questions`.&lt;br /&gt;
# - Update dependencies: Ensure that any removed methods do not impact other parts of the application and update references accordingly.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Refactor Action Allowed Logic:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Simplify conditionals: Revisit the `action_allowed?` method and simplify conditionals by extracting complex checks into separate helper methods.&lt;br /&gt;
# - Separate concerns: Extract logic related to authorization checks into separate methods, such as `student_privileges_allowed?`, `ta_privileges_allowed?`, etc.&lt;br /&gt;
# - Improve error handling: Enhance error messages within the `action_allowed?` method to provide clear feedback to users when access is denied.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Consolidate Helper Modules:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Identify common functionality: Identify helper modules like `PenaltyHelper` and `GradesHelper` with overlapping functionality.&lt;br /&gt;
# - Merge similar modules: Consolidate related helper methods into a single module (e.g., `GradingHelper`) to reduce redundancy and improve organization.&lt;br /&gt;
# - Update references: Update references to consolidated modules throughout the codebase to ensure consistency and maintainability.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Streamline View Methods:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Simplify view logic: Refactor view methods like `view`, `view_my_scores`, and `view_team` to remove unnecessary complexity and improve readability.&lt;br /&gt;
# - Reduce dependencies: Minimize dependencies within view methods by extracting reusable logic into helper methods and partials.&lt;br /&gt;
# - 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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Update Edit and Update Actions:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Adhere to RESTful conventions: Ensure that edit and update actions follow RESTful conventions by renaming them to `edit` and `update`.&lt;br /&gt;
# - Simplify parameter handling: Streamline parameter handling within edit and update actions to reduce complexity and improve clarity, avoiding redundant checks.&lt;br /&gt;
# - Implement error handling: Enhance error handling within edit and update actions to handle invalid input gracefully and provide informative error messages to users.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Optimize Chart Generation:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - 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.&lt;br /&gt;
# - Cache chart data: Implement caching mechanisms to store precomputed chart data and minimize redundant calculations, improving performance and responsiveness.&lt;br /&gt;
# - 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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Enhance Self-Review Logic:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Review self-review workflow: Evaluate the current self-review logic for accuracy and reliability, ensuring that all edge cases are handled correctly.&lt;br /&gt;
# - 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.&lt;br /&gt;
# - 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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Improve Redirect Logic:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Refactor redirect logic: Simplify and consolidate logic within the `redirect_when_disallowed` method for better maintainability and readability.&lt;br /&gt;
# - Enhance error handling: Improve error handling within the `redirect_when_disallowed` method to handle unexpected scenarios gracefully, providing informative feedback to users.&lt;br /&gt;
# - 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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Comprehensive Testing with RSwag:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Write RSwag tests: Develop comprehensive RSwag tests for every controller method, covering both positive and negative test cases, including edge cases and boundary conditions.&lt;br /&gt;
# - Automate testing: Integrate automated testing into the CI pipeline to execute RSwag tests automatically on each code commit, ensuring consistent and reliable test coverage.&lt;br /&gt;
# - 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.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Create Video Demonstration:&amp;lt;/b&amp;gt;&lt;br /&gt;
# - Record demonstration: Create a video demonstrating the integration of Swagger UI with the reimplemented GradesController, showcasing various features and endpoints.&lt;br /&gt;
# - Usage examples: Include usage examples and best practices for interacting with the API endpoints via Swagger UI, guiding users through the process effectively.&lt;br /&gt;
# - 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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154862</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154862"/>
		<updated>2024-04-07T17:34:04Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154861</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154861"/>
		<updated>2024-04-07T17:33:33Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added team&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kashika Malick&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
*Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
*Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154860</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154860"/>
		<updated>2024-04-07T16:54:55Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added table of contents&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154859</id>
		<title>CSC/ECE 517 Spring 2024 - E2443 Reimplement grades controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2443_Reimplement_grades_controller&amp;diff=154859"/>
		<updated>2024-04-07T16:54:21Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Initial content about E2443&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring Grades Controller:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing loops, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;CRUD Operations:&amp;lt;/b&amp;gt; Implementing CRUD operations (Create, Read, Update, Delete) in the controller for efficient data management.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with RSwag:&amp;lt;/b&amp;gt; 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.&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=154858</id>
		<title>CSC/ECE 517 Spring 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=154858"/>
		<updated>2024-04-07T16:53:17Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added E2443 Reimplement grades_controller&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2024 - E2401 Implementing and testing import &amp;amp; export controllers]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2405 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2407 Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2428 Replicate Roles and Institution UIs ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2429 Reimplement student_task list]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2430 Reimplement student_task view]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding ]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2414 Grading Audit Trail]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - NTNX-1 : Extend NDB Operator to Support Postgres HA]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - ‬NTNX-2‬‭ : Snapshot Functionality for provisioned databases]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2411 : Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2416.  Reimplement the Question hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2420. Reimplement student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2424. Reimplement the Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2426. Create a UI for Assignment Edit page &amp;quot;Etc&amp;quot; tab in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2417. Reimplement submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2425. Create a Courses user interface in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2431. Reimplement  grades/view_team]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2404 Refactor student teams functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2406 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2421. Reimplement impersonating users (within impersonate controller.rb)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2413. Testing - Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2412. Testing for hamer.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2427. UI for questionnaire.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2419. Reimplement duties controller.rb and badges controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2432. UI for Participants.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2402 Implement REST client, REST API, and Graphql API endpoint for repositories]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2400 DevOp for GitHub Miner app]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2439 Testing for view_translation_substitutor.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2443 Reimplement grades_controller]]&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154689</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154689"/>
		<updated>2024-03-26T01:16:55Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Peer Review Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample data has been added to the assignments table for the purpose of testing. Only essential information necessary for display has been included, resulting in a subset of the available columns being populated. Specifically, two rows of sample data have been entered. The provided sample data can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 4,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program5&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: null,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 5,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program6&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: &amp;quot;http://example.com/assignment_spec&amp;quot;,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: 3,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Design Principles ===&lt;br /&gt;
In adherence to software design principles, the codebase upholds the Single Responsibility Principle (SRP), emphasizing that each component or function should serve a singular purpose to minimize the need for changes. Additionally, the concept of Separation of Concerns is applied, whereby the logic is segmented into smaller, more manageable functions to enhance maintainability. Dependency Injection is implemented, ensuring that dependencies such as assignments and authorization are passed as arguments rather than accessed directly. Notably, specific functions like checkShowWork, checkReviewAvailability, and checkReviewableTopics from the StudentTaskView file are extracted to improve readability and testability, while the renderDeadline function enhances code readability and maintainability by handling deadline rendering tasks.&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function. Each deadline displayed in the scrollbar turns red once it has passed, enhancing assignment tracking and progress monitoring. The &amp;quot;Your Work&amp;quot; link remains active only when the next deadline is for submitting the assignment; otherwise, it becomes inactive for reviewing assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Admin credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
The expertiza application can be accessed by running the front end and back end simultaneously on your local laptop. The instructions on how to run the application is on the respective repositories.&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154630</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154630"/>
		<updated>2024-03-25T03:51:39Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Student Task View Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample data has been added to the assignments table for the purpose of testing. Only essential information necessary for display has been included, resulting in a subset of the available columns being populated. Specifically, two rows of sample data have been entered. The provided sample data can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 4,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program5&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: null,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 5,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program6&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: &amp;quot;http://example.com/assignment_spec&amp;quot;,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: 3,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Design Principles ===&lt;br /&gt;
In adherence to software design principles, the codebase upholds the Single Responsibility Principle (SRP), emphasizing that each component or function should serve a singular purpose to minimize the need for changes. Additionally, the concept of Separation of Concerns is applied, whereby the logic is segmented into smaller, more manageable functions to enhance maintainability. Dependency Injection is implemented, ensuring that dependencies such as assignments and authorization are passed as arguments rather than accessed directly. Notably, specific functions like checkShowWork, checkReviewAvailability, and checkReviewableTopics from the StudentTaskView file are extracted to improve readability and testability, while the renderDeadline function enhances code readability and maintainability by handling deadline rendering tasks.&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function. Each deadline displayed in the scrollbar turns red once it has passed, enhancing assignment tracking and progress monitoring. The &amp;quot;Your Work&amp;quot; link remains active only when the next deadline is for submitting the assignment; otherwise, it becomes inactive for reviewing assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Admin credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154623</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154623"/>
		<updated>2024-03-25T03:41:20Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Design Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample data has been added to the assignments table for the purpose of testing. Only essential information necessary for display has been included, resulting in a subset of the available columns being populated. Specifically, two rows of sample data have been entered. The provided sample data can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 4,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program5&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: null,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 5,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program6&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: &amp;quot;http://example.com/assignment_spec&amp;quot;,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: 3,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Design Principles ===&lt;br /&gt;
In adherence to software design principles, the codebase upholds the Single Responsibility Principle (SRP), emphasizing that each component or function should serve a singular purpose to minimize the need for changes. Additionally, the concept of Separation of Concerns is applied, whereby the logic is segmented into smaller, more manageable functions to enhance maintainability. Dependency Injection is implemented, ensuring that dependencies such as assignments and authorization are passed as arguments rather than accessed directly. Notably, specific functions like checkShowWork, checkReviewAvailability, and checkReviewableTopics from the StudentTaskView file are extracted to improve readability and testability, while the renderDeadline function enhances code readability and maintainability by handling deadline rendering tasks.&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Admin credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154622</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154622"/>
		<updated>2024-03-25T03:40:44Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added design principles&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample data has been added to the assignments table for the purpose of testing. Only essential information necessary for display has been included, resulting in a subset of the available columns being populated. Specifically, two rows of sample data have been entered. The provided sample data can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 4,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program5&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: null,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 5,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program6&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: &amp;quot;http://example.com/assignment_spec&amp;quot;,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: 3,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Design Principles ===&lt;br /&gt;
In adherence to software design principles, the codebase upholds the Single Responsibility Principle (SRP), emphasizing that each component or function should serve a singular purpose to minimize the need for changes. Additionally, the concept of Separation of Concerns is applied, whereby the logic is segmented into smaller, more manageable functions to enhance maintainability. Dependency Injection is implemented, ensuring that dependencies such as assignments and authorization are passed as arguments rather than accessed directly. Notably, specific functions like checkShowWork, checkReviewAvailability, and checkReviewableTopics are extracted to improve readability and testability, while the renderDeadline function enhances code readability and maintainability by handling deadline rendering tasks. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Admin credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154620</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154620"/>
		<updated>2024-03-25T03:38:05Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Sample Data Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample data has been added to the assignments table for the purpose of testing. Only essential information necessary for display has been included, resulting in a subset of the available columns being populated. Specifically, two rows of sample data have been entered. The provided sample data can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 4,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program5&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: null,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;id&amp;quot;: 5,&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;program6&amp;quot;,&lt;br /&gt;
    &amp;quot;directory_path&amp;quot;: null,&lt;br /&gt;
    &amp;quot;submitter_count&amp;quot;: null,&lt;br /&gt;
    &amp;quot;course_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;instructor_id&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;private&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_review_of_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reviews_visible_to_all&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviewers&amp;quot;: null,&lt;br /&gt;
    &amp;quot;spec_location&amp;quot;: &amp;quot;http://example.com/assignment_spec&amp;quot;,&lt;br /&gt;
    &amp;quot;max_team_size&amp;quot;: 3,&lt;br /&gt;
    &amp;quot;staggered_deadline&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_suggestions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;days_between_submissions&amp;quot;: 15,&lt;br /&gt;
    &amp;quot;review_assignment_strategy&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_reviews_per_submission&amp;quot;: null,&lt;br /&gt;
    &amp;quot;review_topic_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;copy_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;rounds_of_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;microtask&amp;quot;: null,&lt;br /&gt;
    &amp;quot;require_quiz&amp;quot;: 1,&lt;br /&gt;
    &amp;quot;num_quiz_questions&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_coding_assignment&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_intelligent&amp;quot;: null,&lt;br /&gt;
    &amp;quot;calculate_penalty&amp;quot;: null,&lt;br /&gt;
    &amp;quot;late_policy_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_penalty_calculated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;max_bids&amp;quot;: null,&lt;br /&gt;
    &amp;quot;show_teammate_reviews&amp;quot;: null,&lt;br /&gt;
    &amp;quot;availability_flag&amp;quot;: null,&lt;br /&gt;
    &amp;quot;use_bookmark&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_review_same_topic&amp;quot;: null,&lt;br /&gt;
    &amp;quot;can_choose_topic_to_review&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_calibrated&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_selfreview_enabled&amp;quot;: null,&lt;br /&gt;
    &amp;quot;reputation_algorithm&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_anonymous&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_required&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_metareviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;num_reviews_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck&amp;quot;: null,&lt;br /&gt;
    &amp;quot;simicheck_threshold&amp;quot;: null,&lt;br /&gt;
    &amp;quot;is_answer_tagging_allowed&amp;quot;: null,&lt;br /&gt;
    &amp;quot;has_badge&amp;quot;: null,&lt;br /&gt;
    &amp;quot;allow_selecting_additional_reviews_after_1st_round&amp;quot;: null,&lt;br /&gt;
    &amp;quot;sample_assignment_id&amp;quot;: null,&lt;br /&gt;
    &amp;quot;created_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;,&lt;br /&gt;
    &amp;quot;updated_at&amp;quot;: &amp;quot;2024-03-17 06:01:33.396814&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Admin credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154614</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154614"/>
		<updated>2024-03-25T03:33:19Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Peer Review Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Admin credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154613</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154613"/>
		<updated>2024-03-25T03:32:57Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Github repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
These changes can be viewed in this [https://github.com/expertiza/reimplementation-front-end/pull/46 Pull Request].&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154609</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154609"/>
		<updated>2024-03-25T03:31:39Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added future scope and edited image sizes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview_expertiza.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Studenttaskview.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
=== Database Integration ===&lt;br /&gt;
In the current implementation, test data was utilized to populate the tables. However, accessing data from the SQL server hosted on the backend via API endpoints is necessary. This integration would enable dynamic retrieval of data, ensuring that the application reflects the most up-to-date information. Additionally, there might be a need to modify existing tables by adding or removing columns to align with any updates or changes in the table structure. &lt;br /&gt;
&lt;br /&gt;
=== Search and Filter Functionality ===&lt;br /&gt;
Implementing search and filter functionality enables users to swiftly locate specific tables or records within the database. Intuitive features like keyword search, criteria-based filtering, and instant suggestions optimize user experience, while persistent filters and clear error handling ensure seamless navigation and efficient retrieval of relevant information.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Studenttaskview.png&amp;diff=154598</id>
		<title>File:Studenttaskview.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Studenttaskview.png&amp;diff=154598"/>
		<updated>2024-03-25T03:22:33Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Studenttaskview_expertiza.png&amp;diff=154597</id>
		<title>File:Studenttaskview expertiza.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Studenttaskview_expertiza.png&amp;diff=154597"/>
		<updated>2024-03-25T03:22:16Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154596</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154596"/>
		<updated>2024-03-25T03:21:32Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added Student Task View images&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
The following depicts the current student task view page for a specific assignment in Expertiza, followed by the student task view page presented for the reimplementation project.&lt;br /&gt;
Expertiza Student Task View:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Studenttaskview_expertiza.png]]&lt;br /&gt;
&lt;br /&gt;
Current implementation of Student Task view:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Studenttaskview.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154576</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154576"/>
		<updated>2024-03-25T03:08:29Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Student Task Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This mock webpage was designed to display assignment details, and clicking on a specific assignment will redirect users to its corresponding task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154573</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154573"/>
		<updated>2024-03-25T03:05:11Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Student Task Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This dummy webpage was created so as to show the assignment information and by clicking on that specific assignment, that assignment will be redirected to its task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.png]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154572</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154572"/>
		<updated>2024-03-25T03:04:53Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Student Task Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This dummy webpage was created so as to show the assignment information and by clicking on that specific assignment, that assignment will be redirected to its task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Studenttask.png&amp;diff=154569</id>
		<title>File:Studenttask.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Studenttask.png&amp;diff=154569"/>
		<updated>2024-03-25T03:02:47Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154567</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154567"/>
		<updated>2024-03-25T03:02:23Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: added student task image&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, according to the dummy data added to the assignments database, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
This dummy webpage was created so as to show the assignment information and by clicking on that specific assignment, that assignment will be redirected to its task view page.&lt;br /&gt;
&lt;br /&gt;
[[File:studenttask]]&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154556</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154556"/>
		<updated>2024-03-25T02:55:54Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added team info and changed github repo location in wiki page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
Sravya Yepuri (syepuri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Hasini Chenchala (hchench@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Chirag Hegde (chegde@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154547</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154547"/>
		<updated>2024-03-25T02:52:21Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added lazy loading implementation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file introduces the React functional component named `LazyLoadedStudentTaskView`. This component is designed to implement lazy loading functionality for the student task view component, allowing for deferred loading of content until it's required, thus enhancing the performance of the application.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
====Implementing Lazy Loading for Enhanced Performance====&lt;br /&gt;
In order to enhance website responsiveness and optimize performance, a strategic approach involves the utilization of lazy loading for components. This technique defers the loading of specific components until they are actually required by the client, thereby reducing initial load times and conserving network bandwidth.&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
React applications, by default, bundle all JavaScript files, leading to larger initial payloads sent to the client. As the application scales, this can result in prolonged load times and unnecessary data transfer for components that may not be immediately needed. Lazy loading addresses this challenge by postponing the loading of components until they are essential for rendering.&lt;br /&gt;
For more information on code splitting and lazy loading in React, refer to the official documentation: https://legacy.reactjs.org/docs/code-splitting.html&lt;br /&gt;
&lt;br /&gt;
====Implementation====&lt;br /&gt;
Lazy loading in React can be implemented using the lazy function along with Suspense to asynchronously load components. This approach ensures that components are fetched from the server only when they are first rendered, thereby enhancing performance and minimizing the initial load size.&lt;br /&gt;
&lt;br /&gt;
This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The LazyStudentTaskView component is dynamically imported using the React.lazy function, which asynchronously loads the component when it is first rendered. Within the Suspense component, a fallback UI is provided to display a loading message while the component is being loaded asynchronously.&lt;br /&gt;
&lt;br /&gt;
Lazy loading of components provides a powerful strategy to enhance website responsiveness and optimize overall performance by deferring the loading of non-essential components until they are required. By adopting lazy loading, React applications can achieve expedited initial load times and streamline network bandwidth utilization.&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154535</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154535"/>
		<updated>2024-03-25T02:47:05Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Student Task Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTasks/StudentTask.tsx StudentTask.tsx] file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, but this step should be eliminated once the ID can be fetched directly from the database.&lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file includes a React functional component called `LazyLoadedStudentTaskView`. This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154534</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154534"/>
		<updated>2024-03-25T02:46:19Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: Added student task view details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The `StudentTask.tsx` file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, but this step should be eliminated once the ID can be fetched directly from the database. &lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskView.tsx StudentTaskView.tsx] file contains a React component named `StudentTaskView`. This component is responsible for rendering the student task view, including assignment details, deadlines, and various interaction options based on user permissions. It imports necessary modules and functions from React and other custom utility files. Within the component, it fetches assignment data using the `useEffect` hook. This component can be found below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  useEffect(() =&amp;gt; { // Fetch assignment data on component mount&lt;br /&gt;
    const fetchAssignment = async () =&amp;gt; {&lt;br /&gt;
      try {&lt;br /&gt;
        const assignmentData = await loadAssignment({ params: { id } });&lt;br /&gt;
        setAssignment(assignmentData);&lt;br /&gt;
      } catch (error) {&lt;br /&gt;
        console.error('Error fetching assignment:', error);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    fetchAssignment(); // Call fetchAssignment function&lt;br /&gt;
&lt;br /&gt;
    return () =&amp;gt; {&lt;br /&gt;
      // Cleanup code here&lt;br /&gt;
    };&lt;br /&gt;
  }, [id]); // Include ID in the dependency array to re-fetch assignment data when ID changes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file also displays a loading message if data is not yet available. It then renders assignment details and buttons for submitting work or reviewing. The below component renders assignment details, interaction options, and deadlines. It uses conditional rendering to display buttons and options based on user permissions and deadlines. Deadlines are rendered using the map function to iterate over the list of deadlines and render each one using the renderDeadline function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  function renderDeadline(deadline: any, index: number) { // Render each deadline&lt;br /&gt;
    return (&lt;br /&gt;
      &amp;lt;li key={deadline.id} style={styles.li} className={isDeadlinePassed(deadline) ? 'li complete' : 'li'}&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.timestamp} className=&amp;quot;timestamp&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p&amp;gt;{deadline.date}&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div style={styles.status} className=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;p style={styles.statusP}&amp;gt;&lt;br /&gt;
            {deadline.id &amp;amp;&amp;amp; checkShowLink(index, deadlines) ? ( // Conditionally render link based on deadline status&lt;br /&gt;
              &amp;lt;a href={`controller: 'response', action: 'view', id: ${deadline.id}`} target=&amp;quot;_blank&amp;quot;&amp;gt;&lt;br /&gt;
                {deadline.description}&lt;br /&gt;
              &amp;lt;/a&amp;gt;&lt;br /&gt;
            ) : (&lt;br /&gt;
              deadline.description&lt;br /&gt;
            )}&lt;br /&gt;
          &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;div style={isDeadlinePassed(deadline) ? { ...styles.statusBefore, ...styles.completeStatusBefore } : styles.statusBefore}&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    );&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the other hand, the [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/LazyStudentTaskView.tsx LazyStudentTaskView.tsx] file includes a React functional component called `LazyLoadedStudentTaskView`. This component is responsible for lazy loading the `StudentTaskView` component to improve performance. &lt;br /&gt;
&amp;lt;pre&amp;gt;const LazyStudentTaskView = React.lazy(() =&amp;gt; import('./StudentTaskView'));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It uses the React `Suspense` component to render a fallback UI while the `StudentTaskView` component is being loaded asynchronously. Inside the component, it fetches assignment data similarly to `StudentTaskView.tsx`, and renders the `LazyStudentTaskView` component within the `Suspense` component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading Student Task View...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br /&gt;
      &amp;lt;LazyStudentTaskView /&amp;gt;&lt;br /&gt;
    &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/Shravsssss/reimplementation-front-end/blob/main/src/pages/StudentTaskViews/StudentTaskViewStyle.ts StudentTaskViewStyle.ts] file contains the styling definitions for the `StudentTaskView` component. It defines CSS styles using an object notation for various elements such as the timeline, list items, timestamps, and status indicators. These styles are applied to elements within the `StudentTaskView` component to ensure a consistent and visually appealing presentation of assignment details and deadlines.&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154498</id>
		<title>CSC/ECE 517 Spring 2024 - E2430 Reimplement student task view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2430_Reimplement_student_task_view&amp;diff=154498"/>
		<updated>2024-03-25T02:29:38Z</updated>

		<summary type="html">&lt;p&gt;Syepuri: /* Github repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Here are the links to the front-end and back-end reimplementations:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Front end: &amp;lt;/br&amp;gt; &lt;br /&gt;
https://github.com/Shravsssss/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
These repositories are connected to the GitHub Project, which contains the necessary issues for project implementation. &amp;lt;/br&amp;gt;&lt;br /&gt;
https://github.com/users/Shravsssss/projects/1&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ 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.&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
Enhance the student task view interface in Expertiza by re-implementing the front-end using React JS and TypeScript. The primary objectives are to improve responsiveness, and usability, provide real-time updates, and enhance the overall student experience.&lt;br /&gt;
&lt;br /&gt;
This project will concentrate on the following features:&lt;br /&gt;
# Task Details Display: Show all the important information about assignments like name, due date, progress, review status, and any badges.&lt;br /&gt;
# Task Interaction: Make it easy for users to submit, request revisions, and see feedback. Let them move through different parts of the task easily.&lt;br /&gt;
# Timeline: Show a visual timeline with due dates and let users easily see where they are in the task.&lt;br /&gt;
# Lazy Loading: Make the page load faster by only loading what's needed, so users have a smoother experience.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
For those who wish to access the Expertiza application linked to this assignment, the login details are provided below:&lt;br /&gt;
&lt;br /&gt;
Instructor credentials: Username -&amp;gt; admin, Password -&amp;gt; password123&lt;br /&gt;
&lt;br /&gt;
== Sample Data Used ==&lt;br /&gt;
&lt;br /&gt;
An interface called &amp;quot;Deadlines&amp;quot; was created in the &amp;quot;interfaces.ts&amp;quot; file of the repository. This interface was designed to structure information related to deadlines. The implementation can be viewed [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/utils/interfaces.ts here], with the code added at the end of the file.&lt;br /&gt;
&lt;br /&gt;
To obtain the next upcoming deadline, code was added in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx DeadlineUtil.tsx file]. Here's a simplified version of the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const getNextDeadline = (): Deadline | null =&amp;gt; {&lt;br /&gt;
  const now = new Date();&lt;br /&gt;
  // Filter the deadlines to get only the upcoming ones&lt;br /&gt;
  const upcomingDeadlines = deadlines.filter(deadline =&amp;gt; new Date(deadline.date) &amp;gt; now);&lt;br /&gt;
  // Return the earliest upcoming deadline, or null if there are no upcoming deadlines&lt;br /&gt;
  return upcomingDeadlines.length &amp;gt; 0 ? upcomingDeadlines[0] : null;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, dummy data for the deadlines was included, which is then displayed by the &amp;quot;Deadlines&amp;quot; component within the &amp;quot;StudentTaskView&amp;quot; component. This data serves testing purposes, and it's recommended that future team members delete this file if real data can be retrieved from the database.  This data is also located in the [https://github.com/Shravsssss/reimplementation-front-end/blob/TaskDetails/src/pages/StudentTaskViews/DeadlineUtil.tsx same file]. Here is the dummy deadlines data provided below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export const deadlines: Deadline[] = [&lt;br /&gt;
    {&lt;br /&gt;
        id: 1,&lt;br /&gt;
        date: &amp;quot;2024-03-22&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 2,&lt;br /&gt;
        date: &amp;quot;2024-03-27&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 1&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 3,&lt;br /&gt;
        date: &amp;quot;2024-04-04&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Submit Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
        id: 4,&lt;br /&gt;
        date: &amp;quot;2024-04-07&amp;quot;,&lt;br /&gt;
        description: &amp;quot;Review Assignment Round 2&amp;quot;,&lt;br /&gt;
    },&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
The App.tsx file was modified to incorporate the LazyLoadedStudentTaskViews component, housing the lazy-loaded content of the student task view component, and the StudentTasks component. Two directories named StudentTasks and StudentTaskViews were created inside the pages directory. Inside the StudentTasks folder, a dummy StudentTask.tsx file was added with placeholder code to redirect to the specific student task view. &lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
The `StudentTask.tsx` file contains a React component called `StudentTask`. This page can be viewed when `Assignments` is clicked from the header. This component generates a link to view a specific assignment. It uses the React Router DOM's `&amp;lt;Link&amp;gt;` component to create the link. Inside the link, it includes the assignment ID as a route parameter. When users click on the link, it takes them to the corresponding assignment view page. Currently, it's set up to show Assignment 5, but this step should be eliminated once the ID can be fetched directly from the database. &lt;br /&gt;
&lt;br /&gt;
=== Student Task View Page ===&lt;/div&gt;</summary>
		<author><name>Syepuri</name></author>
	</entry>
</feed>