<?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=Dawhite4</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=Dawhite4"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dawhite4"/>
	<updated>2026-05-22T17:38:56Z</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_-_E2442_Reimplement_student_task_controller&amp;diff=155864</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155864"/>
		<updated>2024-04-22T22:46:13Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases, and postman and swaggerUI to visualize endpoints.&lt;br /&gt;
&lt;br /&gt;
==== Postman ====&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team used &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function were checked with Postman to verify their parameters, headers, and response values. A Postman collection was first created to enable us to quickly and simply test code changes without manually navigating through the UI each time. The collection contains a request that logs in (and sets authorization variables for the other requests) as well as a list request and a view request: &lt;br /&gt;
&lt;br /&gt;
[[File:Student Task Controller Postman.png| 1200 px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;On the left, you can see the post request and two get requests under &amp;quot;Student Tasks&amp;quot;. In the top-center is the API we are hitting, and in the bottom we see the response from sending the request.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Rspec/Rswag ====&lt;br /&gt;
&lt;br /&gt;
Continuing, we developed automated test cases using Rspec/RSwag (https://github.com/rswag/rswag). Functional testing of the controller itself, and the methods we've implemented, are tested with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We tested success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI ====&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155747</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155747"/>
		<updated>2024-04-21T20:06:34Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases, and postman and swaggerUI to visualize endpoints.&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team used &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function were checked with Postman to verify their parameters, headers, and response values. A Postman collection was first created to enable us to quickly and simply test code changes without manually navigating through the UI each time. The collection contains a request that logs in (and sets authorization variables for the other requests) as well as a list request and a view request: &lt;br /&gt;
&lt;br /&gt;
[[File:Student Task Controller Postman.png| 1200 px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;On the left, you can see the post request and two get requests under &amp;quot;Student Tasks&amp;quot;. In the top-center is the API we are hitting, and in the bottom we see the response from sending the request.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Continuing, we developed automated test cases using Rspec/RSwag (https://github.com/rswag/rswag). Functional testing of the controller itself, and the methods we've implemented, are tested with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We tested success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155746</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155746"/>
		<updated>2024-04-21T20:04:21Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases, and postman and swaggerUI to visualize endpoints.&lt;br /&gt;
&lt;br /&gt;
A Postman collection was first created to enable us to test endpoints quickly and independently without navigating a UI. The collection contains a request that logs in (and sets authorization variables for the other requests) as well as a list request and a view request: &lt;br /&gt;
&lt;br /&gt;
[[File:Student Task Controller Postman.png| 1200 px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;On the left, you can see the post request and two get requests under &amp;quot;Student Tasks&amp;quot;. In the top-center is the API we are hitting, and in the bottom we see the response from sending the request.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Continuing, we developed automated test cases using Rspec/RSwag (https://github.com/rswag/rswag). &lt;br /&gt;
&lt;br /&gt;
The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155745</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155745"/>
		<updated>2024-04-21T20:04:12Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases, and postman and swaggerUI to visualize endpoints.&lt;br /&gt;
&lt;br /&gt;
A Postman collection was first created to enable us to test endpoints quickly and independently without navigating a UI. The collection contains a request that logs in (and sets authorization variables for the other requests) as well as a list request and a view request: &lt;br /&gt;
&lt;br /&gt;
[[File:Student Task Controller Postman.png| 1200 px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;On the left, you can see the post request and two get requests under &amp;quot;Student Tasks&amp;quot;. In the top-center is the API we are hitting, and in the bottom we see the response from sending the request.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continuing, we developed automated test cases using Rspec/RSwag (https://github.com/rswag/rswag). &lt;br /&gt;
&lt;br /&gt;
The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155744</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155744"/>
		<updated>2024-04-21T20:03:55Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases, and postman and swaggerUI to visualize endpoints.&lt;br /&gt;
&lt;br /&gt;
A Postman collection was first created to enable us to test endpoints quickly and independently without navigating a UI. The collection contains a request that logs in (and sets authorization variables for the other requests) as well as a list request and a view request: &lt;br /&gt;
&lt;br /&gt;
[[File:Student Task Controller Postman.png| 1200 px]]&lt;br /&gt;
&lt;br /&gt;
On the left, you can see the post request and two get requests under &amp;quot;Student Tasks&amp;quot;. In the top-center is the API we are hitting, and in the bottom we see the response from sending the request.&lt;br /&gt;
&lt;br /&gt;
Continuing, we developed automated test cases using Rspec/RSwag (https://github.com/rswag/rswag). &lt;br /&gt;
&lt;br /&gt;
The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155743</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155743"/>
		<updated>2024-04-21T20:02:05Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases, and postman and swaggerUI to visualize endpoints.&lt;br /&gt;
&lt;br /&gt;
A Postman collection was first created to enable us to test endpoints quickly and independently without navigating a UI. The collection contains a request that logs in (and sets authorization variables for the other requests) as well as a list request and a view request: &lt;br /&gt;
&lt;br /&gt;
[[File:Student Task Controller Postman.png| 1200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, the tests were implemented using RSwag (https://github.com/rswag/rswag). For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_Task_Controller_Postman.png&amp;diff=155742</id>
		<title>File:Student Task Controller Postman.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_Task_Controller_Postman.png&amp;diff=155742"/>
		<updated>2024-04-21T19:59:24Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155741</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155741"/>
		<updated>2024-04-21T19:57:27Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
For this project we have completed the list and view functions in the student task controller. We used RSwag and Rspec to implement the controller test cases.  The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we have tested the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks without proper authorization, and that they get an error response instead. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, the tests were implemented using RSwag (https://github.com/rswag/rswag). For example, this is part of the first test for the list controller:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  path '/api/v1/student_tasks/list' do&lt;br /&gt;
    get 'student tasks list' do&lt;br /&gt;
      # Tag for testing purposes.&lt;br /&gt;
      tags 'StudentTasks'&lt;br /&gt;
      produces 'application/json'&lt;br /&gt;
&lt;br /&gt;
      # Define parameter to send with request.&lt;br /&gt;
      parameter name: 'Authorization', :in =&amp;gt; :header, :type =&amp;gt; :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request gets a 200 response.&lt;br /&gt;
      response '200', 'authorized request has success response' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        run_test!&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
The test first scopes a path and defines a get request we can implement several tests for. First, it defines a parameter with key 'Authorization' and gives a bearer token stored in an instance variable (computed in the before(:each) block of the spec) using the let syntax. Then, calling ''run_test!'' validates that the response code is correct. In a later test, we also assert statements about the contents of the response by using a block with ''run_test!'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized test gets the right data for the logged-in user.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        # Attach parameter to request.&lt;br /&gt;
        let(:'Authorization') {&amp;quot;Bearer #{@token}&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
        # Run test and give expectations about result.&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to be_instance_of(Array)&lt;br /&gt;
          expect(data.length()).to be 5&lt;br /&gt;
&lt;br /&gt;
          # Ensure the objects have the correct type.&lt;br /&gt;
          data.each do |task|&lt;br /&gt;
            expect(task['assignment']).to be_instance_of(String)&lt;br /&gt;
            expect(task['current_stage']).to be_instance_of(String)&lt;br /&gt;
            expect(task['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
            expect(task['topic']).to be_instance_of(String)&lt;br /&gt;
            expect(task['permission_granted']).to be_in([true, false])&lt;br /&gt;
&lt;br /&gt;
            # Not true in general case- this is only  for the seeded data.&lt;br /&gt;
            expect(task['assignment']).to eql(task['topic'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;spec/requests/api/v1/student_tasks_controller_spec.rb&amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb)&lt;br /&gt;
&lt;br /&gt;
Here, we assert we have the correct response as well as the fact that the response returned an array of length 5. Finally, we assert the types of all returned data and that the topic is equal to assignment (something manually configured for the seeded test data). &lt;br /&gt;
&lt;br /&gt;
The purpose of the view function is to provide the user interface with data for displaying one student task. The following cases will be tested: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155740</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155740"/>
		<updated>2024-04-21T19:42:49Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We considered the DRY principle throughout development, ensuring we developed simple, fine-grained, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155739</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155739"/>
		<updated>2024-04-21T19:38:15Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Readability &amp;lt;/b&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155738</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155738"/>
		<updated>2024-04-21T19:37:53Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Single Responsibility Principle (SRP) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Don't Repeat Yourself (DRY) &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Open-Closed Principle &amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155737</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155737"/>
		<updated>2024-04-21T19:36:58Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155736</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155736"/>
		<updated>2024-04-21T19:36:30Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt; app/controllers/api/v1/student_tasks_controller.rb: &amp;lt;/i&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; In spec/requests/api/v1/student_tasks_controller_spec.rb: &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&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;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155735</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155735"/>
		<updated>2024-04-21T19:36:06Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; In app/controllers/api/v1/student_tasks_controller.rb: &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; In spec/requests/api/v1/student_tasks_controller_spec.rb: &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&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;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155734</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155734"/>
		<updated>2024-04-21T19:35:55Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; In app/controllers/api/v1/student_tasks_controller.rb: &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; In spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&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;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155733</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155733"/>
		<updated>2024-04-21T19:35:19Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; app/controllers/api/v1/student_tasks_controller.rb &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/app/controllers/api/v1/student_tasks_controller.rb)&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; spec/requests/api/v1/student_tasks_controller_spec.rb &amp;lt;/b&amp;gt;&lt;br /&gt;
(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb) &lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155732</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155732"/>
		<updated>2024-04-21T19:34:08Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/requests/api/v1/student_tasks_controller_spec.rb &lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155731</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155731"/>
		<updated>2024-04-21T19:33:22Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we have attempted to follow several universal design principles. Similarly, we have tried to be conscious of and avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. For instance, here's our student task controller's list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this way, the controller correctly fulfills its single responsibility by handling the request and delegating to the model class. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. A clear example is in our student task controller tests: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def login_user&lt;br /&gt;
  # Give the login details of a DB-seeded user. (see seeds.rb)&lt;br /&gt;
  login_details = {&lt;br /&gt;
    user_name: &amp;quot;john&amp;quot;,&lt;br /&gt;
    password: &amp;quot;password123&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Make the request to the login function.&lt;br /&gt;
  post '/login', params: login_details&lt;br /&gt;
&lt;br /&gt;
  # return the token from the response&lt;br /&gt;
  json_response = JSON.parse(response.body)&lt;br /&gt;
  json_response['token']&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe 'StudentTasks API', type: :request do&lt;br /&gt;
&lt;br /&gt;
  # Re-login and get the token after each request.&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @token = login_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, we have common functionality (simulating a log-in to test authenticated endpoints) that we need to run before each test. Instead of putting this code at the start of each method, we factor it out into a common method and apply it in the before(:each) block. This allows us to follow the DRY principle and ensure this code works consistently to keep individual test components independent. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155730</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155730"/>
		<updated>2024-04-21T19:23:13Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we will follow several universal design principles. Similarly, we will be conscious of and attempt to avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
Here is the implementation of the list endpoint:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155729</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155729"/>
		<updated>2024-04-21T19:22:31Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.The main functions this project will focus on are list, which is to gather and organize student tasks to  facilitate the display of tasks, and view, which is to display detailed information about a specific student task based on the student id.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we will follow several universal design principles. Similarly, we will be conscious of and attempt to avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file contains the endpoints provided by our functionality- the list endpoint and the view endpoint. &lt;br /&gt;
&lt;br /&gt;
Information for the list endpoint is obtained in the old system by querying the participants database (there is no separate student task database). To maintain this for the new system, we created a Student Task model function we can call from the view. In this way, we keep the bulk of application logic in the model class and allow the controller to focus on its single responsibility- routing and transforming requests. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def list&lt;br /&gt;
      @student_tasks = StudentTask.create_tasks_from_user current_user&lt;br /&gt;
      render json: @student_tasks&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This list function is attached to the /api/v1/student_tasks endpoint using &amp;lt;b&amp;gt;routes.rb&amp;lt;/b&amp;gt;. It calls StudentTask's create_tasks_from_user method on the authenticated user (current_user) and returns the result as JSON for the front end. &lt;br /&gt;
&lt;br /&gt;
The old student task controller handled other functionality as well- checking if the user is a new user, handling impersonation, and getting students who have teamed with a user. However, this is a result of using rails for the front end and the back end, and trying to implement something similar would just result in tight coupling between the front and back end (as well as violating the SRP). Instead, this functionality should be appropriately split into different endpoints and modularized to improve the maintainability, flexibility and testability of the code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
After we finish the implementation of list, we will move on to ''view''. Here is the current design of view:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def view&lt;br /&gt;
    StudentTask.from_participant_id params[:id]&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @can_submit = @participant.can_submit&lt;br /&gt;
    @can_review = @participant.can_review&lt;br /&gt;
    @can_take_quiz = @participant.can_take_quiz&lt;br /&gt;
    @authorization = @participant.authorization&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    denied unless current_user_id?(@participant.user_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @can_provide_suggestions = @assignment.allow_suggestions&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@assignment.id, @participant.user_id)&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: @assignment.id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
    # Timeline feature&lt;br /&gt;
    @timeline_list = StudentTask.get_timeline_data(@assignment, @participant, @team)&lt;br /&gt;
    # To get the current active reviewers of a team assignment.&lt;br /&gt;
    # Used in the view to disable or enable the link for sending email to reviewers.&lt;br /&gt;
    @review_mappings = review_mappings(@assignment, @team.id) if @team&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The current design is to provide detailed information about a specific sutdent task based on the participant id, then it gathers different information from the participant along with the pther required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
For our project, we intend to keep the same design idea, we will start from implementing ''list'' function to provide a comprehensive and filtered overview of student task based on the role of the current user. This will give us a solid start point. After we finsih implementing ''list'', we will move on to ''view'', focusing on offering detailed information about individual student tasks. &lt;br /&gt;
The design principles include the &amp;lt;strong&amp;gt;Single Responsibility Principle (SRP)&amp;lt;/strong&amp;gt;, ensuring each component of our application is tasked with a single responsibility, and the &amp;lt;strong&amp;gt;Principle of Least Privilege (PoLP)&amp;lt;/strong&amp;gt;, ensuring users access only the data and actions relevant to their role.&lt;br /&gt;
&lt;br /&gt;
== UML ==&lt;br /&gt;
[[File:Student task uml.jpeg | 1200 px]]&lt;br /&gt;
&lt;br /&gt;
The user sends request through the UI to student_task_controller.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In List function, the controller sends request to student_task model for an instance, the student_task model will gather information from participant based on the participant parameter and send the intance to controller. After assembling these instances with the necessary details, the StudentTask model returns them to the controller, which then renders the appropriate view to display the tasks to the user.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
In the view function, it gathers the information of a specific StudentTask based on the given participant id. It also retrieves the information of the participant such as ability to submit work, review others, take quizzes, authentication and etc.This process enables a detailed and personalized overview of the student task.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155102</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=155102"/>
		<updated>2024-04-08T20:45:52Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we will follow several universal design principles. Similarly, we will be conscious of and attempt to avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the topic; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The first step to approach is to clearly define the model's attributes, relationships, and foundamental functionalities. Based on the previous implementation we understand that the student task is created based on participant. To maintain the consistency, we plan to implement the method for creating StudentTask instances directly from participants. Utilitze the existing participant is to follow the approach of &amp;lt;strong&amp;gt;Do not Repeat Yourself (DRY)&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Single Responsibility Principle&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def initialize(args)&lt;br /&gt;
    @assignment = args[:assignment]&lt;br /&gt;
    @current_stage = args[:current_stage]&lt;br /&gt;
    @participant = args[:participant]&lt;br /&gt;
    @stage_deadline = args[:stage_deadline]&lt;br /&gt;
    @topic = args[:topic]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.from_participant(participant)&lt;br /&gt;
    StudentTask.new(&lt;br /&gt;
      participant: participant,&lt;br /&gt;
      assignment: participant.assignment,&lt;br /&gt;
      topic: participant.topic,&lt;br /&gt;
      current_stage: participant.current_stage,&lt;br /&gt;
      stage_deadline: (begin&lt;br /&gt;
                         Time.parse(participant.stage_deadline)&lt;br /&gt;
                       rescue StandardError&lt;br /&gt;
                         Time.now + 1.year&lt;br /&gt;
                       end)&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
Also, we will add other functions such as ''complete?'', ''not_started?'', and other facilitating methods to enrich the model's interactivity and user feedback capabilities.This approach is to follow &amp;lt;strong&amp;gt; Open/Closed Principle&amp;lt;/strong&amp;gt; that student_task can have more behaviors by adding new functions but existing functions remain the same.&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file will be the main part we focus on. To start with, we will implement ''list'' function based on the current design:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def list&lt;br /&gt;
    if current_user.is_new_user&lt;br /&gt;
      redirect_to(controller: 'eula', action: 'display')&lt;br /&gt;
    end&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
&lt;br /&gt;
      if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(ta_id: session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks.select! { |t| ta_course_ids.include? t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks.select! { |t| t.assignment.course &amp;amp;&amp;amp; (session[:original_user].id == t.assignment.course.instructor_id) || !t.assignment.course &amp;amp;&amp;amp; (session[:original_user].id == t.assignment.instructor_id) }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @student_tasks.select! { |t| t.assignment.availability_flag }&lt;br /&gt;
&lt;br /&gt;
    # #######Tasks and Notifications##################&lt;br /&gt;
    @tasknotstarted = @student_tasks.select(&amp;amp;:not_started?)&lt;br /&gt;
    @taskrevisions = @student_tasks.select(&amp;amp;:revision?)&lt;br /&gt;
&lt;br /&gt;
    ######## Students Teamed With###################&lt;br /&gt;
    @students_teamed_with = StudentTask.teamed_students(current_user, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
Additionally, we will do functional testing of the controller itself, and the methods we've implemented, with &amp;lt;b&amp;gt; Rspec &amp;lt;/b&amp;gt; (https://rspec.info/features/6-0/rspec-rails/controller-specs/). We will test success and error responses with valid and badly-formed requests in order to ensure our components are reliable and secure. Automating tests is important for preserving existing functionality, especially when changes are made.&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=154985</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=154985"/>
		<updated>2024-04-08T16:06:33Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the &amp;lt;strong&amp;gt;topic&amp;lt;/strong&amp;gt;; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
The minimum scope of the project is to complete the list function in the student task controller. The purpose of the list function is to provide the user interface with data for displaying the student task table. Accordingly, we will test the following cases for the list function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets all their tasks with correct attributes when they request. (For this case, various users will be tested with different tasks). &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user is unable to view tasks for another user. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Ensure a user gets tasks without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, the team hopes to complete the view function, which displays information about a specific task. If this functionality is finished, the following cases will be tested:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user is able to view any task retrieved from the table. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure the user gets correct attributes when they request. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Ensure a user may view a task without error when some data is missing. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In early stages of development, the team will be using &amp;lt;b&amp;gt; Postman &amp;lt;/b&amp;gt; (https://www.postman.com) in order to test API endpoints exposed by the student task controller. Specifically, the endpoints for the list function and the view function will be checked with Postman to verify their parameters, headers, and response values. By using Postman in early stages, the team hopes to quickly and simply test code changes without manually navigating through the UI each time.&lt;br /&gt;
&lt;br /&gt;
After the endpoints have been implemented, they will be compiled and thoroughly tested using &amp;lt;b&amp;gt; Swagger UI &amp;lt;/b&amp;gt; (https://swagger.io/tools/swagger-ui/). Swagger UI enables users to test various requests and view their responses in an accessible web interface. The platform will enable us to quickly test endpoints with different parameters and validate the structure of responses with models we can define.&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we will follow several universal design principles. Similarly, we will be conscious of and attempt to avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=154983</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=154983"/>
		<updated>2024-04-08T16:04:56Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the &amp;lt;strong&amp;gt;topic&amp;lt;/strong&amp;gt;; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we will follow several universal design principles. Similarly, we will be conscious of and attempt to avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the &amp;lt;b&amp;gt; single responsibility principle (SRP) &amp;lt;/b&amp;gt; is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- &amp;lt;b&amp;gt; do not repeat yourself, also known as DRY &amp;lt;/b&amp;gt;. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt; open-closed principle &amp;lt;/b&amp;gt; states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Narrowest Scope&amp;lt;/b&amp;gt;: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Conciseness&amp;lt;/b&amp;gt;: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Variable Names&amp;lt;/b&amp;gt;: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Consistency&amp;lt;/b&amp;gt;: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;b&amp;gt; Commenting&amp;lt;/b&amp;gt;: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=154981</id>
		<title>CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2442_Reimplement_student_task_controller&amp;diff=154981"/>
		<updated>2024-04-08T16:03:38Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Github repository ==&lt;br /&gt;
&lt;br /&gt;
Front end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end&lt;br /&gt;
&lt;br /&gt;
Back end:&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-back-end&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
Expertiza is a Moodle-like open source project developed with Ruby on Rails, designed to enhance the educational experience by allowing students, TAs and instructors to interact on assignments and projects. For instructors, Expertiza can help to create new assignments, review and grade the students’ submissions. For students, Expertiza can provide features to form teams, submit assignments, and provide peer evaluations.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The scope of this project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. In the previous part, we have implemented the student_task table with React and TypeScript. On this project, we are going to work on the &amp;lt;strong&amp;gt;student_task_controller.rb&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;student_task.rb&amp;lt;/strong&amp;gt; based on the original design of Expertiza and reimplement them.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; This file represents the student task model, will be where we define the relationship between student tasks and other entities such as courses, participants and assignments in the system, as well as any custom logic related to student tasks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt; This file is the controller of student task, we will implement features related with authentication and listing, viewing the student tasks.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
The student task is highly related with other models such as participant and topic, which have not been implemented or finished yet. For the scope of this project, we will establish the foundational elements of the StudentTask to ensure its capability to interface with the frontend effectively. This approach allows us to set up a framework that can support future teams to incorporate the future implementation into student_task.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prerequisite:&amp;lt;/strong&amp;gt; Given that the StudentTask heavily relies on data from the &amp;lt;strong&amp;gt;Participant&amp;lt;/strong&amp;gt; table, we will utilize the existing Participant model, controller, database table, and schema. Once the new Participant model and controller are completed, the future team should integrate these updates to ensure that the StudentTask remains fully functional.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another inseparable element of the StudentTask table is the &amp;lt;strong&amp;gt;topic&amp;lt;/strong&amp;gt;; however, implementing the supporting backend for topics is beyond the scope of our current project. Therefore, we will utilize JSON data to mimic the interaction and data structure of topics. This method allows us to simluate the topic without implementing. Also, The future team can integrate the implemented topic part into student task easily without conflict.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task_controller.rb:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
In order to ensure our code is maintainable, extensible, and as simple as possible, we will follow several universal design principles. Similarly, we will be conscious of and attempt to avoid design smells that can indicate code is too rigid, fragile, complex, or difficult to understand. &lt;br /&gt;
&lt;br /&gt;
While developing the student task controller and model, the single responsibility principle (SRP) is important to maintain. The SRP states that each class should not have more than one reason to change- in other words, it should do one thing and do it well. The first implication of this principle is that the controller should not contain significant application logic; the controller’s primary responsibility is to handle requests and call the appropriate methods. Therefore, it should delegate to the model class for any complex logic. The principle can also be applied to functions within the model class itself. Ideally, the student task controller will call simple and reusable functions in the model class that each perform one task. &lt;br /&gt;
&lt;br /&gt;
The reusability of components follows another important principle- do not repeat yourself, also known as DRY. Essentially, the same code should not exist in two different places if it does the same thing- instead, the design of components should enable the code to be written once and called multiple times. This reduces the complexity of the application, ensures the code always does the same thing, and makes testing the code simpler and more effective. We will consider the DRY principle throughout development, ensuring we develop simple, granular, and reusable functions for the student task model that can be reused by other components in the future. &lt;br /&gt;
&lt;br /&gt;
The open-closed principle states that classes should be open for extension but closed for modification. Following this principle, the student task controller should interact with the model through method calls encapsulated in the model and not modify any data for the model itself. Additionally, we need to be cognizant of the overall design of the model and controller so they don’t need to change in order to implement new functionality in the future. Again, this will be achieved by keeping the code modular and ensuring the student task model’s methods adhere to principles of encapsulation and single responsibility. &lt;br /&gt;
&lt;br /&gt;
Finally, it’s important to make code as readable as possible. If developers understand code more quickly, the code is more maintainable, extensible, and less likely to cause unforeseen errors. Therefore, we will follow several best practices for code readability: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Narrowest Scope: Give a variable the narrowest scope you can. By giving the narrowest scope by default, we constrain variables to the context in which they are needed, reducing the need for developers to reason about too many variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Conciseness: Code should be as concise as possible while being simple to understand. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Variable Names: Variable names should be long enough to be descriptive, but not longer than necessary. Variables that are only used once or twice may be a bit longer than variables used throughout the code, since the developer may be much more familiar with these variables. &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Consistency: Follow conventions that exist in the present code. Unless there are fundamental differences, a problem should not be solved in different ways by the same code base. By using existing solutions and conventions, we make our code easier to use in the context of the system and help developers understand the implementation.  &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Commenting: Provide informative comments about the purpose of code. Obvious things that are clarified by concise and readable syntax don’t need to be explained; instead, we will focus on providing developers with context for any sequence of operations that merits explanation. &amp;lt;/li&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
====Project Board====&lt;br /&gt;
&lt;br /&gt;
We utilize a project board on GitHub in order to track and delegate our tasks that the reimplementation is comprised of.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/users/ychen-207523/projects/10/views/1 project board]&lt;br /&gt;
&lt;br /&gt;
We initialize our tasks on the board and so that they can be tracked and our progress can be followed by each team member, regardless of their level of responsibility in a single task. That way, even if a team member isn't directly responsible for a sub-task, a single source of truth displays to everyone the state of the project at any point in time.&lt;br /&gt;
&lt;br /&gt;
Moreover, our design documentation should allow us to create a roadmap and tasks before designing code, so that the course of action is clear and the tasks can be evenly delegated.&lt;br /&gt;
&lt;br /&gt;
====Code Quality====&lt;br /&gt;
&lt;br /&gt;
By laying out all of the incremental steps we have in order to reimplement the student task controller, we ensure that all boxes are checked in redesigning the software. Moreover, adequate comments throughout the code, and adherence to best practices will ensure our code is readable, robust, and inline with industry standards.&lt;br /&gt;
&lt;br /&gt;
Moreover, sufficient testing and peer reviews should also ensure our code is up to the highest quality. &lt;br /&gt;
&lt;br /&gt;
====Communication====&lt;br /&gt;
&lt;br /&gt;
We communicate on a regular basis using a text group chat. Moreover, we have scheduled formal calls at least once a week to discuss current objectives and progress. Additionally we often jump on a less unscheduled calls to pair program and problem solve.&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153412</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153412"/>
		<updated>2024-03-24T16:06:58Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
Additionally, we added a headerCellStyle prop to the Table to enable consuming code to specify the color, font color, or any other style of the header when creating a table. This was used in our code to overwrite the header background color and is demonstrated in our Table component &amp;quot;headerCellStyle&amp;quot; prop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153411</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153411"/>
		<updated>2024-03-24T16:06:48Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
Additionally, we added a headerCellStyle prop to the Table to enable consuming code to specify the color, font color, or any other style of the header when creating a table. This was used in our code to overwrite the header background color and is demonstrated in our Table component &amp;quot;headerCellStyle&amp;quot; prop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153410</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153410"/>
		<updated>2024-03-24T16:06:41Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
Additionally, we added a headerCellStyle prop to the Table to enable consuming code to specify the color, font color, or any other style of the header when creating a table. This was used in our code to overwrite the header background color and is demonstrated in our Table component &amp;quot;headerCellStyle&amp;quot; prop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
David White (dawhite4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Henry McKinney (hmckinn@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Yunfei Chen (ychen267@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
Kashika Malick (kmalick@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153408</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153408"/>
		<updated>2024-03-24T16:05:17Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
Additionally, we added a headerCellStyle prop to the Table to enable consuming code to specify the color, font color, or any other style of the header when creating a table. This was used in our code to overwrite the header background color and is demonstrated in our Table component &amp;quot;headerCellStyle&amp;quot; prop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
Students:&lt;br /&gt;
David White&lt;br /&gt;
Henry McKinney&lt;br /&gt;
Yunfei Chen&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mentor:&lt;br /&gt;
Kashika Malick&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153398</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153398"/>
		<updated>2024-03-24T15:54:28Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Style Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
Additionally, we added a headerCellStyle prop to the Table to enable consuming code to specify the color, font color, or any other style of the header when creating a table. This was used in our code to overwrite the header background color and is demonstrated in our Table component &amp;quot;headerCellStyle&amp;quot; prop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153394</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153394"/>
		<updated>2024-03-24T15:52:14Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Style Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153393</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153393"/>
		<updated>2024-03-24T15:51:29Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Style Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153391</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153391"/>
		<updated>2024-03-24T15:51:05Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Style Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153390</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153390"/>
		<updated>2024-03-24T15:50:39Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Code Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidance =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
===== Style Changes ===== &lt;br /&gt;
&lt;br /&gt;
We found that the table utilized by the refactored Expertiza required a few styling changes to match that of the original one. In order to maintain the alternating style of the table, we overrode the style of the header and the bootstrap class with css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(odd)&amp;gt;th {&lt;br /&gt;
  background-color: #ffffff;&lt;br /&gt;
  --bs-table-bg-type: none&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;td,&lt;br /&gt;
.student-tasks .table-striped&amp;gt;tbody&amp;gt;tr:nth-of-type(even)&amp;gt;th {&lt;br /&gt;
  background-color: #f2f2f2;&lt;br /&gt;
  --bs-table-bg-type: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where we use .student-tasks to restrict the change to the student task list, then use selectors to overwrite the color of even and odd rows of the table.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153382</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153382"/>
		<updated>2024-03-24T15:34:37Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
See the changes section for more specific one-to-one UI comparisons between the refactored version and the old Expertiza.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153381</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153381"/>
		<updated>2024-03-24T15:33:12Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
The updated UI preserves many of the styling elements from the existing Expertiza, including color schemes and formatting, while making the page appear more compact and information-dense as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153379</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153379"/>
		<updated>2024-03-24T15:32:09Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
After making all of the updates and reimplementing the page, the new student task list page looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For reference, this is the old Expertiza: &lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
As shown above, we have re-implemented all existing functionality and added some improvements, like dropdown filters and a search function.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153378</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153378"/>
		<updated>2024-03-24T15:29:18Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_OldUI_Large.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_OldUI_Large.png&amp;diff=153377</id>
		<title>File:StudentTaskTable OldUI Large.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_OldUI_Large.png&amp;diff=153377"/>
		<updated>2024-03-24T15:28:48Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_FullUI_Medium.png&amp;diff=153376</id>
		<title>File:StudentTaskTable FullUI Medium.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_FullUI_Medium.png&amp;diff=153376"/>
		<updated>2024-03-24T15:27:17Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: Dawhite4 uploaded a new version of File:StudentTaskTable FullUI Medium.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153375</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153375"/>
		<updated>2024-03-24T15:26:14Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_FullUI_Medium.png&amp;diff=153374</id>
		<title>File:StudentTaskTable FullUI Medium.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_FullUI_Medium.png&amp;diff=153374"/>
		<updated>2024-03-24T15:26:06Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153373</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153373"/>
		<updated>2024-03-24T15:25:25Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
[[File:StudentTaskTable_FullUI_Medium.jpeg]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_FullUI_Medium.jpeg&amp;diff=153372</id>
		<title>File:StudentTaskTable FullUI Medium.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:StudentTaskTable_FullUI_Medium.jpeg&amp;diff=153372"/>
		<updated>2024-03-24T15:25:15Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153371</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153371"/>
		<updated>2024-03-24T15:24:26Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
[[File:E2429_StudentTaskTable_FullUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153370</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153370"/>
		<updated>2024-03-24T15:23:55Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Current View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
E2429_StudentTaskTable_FullUI.png&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2429_StudentTaskTable_FullUI.png&amp;diff=153369</id>
		<title>File:E2429 StudentTaskTable FullUI.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2429_StudentTaskTable_FullUI.png&amp;diff=153369"/>
		<updated>2024-03-24T15:23:16Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153367</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153367"/>
		<updated>2024-03-24T15:18:03Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: /* Lazy Loading */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session.&lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153366</id>
		<title>CSC/ECE 517 Spring 2024 - E2429 Reimplement student task list</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list&amp;diff=153366"/>
		<updated>2024-03-24T15:14:30Z</updated>

		<summary type="html">&lt;p&gt;Dawhite4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] application is a collaborative platform used by students and instructors for managing assignments, peer reviews, and feedback. The current student task list interface&lt;br /&gt;
lacks responsiveness, usability, and performance. The objective is to reimplement the frontend of the student task list using React JS and TypeScript. This reimplementation aims to enhance the user experience, improve task management, and optimize performance.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The project will focus on the following features:&lt;br /&gt;
# Dynamic Task Table: Display a table listing student assignments. columns: Assignment name, course, topic, current stage, review grade, badges, stage deadline, and publishing rights.Implement sorting and filtering functionalities for efficient task navigation.&lt;br /&gt;
# Responsive Design: Prioritize accessibility and user-friendly layouts.&lt;br /&gt;
# Lazy Loading: Optimize performance by loading content only when necessary.Improve page load times for a smoother user experience.&lt;br /&gt;
&lt;br /&gt;
== Dummy Data ==&lt;br /&gt;
&lt;br /&gt;
=====Interfaces=====&lt;br /&gt;
&lt;br /&gt;
The interfaces were designed as a prototype for testing purposes. The future team working on the backend needs to modify it as needed.&lt;br /&gt;
&lt;br /&gt;
The implementation can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/interfaces.ts here]&lt;br /&gt;
&lt;br /&gt;
Duty and StudentsTeamedWith is for the side box.&lt;br /&gt;
&lt;br /&gt;
Revision's purpose is undefined for now, so leave it empty, the future team should delete it if it is proved to be redundant.&lt;br /&gt;
&lt;br /&gt;
IStudentTask is for the main table of student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export interface Duty {&lt;br /&gt;
  name: string;&lt;br /&gt;
  dueDate: string;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface Revision {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
export interface StudentsTeamedWith {&lt;br /&gt;
  [semester: string]: string[];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Interface for matching columns to assignment table columns&lt;br /&gt;
export interface IStudentTask {&lt;br /&gt;
  name: string;&lt;br /&gt;
  course_name: string;&lt;br /&gt;
  topic: string;&lt;br /&gt;
  current_stage: string;&lt;br /&gt;
  review_grade: {&lt;br /&gt;
    comment: string;&lt;br /&gt;
  };&lt;br /&gt;
  has_badge: boolean;&lt;br /&gt;
  stage_deadline: Date&lt;br /&gt;
  publishing_rights: boolean&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====JSON File=====&lt;br /&gt;
&lt;br /&gt;
JSON File are also created for the purpose of testing, the future team should delete this file if the data can be successfully retrieved from the database. &lt;br /&gt;
&lt;br /&gt;
JSON File can be found [https://github.com/ychen-207523/reimplementation-front-end/blob/main/src/pages/StudentTasks/assignments.json here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;assignments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Ruby&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: {&lt;br /&gt;
                &amp;quot;comment&amp;quot;: &amp;quot;3/5&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Rails&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 517&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Git&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: true,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/18&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: false&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;AI&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;in progress&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/25&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;course_name&amp;quot;: &amp;quot;CSC 522&amp;quot;,&lt;br /&gt;
            &amp;quot;topic&amp;quot;: &amp;quot;Random Forest&amp;quot;,&lt;br /&gt;
            &amp;quot;current_stage&amp;quot;: &amp;quot;finished&amp;quot;,&lt;br /&gt;
            &amp;quot;review_grade&amp;quot;: &amp;quot;N/A&amp;quot;,&lt;br /&gt;
            &amp;quot;has_badge&amp;quot;: false,&lt;br /&gt;
            &amp;quot;stage_deadline&amp;quot;: &amp;quot;3/28&amp;quot;,&lt;br /&gt;
            &amp;quot;publishing_rights&amp;quot;: true&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;duties&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC517-Assignment 3&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-18&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 1&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-25&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;CSC522-Assignment 2&amp;quot;,&lt;br /&gt;
            &amp;quot;dueDate&amp;quot;: &amp;quot;2024-03-28&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;revisions&amp;quot;: [&lt;br /&gt;
&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;studentsTeamedWith&amp;quot;: {&lt;br /&gt;
        &amp;quot;CSC540, Fall 2023&amp;quot;: [&amp;quot;classmate one&amp;quot;, &amp;quot;classmate two&amp;quot;, &amp;quot;classmate three&amp;quot;, &amp;quot;classmate four&amp;quot;],&lt;br /&gt;
        &amp;quot;CSC515, Spring 2024&amp;quot;: [&amp;quot;classmate five&amp;quot;, &amp;quot;classmate six&amp;quot;, &amp;quot;classmate seven&amp;quot;]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Student Task Page ===&lt;br /&gt;
&lt;br /&gt;
==== Dummy Data ====&lt;br /&gt;
The fetching of the data and rendering of the table slightly differs due to the fact that data is being called from a local JSON file as apposed to being fetched via an API.&lt;br /&gt;
&lt;br /&gt;
The UI is contained within the file src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
Data is imported from the JSON file in the following as follows: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import testData from './assignments.json';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Therefore the table data is defined as follows:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&lt;br /&gt;
However when actually importing from the backend the following import will likely be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
import useAPI from &amp;quot;hooks/useAPI&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be the API call to the backend to retrieve the student tasks from the DB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Prior UI StudentTasks Table.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:New UI StudentTasks Table.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Create new student assignments / tasks table utilizing TypeScript to implement main features and functionalities prior version.&lt;br /&gt;
* Added a search box at the top for searching any input related to assignments.&lt;br /&gt;
* Added a dropdown for every column to filter assignments accordingly.&lt;br /&gt;
* Added a page navigation feature under the table.&lt;br /&gt;
&lt;br /&gt;
==== Code Changes ====&lt;br /&gt;
&lt;br /&gt;
===== New TypeScript Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
There are three main files associated with the rendering of this table and the Student Tasks UI as a whole:&lt;br /&gt;
&lt;br /&gt;
1) src/pages/StudentTasks/StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
   Renders the UI and contains the logic for the table.&lt;br /&gt;
&lt;br /&gt;
2) src/pages/StudentTasks/StudentTaskColumns.tsx&lt;br /&gt;
   Defines the table's columns.&lt;br /&gt;
&lt;br /&gt;
3) src/components/Table/Table.tsx&lt;br /&gt;
   Defines the base logic for the table implementation.&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications + UI Guidence =====&lt;br /&gt;
We edited the class src/components/Table/Table.tsx to have a accommodate three different options for searching the columns: a dropdown, a search box (input) or neither.&lt;br /&gt;
&lt;br /&gt;
in Interface TableProps see:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
interface TableProps {&lt;br /&gt;
  // other properties...&lt;br /&gt;
&lt;br /&gt;
  // new property for search control&lt;br /&gt;
  columnSearchMode?: 'none' | 'input' | 'dropdown';&lt;br /&gt;
  dropdownOptions?: Record&amp;lt;string, string[]&amp;gt;; // if 'dropdown', provide options for each column&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We defined the default column search property to be a search box (input) as seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Table.tsx&lt;br /&gt;
&lt;br /&gt;
const Table: React.FC&amp;lt;TableProps&amp;gt; = ({&lt;br /&gt;
  // other properties...&lt;br /&gt;
  columnSearchMode = 'input' // default when creating a Table &lt;br /&gt;
  &lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a feature of our implementation and design, the developer has options for choosing which columnSearchMode to implement:&lt;br /&gt;
&lt;br /&gt;
Currently, columnSearchMode is parameterized with the dropdown option as seen in UI of table above.&lt;br /&gt;
&lt;br /&gt;
Therefore when rendering the table in StudentTasks.tsx, columnSearchMode can be parametrized with 3 different options based on the developer's choosing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Parameterizing columnSearchMode with 'none' or 'input' is as simple as entering said parameter name, nothing else is required and the UI should render.&lt;br /&gt;
&lt;br /&gt;
However, for 'dropdown', the dropdownOptions prop needs to be included to pull data for the dropdown.&lt;br /&gt;
&lt;br /&gt;
=== Side Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
Previous UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Original.png]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Current UI:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:Side Box UI Current.png]]&lt;br /&gt;
&lt;br /&gt;
Changes&amp;lt;br/&amp;gt;&lt;br /&gt;
* Transfer all the code from Ruby on Rails views to React and TypeScript.&lt;br /&gt;
* Delete the line between Course Name and the start of team member list&lt;br /&gt;
* Add the line between the end of team member list and Course Name&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&lt;br /&gt;
&lt;br /&gt;
This task was implemented mainly in two files: &amp;lt;strong&amp;gt;StudentTasks.css&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;StudentTasksBox.tsx&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* StudentTasks.css &lt;br /&gt;
This file contains the majority of the styles of this box.&lt;br /&gt;
&lt;br /&gt;
* StudentTasksBox.tsx&lt;br /&gt;
&lt;br /&gt;
First, defined interface for the table data and pass these data as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface StudentTasksBoxParameter {&lt;br /&gt;
  duties: Duty[];&lt;br /&gt;
  revisions: Revision[];&lt;br /&gt;
  studentsTeamedWith: StudentsTeamedWith;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need to define a function to calculate days left with the the current time and due time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const calculateDaysLeft = (dueDate: string) =&amp;gt; {&lt;br /&gt;
    const today = new Date();&lt;br /&gt;
    const date = new Date(dueDate);&lt;br /&gt;
    const differenceInTime = date.getTime() - today.getTime();&lt;br /&gt;
    const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));&lt;br /&gt;
    return differenceInDays &amp;gt; 0 ? differenceInDays : 0;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to filter out those assignments that have not yet reached their due date.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const tasksNotStarted = duties.filter(duty =&amp;gt; (calculateDaysLeft(duty.dueDate) &amp;gt; 0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we can display the data as intended template&lt;br /&gt;
&lt;br /&gt;
Task not yet start&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        &amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;{tasksNotStarted.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt; Tasks not yet started&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
      {tasksNotStarted.map(task =&amp;gt; {&lt;br /&gt;
        const daysLeft = calculateDaysLeft(task.dueDate);&lt;br /&gt;
        const dayText = daysLeft &amp;gt; 1 ? 'days' : 'day';&lt;br /&gt;
        return (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;span&amp;gt; &amp;amp;nbsp; &amp;amp;raquo; {task.name} ({daysLeft} {dayText} left)&amp;lt;/span&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        )&lt;br /&gt;
      })}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Student who have teamed with you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
        Students who have teamed with you&amp;lt;br /&amp;gt;&lt;br /&gt;
      &amp;lt;/strong&amp;gt;&lt;br /&gt;
      &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
        Object.entries(studentsTeamedWith).map(([semester, students]) =&amp;gt; (&lt;br /&gt;
          &amp;lt;div&amp;gt;&lt;br /&gt;
            &amp;lt;strong&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;span className=&amp;quot;tasknum&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
              {students.length}&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;amp;nbsp;&amp;amp;nbsp;{semester}&lt;br /&gt;
              &amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
            {students.map((student =&amp;gt; (&lt;br /&gt;
              &amp;lt;div&amp;gt;&lt;br /&gt;
                &amp;lt;span className=&amp;quot;notification&amp;quot;&amp;gt;&amp;amp;nbsp; &amp;amp;raquo; {student} &amp;lt;/span&amp;gt;&lt;br /&gt;
              &amp;lt;/div&amp;gt;&lt;br /&gt;
            )))}&lt;br /&gt;
            &amp;lt;br/&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        ))&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lazy Loading ===&lt;br /&gt;
&lt;br /&gt;
In order to increase website responsiveness and improve overall performance, several optimizations can be made. One optimization implemented involved the use of lazy loading components, delaying sending components to the client until the client page &amp;quot;needs&amp;quot; them. &lt;br /&gt;
&lt;br /&gt;
By default, React applications typically bundle all javascript files so that the user has all necessary files it needs to explore and interact with the whole site. This isn't a problem for small applications, but as the size of the application grows, the user may be sent more and more data at first load, meaning there is a longer initial load time and that the user may waste network bandwidth to get code for pages they will never visit. &lt;br /&gt;
&lt;br /&gt;
Lazy loading solves this issue by allowing developers to delay the loading of components until they are first used. Any components which are loaded lazily are not sent on initial page load, but instead sent only when the browser needs them to render a view. This can result in more network transactions between the client and server, but can greatly reduce the size of these transactions, particularly the first one. Since this is a common problem, React offers a simple API for it, allowing users to mark components as lazy, surround them with a &amp;lt;Suspense&amp;gt; tag and give a fallback component to render until the data has been fetched for the component itself. &lt;br /&gt;
&lt;br /&gt;
https://react.dev/reference/react/lazy&lt;br /&gt;
&lt;br /&gt;
To improve the responsiveness of the site, we decided to use lazy loading for the components of the student task list. The page is primarily made up of a Table component (which renders the student task table) and a StudentTasksBox component, which renders a summary of the student's important information in a box on the left side of the screen. To make these changes, we just had to change how the components were imported and wrap the rendering of the components in the appropriate component (Suspense). &lt;br /&gt;
&lt;br /&gt;
Lazy Loading of the Table and StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load components lazily. &lt;br /&gt;
const Table = lazy(() =&amp;gt; fakeDelay(import('../../components/Table/Table')));&lt;br /&gt;
const StudentTasksBox = lazy(() =&amp;gt; fakeDelay(import('./StudentTasksBox')));&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading table...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;Table&lt;br /&gt;
            data={tableData}&lt;br /&gt;
            columns={tableColumns}&lt;br /&gt;
            columnSearchMode={'dropdown'} // Can be 'none', 'input', or 'dropdown'&lt;br /&gt;
            dropdownOptions={dropdownOptions}&lt;br /&gt;
            headerCellStyle={{background: &amp;quot;#f2f2f2&amp;quot;}}&lt;br /&gt;
            // ... other props&lt;br /&gt;
          /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Component Wrapping for of the StudentTasksBox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;Suspense fallback={&amp;lt;span&amp;gt;Loading Task box...&amp;lt;/span&amp;gt;}&amp;gt;&lt;br /&gt;
          &amp;lt;StudentTasksBox&lt;br /&gt;
            duties={duties}&lt;br /&gt;
            revisions={taskRevisions}&lt;br /&gt;
            studentsTeamedWith={studentsTeamedWith} /&amp;gt;&lt;br /&gt;
        &amp;lt;/Suspense&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As shown above, we gave a JSX tag to the fallback prop to indicate what should be rendered until the component has finished loading.&lt;br /&gt;
&lt;br /&gt;
As a result of these changes, the StudentTasksBox and Table components are not loaded by the application until the user navigates to the student_tasks page, meaning the user will experience faster initial load times, decreased browser memory usage, and may experience less network bandwidth if the entirety of the application isn't visited in a given session. &lt;br /&gt;
&lt;br /&gt;
== Current View ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
React.js &lt;br /&gt;
Typescript&lt;br /&gt;
&lt;br /&gt;
Fork from this repo:&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/ychen-207523/reimplementation-front-end &amp;lt;br/&amp;gt;&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please follow the video instructions for the setup of the project given in the README in the backend repository.&lt;br /&gt;
&lt;br /&gt;
=== Connecting Reimplementation Frontend and Reimplementation Back end ===&lt;br /&gt;
After setting up remote interpreter, run below commands in bash:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
rake db:create&lt;br /&gt;
&lt;br /&gt;
rake db:migrate&lt;br /&gt;
&lt;br /&gt;
rails s -p 4000 -b '0.0.0.0'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run below commands in terminal for backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u dev -pexpertiza&lt;br /&gt;
&lt;br /&gt;
use reimplementation_development;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After this run insert commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO institutions (name, created_at, updated_at) VALUES ('North Carolina State University', NOW(), NOW())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now open a terminal, run below cmd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rails console&lt;br /&gt;
&lt;br /&gt;
BCrypt::Password.create('password123')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy output of above cmd in some file.&lt;br /&gt;
&lt;br /&gt;
Run below command in backend:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INSERT INTO users (name, email, password_digest, role_id, created_at, updated_at, full_name, institution_id) VALUES ('admin', 'admin2@example.com', '$2a$12$TWct/jRMKbb1Pm1NtxKmPuAkk8IOIHnJyBaU4eiMQ5MjV41Se0AXG', 1, NOW(), NOW(), 'admin admin', 1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run React.js (Frontend) from VS Code:&lt;br /&gt;
&lt;br /&gt;
In the project directory, you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Runs the app in the development mode.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Launches the test runner in the interactive watch mode.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
npm run build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Builds the app for production to the build folder.&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Open http://localhost:3000 to view it in the browser.&lt;br /&gt;
&lt;br /&gt;
Login details: admin (password123)&lt;br /&gt;
&lt;br /&gt;
In case it doesn’t work: Try deleting the rsa_keys.yml file in ruby mine and try login again.&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
As mentioned in the CHANGES section, we used test data for our tables. The data is called from a JSON file in the same folder as our Student Task UI src/pages/StudentTasks/assignments.json.&lt;br /&gt;
&lt;br /&gt;
In order to call data from the SQL server running on the backend, we need to retrieve it using API endpoints. Some of tables may need added or deleted columns to appropriately coincide with the current table column structure.&lt;br /&gt;
&lt;br /&gt;
Moreover, some of the imports and API calls are already coded into src/pages/StudentTasks/StudentTasks.tsx but not complete as it was not necessary for merely changing the front end portion of the project.&lt;br /&gt;
&lt;br /&gt;
useAPI import commented out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Removed useAPI import as it's currently not needed for JSON data. Uncomment when fetching data from an API.&lt;br /&gt;
// import useAPI from &amp;quot;hooks/useAPI&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will likely need to create a constant that coincides with an API call to the assignments table, and make sure that table has all the necessary columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const StudentTasks = () =&amp;gt; {&lt;br /&gt;
  // These hooks can be uncommented and used when integrating API calls&lt;br /&gt;
  // const { error, isLoading, data: studentTasks, sendRequest: fetchStudentTasks } = useAPI();&lt;br /&gt;
  // const { data: coursesResponse, sendRequest: fetchCourses } = useAPI();&lt;br /&gt;
&lt;br /&gt;
  const duties = testData.duties;&lt;br /&gt;
  const taskRevisions = testData.revisions;&lt;br /&gt;
  const studentsTeamedWith = testData.studentsTeamedWith;&lt;br /&gt;
&lt;br /&gt;
  // Commented out useEffect for fetching student tasks from an API. Uncomment when needed.&lt;br /&gt;
  /*&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchStudentTasks({ url: '/assignments' }); // Verify this is the correct endpoint&lt;br /&gt;
  }, [fetchStudentTasks]);&lt;br /&gt;
  */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making sure the data being called is from the SQL server is likely more complicated since it is an API call vs a direct call to a local file. The constant tableData will likely need to be altered in a way that allows for proper fetching of data via the API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Memoize the table data to use assignments from testData&lt;br /&gt;
  const tableData = useMemo(() =&amp;gt; testData.assignments, []);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally when calling data from the SQL server, we’ll likely need to handle errors of the API calls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// StudentTasks.tsx&lt;br /&gt;
&lt;br /&gt;
// Render the component with the Table component and necessary controls&lt;br /&gt;
  return (&lt;br /&gt;
    &amp;lt;div className=&amp;quot;student-tasks&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Container fluid className=&amp;quot;px-md-4&amp;quot;&amp;gt;&lt;br /&gt;
        {/* Uncomment and adjust error handling when integrating with API calls&lt;br /&gt;
        {error &amp;amp;&amp;amp; &amp;lt;div className=&amp;quot;alert alert-danger&amp;quot; role=&amp;quot;alert&amp;quot;&amp;gt;{error}&amp;lt;/div&amp;gt;}&lt;br /&gt;
        */}&lt;br /&gt;
        &amp;lt;Row className=&amp;quot;mb-2&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Col&amp;gt;&lt;br /&gt;
            &amp;lt;h2&amp;gt;Assignments&amp;lt;/h2&amp;gt;&lt;br /&gt;
          &amp;lt;/Col&amp;gt;&lt;br /&gt;
        &amp;lt;/Row&amp;gt;&lt;br /&gt;
// ...rest of table rendering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Dawhite4</name></author>
	</entry>
</feed>