<?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=Hmckinn</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=Hmckinn"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Hmckinn"/>
	<updated>2026-09-28T11:52:42Z</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=156062</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=156062"/>
		<updated>2024-04-23T18:08:19Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Rspec/Rswag */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
&amp;lt;strong&amp;gt; Participant Lookup:&amp;lt;/strong&amp;gt; The StudentTask model includes a method &amp;lt;strong&amp;gt; from_participant_id &amp;lt;/strong&amp;gt; which first finds the Participant object by ID using &amp;lt;strong&amp;gt; Participant.find_by(id: id)&amp;lt;/strong&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt; Task Creation: &amp;lt;/strong&amp;gt; After retrieving the participant, it utilizes &amp;lt;strong&amp;gt; create_from_participant &amp;lt;/strong&amp;gt; to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== JSON Rendering ======&lt;br /&gt;
Once the StudentTask instance is created, the controller action finalizes the process by rendering the student task data as JSON. This step makes it possible for the frontend to consume and display the data appropriately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
render json: @student_task&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&lt;br /&gt;
&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. Accordingly, we have tested the following cases for the `view` function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;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;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the `view` controller:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  path '/api/v1/student_tasks/view' do&lt;br /&gt;
    get 'Retrieve a specific student task by ID' 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 parameters to send with request.&lt;br /&gt;
      parameter name: 'id', in: :query, type: :Integer, required: true&lt;br /&gt;
      parameter name: 'Authorization', in: :header, type: :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request with a valid ID gets a 200 response.&lt;br /&gt;
      response '200', 'successful retrieval of a student task' do&lt;br /&gt;
        let(:'Authorization') { &amp;quot;Bearer #{@token}&amp;quot; }&lt;br /&gt;
        let(:id) { 1 }&lt;br /&gt;
&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data['assignment']).to be_instance_of(String)&lt;br /&gt;
          expect(data['current_stage']).to be_instance_of(String)&lt;br /&gt;
          expect(data['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
          expect(data['topic']).to be_instance_of(String)&lt;br /&gt;
          expect(data['permission_granted']).to be_in([true, false])&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;
The test first scopes a path and defines a GET request. It specifies parameters for 'id' and 'Authorization' to simulate an authorized access to a specific student task. The `run_test!` function validates the response code and content:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized request retrieves the task with correct attributes.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        let(:'Authorization') { &amp;quot;Bearer #{@token}&amp;quot; }&lt;br /&gt;
        let(:id) { 1 }&lt;br /&gt;
&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to include('assignment')&lt;br /&gt;
          expect(data).to include('current_stage')&lt;br /&gt;
          expect(data).to include('stage_deadline')&lt;br /&gt;
          expect(data).to include('topic')&lt;br /&gt;
          expect(data['permission_granted']).to be_in([true, false])&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 the correctness of the response as well as verify that the response includes essential attributes of the student task. We also ensure that these attributes are of the expected types and that the function handles partial or missing data accordingly.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156060</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=156060"/>
		<updated>2024-04-23T18:05:34Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Rspec/Rswag */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
&amp;lt;strong&amp;gt; Participant Lookup:&amp;lt;/strong&amp;gt; The StudentTask model includes a method &amp;lt;strong&amp;gt; from_participant_id &amp;lt;/strong&amp;gt; which first finds the Participant object by ID using &amp;lt;strong&amp;gt; Participant.find_by(id: id)&amp;lt;/strong&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt; Task Creation: &amp;lt;/strong&amp;gt; After retrieving the participant, it utilizes &amp;lt;strong&amp;gt; create_from_participant &amp;lt;/strong&amp;gt; to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== JSON Rendering ======&lt;br /&gt;
Once the StudentTask instance is created, the controller action finalizes the process by rendering the student task data as JSON. This step makes it possible for the frontend to consume and display the data appropriately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
render json: @student_task&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&lt;br /&gt;
### The `view` Function in `StudentTasksController`&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. Accordingly, we have tested the following cases for the `view` function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;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;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this is part of the first test for the `view` controller:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  path '/api/v1/student_tasks/view' do&lt;br /&gt;
    get 'Retrieve a specific student task by ID' 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 parameters to send with request.&lt;br /&gt;
      parameter name: 'id', in: :query, type: :Integer, required: true&lt;br /&gt;
      parameter name: 'Authorization', in: :header, type: :string&lt;br /&gt;
&lt;br /&gt;
      # Ensure an authorized request with a valid ID gets a 200 response.&lt;br /&gt;
      response '200', 'successful retrieval of a student task' do&lt;br /&gt;
        let(:'Authorization') { &amp;quot;Bearer #{@token}&amp;quot; }&lt;br /&gt;
        let(:id) { 1 }&lt;br /&gt;
&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data['assignment']).to be_instance_of(String)&lt;br /&gt;
          expect(data['current_stage']).to be_instance_of(String)&lt;br /&gt;
          expect(data['stage_deadline']).to be_instance_of(String)&lt;br /&gt;
          expect(data['topic']).to be_instance_of(String)&lt;br /&gt;
          expect(data['permission_granted']).to be_in([true, false])&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;
The test first scopes a path and defines a GET request. It specifies parameters for 'id' and 'Authorization' to simulate an authorized access to a specific student task. The `run_test!` function validates the response code and content:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Ensure an authorized request retrieves the task with correct attributes.&lt;br /&gt;
      response '200', 'authorized request has proper JSON schema' do&lt;br /&gt;
        let(:'Authorization') { &amp;quot;Bearer #{@token}&amp;quot; }&lt;br /&gt;
        let(:id) { 1 }&lt;br /&gt;
&lt;br /&gt;
        run_test! do |response|&lt;br /&gt;
          data = JSON.parse(response.body)&lt;br /&gt;
          expect(data).to include('assignment')&lt;br /&gt;
          expect(data).to include('current_stage')&lt;br /&gt;
          expect(data).to include('stage_deadline')&lt;br /&gt;
          expect(data).to include('topic')&lt;br /&gt;
          expect(data['permission_granted']).to be_in([true, false])&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 the correctness of the response as well as verify that the response includes essential attributes of the student task. We also ensure that these attributes are of the expected types and that the function handles partial or missing data gracefully.&lt;br /&gt;
&lt;br /&gt;
==== Swagger UI ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156058</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=156058"/>
		<updated>2024-04-23T17:51:23Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
&amp;lt;strong&amp;gt; Participant Lookup:&amp;lt;/strong&amp;gt; The StudentTask model includes a method &amp;lt;strong&amp;gt; from_participant_id &amp;lt;/strong&amp;gt; which first finds the Participant object by ID using &amp;lt;strong&amp;gt; Participant.find_by(id: id)&amp;lt;/strong&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt; Task Creation: &amp;lt;/strong&amp;gt; After retrieving the participant, it utilizes &amp;lt;strong&amp;gt; create_from_participant &amp;lt;/strong&amp;gt; to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== JSON Rendering ======&lt;br /&gt;
Once the StudentTask instance is created, the controller action finalizes the process by rendering the student task data as JSON. This step makes it possible for the frontend to consume and display the data appropriately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
render json: @student_task&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156057</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=156057"/>
		<updated>2024-04-23T17:47:43Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Model Interaction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
&amp;lt;strong&amp;gt; Participant Lookup:&amp;lt;/strong&amp;gt; The StudentTask model includes a method &amp;lt;strong&amp;gt; from_participant_id &amp;lt;/strong&amp;gt; which first finds the Participant object by ID using &amp;lt;strong&amp;gt; Participant.find_by(id: id)&amp;lt;/strong&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt; Task Creation: &amp;lt;/strong&amp;gt; After retrieving the participant, it utilizes &amp;lt;strong&amp;gt; create_from_participant &amp;lt;/strong&amp;gt; to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156056</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=156056"/>
		<updated>2024-04-23T17:47:17Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Model Interaction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
&amp;lt;strong&amp;gt; Participant Lookup:&amp;lt;/strong&amp;gt; The StudentTask model includes a method &amp;lt;strong&amp;gt; from_participant_id &amp;lt;/strong&amp;gt; which first finds the Participant object by ID using &amp;lt;strong&amp;gt; Participant.find_by(id: id)&amp;lt;/strong&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt; Task Creation: &amp;lt;/strong&amp;gt; After retrieving the participant, it utilizes create_from_participant to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156055</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=156055"/>
		<updated>2024-04-23T17:46:11Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Model Interaction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
&amp;lt;strong&amp;gt; Participant Lookup:&amp;lt;/strong&amp;gt; The StudentTask model includes a method from_participant_id which first finds the Participant object by ID using Participant.find_by(id: id).&lt;br /&gt;
Task Creation: After retrieving the participant, it utilizes create_from_participant to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156052</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=156052"/>
		<updated>2024-04-23T17:45:03Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====== Model Interaction ======&lt;br /&gt;
Participant Lookup: The StudentTask model includes a method from_participant_id which first finds the Participant object by ID using Participant.find_by(id: id).&lt;br /&gt;
Task Creation: After retrieving the participant, it utilizes create_from_participant to construct a new StudentTask instance. This method takes the participant object and extracts various attributes to form a data structure representing the student task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// student_task.rb&lt;br /&gt;
&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
    create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.create_from_participant(participant)&lt;br /&gt;
    new(&lt;br /&gt;
        assignment: participant.assignment.name,&lt;br /&gt;
        topic: participant.topic,&lt;br /&gt;
        current_stage: participant.current_stage,&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline),&lt;br /&gt;
        permission_granted: participant.permission_granted,&lt;br /&gt;
        participant: participant&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156051</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=156051"/>
		<updated>2024-04-23T17:40:02Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
====== Data Retrieval ======&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@student_task = StudentTask.from_participant_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156050</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=156050"/>
		<updated>2024-04-23T17:38:58Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Controller (View Function) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&gt;
&lt;br /&gt;
After finishing the implementation of list, we moved on to the ''view'' function. Here is the prior design of that function:&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 prior design is to provide detailed information about a specific student task based on the participant id, then it gathers different information from the participant along with the other required information such as topic and time line. Therefore, the student task is highly related with participant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 'view' function in the is designed to provide detailed information about a specific student task by accessing data associated with a given participant ID. This endpoint is crucial for the front-end in order to display data about an participant's specific student task, such as their team, review status, scores, and other basic information.  Below is an explanation of how this controller action is implemented and its integration with other components.&lt;br /&gt;
&lt;br /&gt;
===== Implementation Details =====&lt;br /&gt;
===== Data Retrieval =====&lt;br /&gt;
The function starts by capturing a participant's ID from the request parameters. The ID directly corresponds to the participant involved associated with the student task.&lt;br /&gt;
It then calls a model method to retrieve the associated StudentTask based on this ID, encapsulating the logic to fetch and construct the student task data from the participant's details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth, one can find the valid value in the network tab of the inspect tool. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, click execute. &lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png | 1000 px]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
As shown in the picture, the result returns OK, meaning that the request is sent successfully.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The view function cannot be tested at current stage, since the view page has not been implemented in our frontend, the HTTP status will be 404, suggesting that this page cannot be found. After the view page is implemented, please update the SwaggerUI and add view API.&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>Hmckinn</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=156033</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=156033"/>
		<updated>2024-04-23T17:22:15Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Links ==&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;
Pull Request - Frontend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-front-end/pull/38&lt;br /&gt;
&lt;br /&gt;
Pull Request - Backend:&lt;br /&gt;
https://github.com/expertiza/reimplementation-back-end/pull/102&lt;br /&gt;
&lt;br /&gt;
Test video: &lt;br /&gt;
https://youtu.be/IidhwZ_PBq8&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;
&lt;br /&gt;
==== Frontend ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;frontend: &amp;lt;/strong&amp;gt; The frontend is the the continue implementation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2429_Reimplement_student_task_list E2429]. The purpose of this improvement is to implement the features to retrieve the data of student tasks from the backend by API calls. Here are the key changes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const fetchData = useCallback(async () =&amp;gt; {&lt;br /&gt;
    try {&lt;br /&gt;
      const [assignments, courses] = await Promise.all([&lt;br /&gt;
        fetchStudentTasks({ url: `/student_tasks/list` }),&lt;br /&gt;
        fetchAssignments({ url: `/assignments` }),&lt;br /&gt;
        fetchCourses({ url: '/courses' }),&lt;br /&gt;
      ]);&lt;br /&gt;
      // Handle the responses as needed&lt;br /&gt;
    } catch (err) {&lt;br /&gt;
      // Handle any errors that occur during the fetch&lt;br /&gt;
      console.error(&amp;quot;Error fetching data:&amp;quot;, err);&lt;br /&gt;
    }&lt;br /&gt;
  }, [fetchStudentTasks, fetchAssignments, fetchCourses]);&lt;br /&gt;
  // fetch data from backend&lt;br /&gt;
  useEffect(() =&amp;gt; {&lt;br /&gt;
    fetchData();&lt;br /&gt;
  }, [fetchData]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The student task contains the data from several tables including participant and assignment. The first step is to access this data via an API. The name of the assignment can be retrieved from assignment table, and the course name can be obtained from the course table. After we successfully retrieved the data from the database, the next step is to merge them together so they can be passed to the Table. To achieve this goal, we create a new merged dataset that integrates student_task, assignments, and courses. After this step, the mergedData is passed to table component.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let mergedData: Array&amp;lt;any &amp;amp; { courseName?: string }&amp;gt; = [];&lt;br /&gt;
&lt;br /&gt;
  if (studentTasks &amp;amp;&amp;amp; assignmentResponse &amp;amp;&amp;amp; coursesResponse) {&lt;br /&gt;
    mergedData = studentTasks.data.map((studentTask: any) =&amp;gt; {&lt;br /&gt;
      // Find the related assignment from assignmentResponse using assignment name&lt;br /&gt;
      const assignment = assignmentResponse.data.find((a: any) =&amp;gt; a.name === studentTask.assignment);&lt;br /&gt;
      // Using the course_id from the related assignment, find the course from coursesResponse&lt;br /&gt;
      const course = coursesResponse.data.find((c: any) =&amp;gt; c.id === assignment.course_id);&lt;br /&gt;
      return {&lt;br /&gt;
        ...studentTask,&lt;br /&gt;
        courseName: course ? course.name : 'Unknown', // Add the course name to the merged data&lt;br /&gt;
      };&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Model ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;student_task.rb:&amp;lt;/strong&amp;gt; The class represents the student task used in the assignments page. Here is the breakdown of this model:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def self.create_from_participant(participant)&lt;br /&gt;
      new(&lt;br /&gt;
        assignment: participant.assignment.name,                          # Name of the assignment associated with the student task&lt;br /&gt;
        topic: participant.topic,                                         # Current stage of the assignment process&lt;br /&gt;
        current_stage: participant.current_stage,                         # Participant object&lt;br /&gt;
        stage_deadline: parse_stage_deadline(participant.stage_deadline), # Deadline for the current stage of the assignment&lt;br /&gt;
        permission_granted: participant.permission_granted,               # Topic of the assignment&lt;br /&gt;
        participant: participant                                          # Boolean indicating if Publishing Rights is enabled&lt;br /&gt;
      )&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
create_from_participant creates a StudentTask instance from a Participant object. Because in Expertiza, student task is a temporal data that shares the same data with participant. The assignment name can used to link to assignment table, from which we can retrieve course information. This design follows the &amp;lt;strong&amp;gt;DRY&amp;lt;/strong&amp;gt; principle by using the existing data in the database. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_user(user)&lt;br /&gt;
      Participant.where(user_id: user.id)&lt;br /&gt;
                 .map { |participant| StudentTask.create_from_participant(participant) }&lt;br /&gt;
                 .sort_by(&amp;amp;:stage_deadline)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method generates an array of StudentTask instances for all participants linked to an user of provided id. The array is sorted by the stage deadline.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.from_participant_id(id)&lt;br /&gt;
      create_from_participant(Participant.find_by(id: id))&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This method creates a StudentTask instance using a participant identified by a given ID by calling create_from_participant method. It takes participant id as a parameter, then retrieves the participant's details from the database using the find_by method, and use the participant to create an instance of student_task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
==== Controller (List Function) ====&lt;br /&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;
&lt;br /&gt;
==== Controller (View Function) ====&lt;br /&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;
&amp;lt;i&amp;gt;spec/models/student_task_spec.rb&amp;lt;/i&amp;gt;(https://github.com/ychen-207523/reimplementation-back-end/blob/main/spec/models/student_task_spec.rb): &amp;lt;br/&amp;gt;&lt;br /&gt;
This file is to test student_task model and ensure that the class methods and attributes behave as expected.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe StudentTask, type: :model do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @assignment = double(name: &amp;quot;Final Project&amp;quot;)&lt;br /&gt;
    @participant = double(&lt;br /&gt;
      assignment: @assignment,&lt;br /&gt;
      topic: &amp;quot;E2442&amp;quot;,&lt;br /&gt;
      current_stage: &amp;quot;finished&amp;quot;,&lt;br /&gt;
      stage_deadline: &amp;quot;2024-04-23&amp;quot;,&lt;br /&gt;
      permission_granted: true&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is desgined to provide the test data befor each test. Double object can be used to represent an actual object, in this case, we use double to represent the assignment and participant for our test cases. The following is a breakdown for our tests:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; initialize test: This test checks if the new studentTask instance is created with correct attributes. &lt;br /&gt;
&amp;lt;li&amp;gt; from_participant test: This tests that creates a new StudentTask instance from a Participant object. It checks that the method correctly assigned the attributes to the new instance of studentTask. &lt;br /&gt;
&amp;lt;li&amp;gt; parse_stage_deadline test: This test checks the method parse_stage_deadline, make sure it can correctly parse the date string to a Time object. The first part of the test checks when the method receives a valid date string. The second part of the test checks when it receives an invalid date string, it should returns a time one year from the current date. For the purpose of testing, we set the Now to be 2024-05-01. So, the correct return value will be 2025-05-01.&lt;br /&gt;
&amp;lt;li&amp;gt; from_participant_id test: This test checks method to get a Participant by id and then use that participant to create a StudentTask instance. For the test purpose, we use let the participant to retrieve the mocked participant data, and then checks if the create_from_participant can receive the correct participant. &lt;br /&gt;
&amp;lt;/ul&amp;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;
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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /api/v1/student_tasks/list:&lt;br /&gt;
      get:&lt;br /&gt;
        summary: List all Student Tasks&lt;br /&gt;
        tags:&lt;br /&gt;
          - Student Tasks&lt;br /&gt;
        responses:&lt;br /&gt;
          '200':&lt;br /&gt;
            description: An array of student tasks&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Sagger UI is to check if the API request can be sent to list all student tasks correctly.&lt;br /&gt;
The first step it to run Swagger UI and provide a valid bearerAuth. After the authencation is succeed, find the Student Tasks tags and click Try it out. Since list function does not require any parameter, just click execute.&lt;br /&gt;
[[File:Screenshot 2024-04-23 131809.png]]&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>Hmckinn</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=154873</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=154873"/>
		<updated>2024-04-07T19:39:01Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Project Board */&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;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
== Principles ==&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>Hmckinn</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=154872</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=154872"/>
		<updated>2024-04-07T19:33:38Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Process */&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;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
== Principles ==&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;
The implementation can be found [Put link here for 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>Hmckinn</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=154867</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=154867"/>
		<updated>2024-04-07T18:21:57Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: &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;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
&lt;br /&gt;
== Process ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====SubTest====&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=154866</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=154866"/>
		<updated>2024-04-07T18:15:22Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
&lt;br /&gt;
====SubTest====&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=154865</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=154865"/>
		<updated>2024-04-07T18:15:08Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
&lt;br /&gt;
=====SubTest=====&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=154864</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=154864"/>
		<updated>2024-04-07T18:14:31Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Test ==&lt;br /&gt;
&lt;br /&gt;
=====SubTest=====&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153351</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=153351"/>
		<updated>2024-03-24T10:58:03Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Future Scope */&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;
== 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>Hmckinn</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=153350</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=153350"/>
		<updated>2024-03-24T10:56:42Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Future Scope */&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;
== 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 bel altered.&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;
&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;
&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>Hmckinn</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=153349</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=153349"/>
		<updated>2024-03-24T10:53:00Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Future Scope */&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;
== 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;
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;
&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;
 // 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>Hmckinn</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=153348</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=153348"/>
		<updated>2024-03-24T10:51:18Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Future Scope */&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;
== 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;
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;
&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;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153287</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=153287"/>
		<updated>2024-03-24T01:16:21Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Dropdown Feature &amp;amp; Developer Implications + UI Guidence */&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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153285</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=153285"/>
		<updated>2024-03-24T01:14:29Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Dropdown Feature &amp;amp; Developer Implications */&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;
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;
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;
 &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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153240</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=153240"/>
		<updated>2024-03-24T00:17:31Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Dropdown Feature &amp;amp; Developer Implications */&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 =====&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;
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;
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;
=== 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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153234</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=153234"/>
		<updated>2024-03-23T23:59:50Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* New TypeScrip Student Tasks Table */&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 =====&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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153218</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=153218"/>
		<updated>2024-03-23T23:45:21Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* 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 TypeScrip Student Tasks Table =====&lt;br /&gt;
&lt;br /&gt;
===== Dropdown Feature &amp;amp; Developer Implications =====&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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153210</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=153210"/>
		<updated>2024-03-23T23:38:13Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Dummy Data */&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;
=== 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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153202</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=153202"/>
		<updated>2024-03-23T23:27:06Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: &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;
&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;
=== 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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153195</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=153195"/>
		<updated>2024-03-23T23:23:34Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* Student Task Table */&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;
=== 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;
=== 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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153187</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=153187"/>
		<updated>2024-03-23T23:16:15Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: /* UI 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 Table ===&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;
=== 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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_UI_StudentTasks_Table.png&amp;diff=153186</id>
		<title>File:New UI StudentTasks Table.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_UI_StudentTasks_Table.png&amp;diff=153186"/>
		<updated>2024-03-23T23:13:15Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: New UI for student tasks table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
New UI for student tasks table&lt;/div&gt;</summary>
		<author><name>Hmckinn</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Prior_UI_StudentTasks_Table.png&amp;diff=153185</id>
		<title>File:Prior UI StudentTasks Table.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Prior_UI_StudentTasks_Table.png&amp;diff=153185"/>
		<updated>2024-03-23T22:53:47Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: The old UI of the student tasks table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
The old UI of the student tasks table&lt;/div&gt;</summary>
		<author><name>Hmckinn</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=153184</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=153184"/>
		<updated>2024-03-23T22:46:46Z</updated>

		<summary type="html">&lt;p&gt;Hmckinn: Added sections for main table&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 Table ===&lt;br /&gt;
&lt;br /&gt;
=== Main Table ===&lt;br /&gt;
&lt;br /&gt;
==== UI changes ====&lt;br /&gt;
&lt;br /&gt;
==== Code changes ====&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;
== 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;
&lt;br /&gt;
== Team ==&lt;/div&gt;</summary>
		<author><name>Hmckinn</name></author>
	</entry>
</feed>