CSC/ECE 517 Spring 2022 - E2241: Heatgrid fixes and improvements: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 123: Line 123:
   In the original beta implementation, whenever the relevant view file is loaded, it is calling the method "populate_view_model" present in the "grades_controller.rb" file. This method, is explicitly calling another model method to calculate metric. Whenever a new metric is added, we will have to make a call to that metric in the populate view model. This is not ideal as each new metric added is introducing a new line of code in the controller body. It is also not possible to determine the metrics present dynamically. To deal with this problem, we introduced a new parent method "calculate_metrics" in model file "vm_question_response.rb". This method is responsible for calling other individual methods that calculate metrics. The call to this method is replacing the explicit calls to metric calculation in the controller. This essentially is breaking the dependency between new metric introduction and the controller. Now, whenever a new metric is added, there is no need to introduce any code changes in the controller, instead we just have to change the code in relevant model file.
   In the original beta implementation, whenever the relevant view file is loaded, it is calling the method "populate_view_model" present in the "grades_controller.rb" file. This method, is explicitly calling another model method to calculate metric. Whenever a new metric is added, we will have to make a call to that metric in the populate view model. This is not ideal as each new metric added is introducing a new line of code in the controller body. It is also not possible to determine the metrics present dynamically. To deal with this problem, we introduced a new parent method "calculate_metrics" in model file "vm_question_response.rb". This method is responsible for calling other individual methods that calculate metrics. The call to this method is replacing the explicit calls to metric calculation in the controller. This essentially is breaking the dependency between new metric introduction and the controller. Now, whenever a new metric is added, there is no need to introduce any code changes in the controller, instead we just have to change the code in relevant model file.
</p>
</p>
[[File:Heatgrid-2022-10.png|600px]]
[[File:Heatgrid-2022-11.png|600px]]
[[File:Heatgrid-2022-13.png|600px]]





Revision as of 00:54, 26 April 2022

This page provides information about the documentation of E2241: Heatgrid fixes and improvements as part of CSC/ECE 517 Spring 2022 Final project.

Team

Mentor

  • Nicholas Himes (nnhimes)

Team Members (PinkPatterns)

  • Eshwar Chandra Vidhyasagar Thedla (ethedla)
  • Gokul Krishna Koganti (gkogant)
  • Jyothi Sumer Goud Maduru (jmaduru)
  • Suneha Bose (sbose2)

Heat Grid

Heat Grid refers to a part of view in Expertiza that shows review scores of all the reviews done for a particular assignment. It shows scores given for each rubric by peer reviewers. This is used by instructors to assign scores to individual assignments and by students to view review scores of their assignment. Our project scope involves dealing with fixing issues related to the heat grid and any subsequent bugs that might arrive.

Issues identified

Issue #2019: Restrict teammates from reviewing their own work

There are some instances where a student was shown as reviewing his/her team even though the "Allow Self Review" checkbox was not checked by the instructor. This situation should not arise for practical purposes. Test cases must be extensively added so that we can be notified if the bug occurs again.

Issue #1869: Deal with the metrics of the heat grid

metric-1 column name in the heat grid follows bad naming convention. It doesn't explain what the column refers to. This must be changed to make the column name more apt.

As of now, the heat grid uses only one metric (metric-1). We must facilitate the system for addition of new metrics. Instructors should be able to toggle between various metrics as per their preferences. This can be done by the use of a drop down menu.

Plan of work

Issue #2019: Restrict teammates from reviewing their own work

Relevant bug of this issue can’t be reproduced to deal with it. So comprehensive test cases must be written to be notified if the bug arises again. We are planning to add rspec unit tests covering the following cases:

  • If the instructor unchecks “ Allow self review” option
    1. Instructor should not be able to assign a student to review work that he/she has submitted.
    2. Instructor should not be able to assign a student to review work that their teammate has submitted.
    3. Students should not be able to review work he/she has submitted.
    4. Students should not be able to review work a teammate has submitted.
  • If the instructor checks “ Allow self review” option
    1. Instructor should be able to assign a student to review work that he/she has submitted.
    2. Instructor should be able to assign a student to review work that their teammate has submitted.
    3. Students should be able to review work he/she has submitted.
    4. Students should be able to review work a teammate has submitted.

Issue #1869: Deal with the metrics of the heat grid

The new metrics can be added to the Metrics table that we will create. While creating an assignment/ editing an assignment, the instructor can select a metric from the Metrics table which will be available as a dropdown menu. We will retrieve the metric selected for the assignment by the instructor and display it in the Heatgrid Map of reviews.

  • In create/edit assignment, the instructor will see ‘Metric Type’ drop down which has list of metrics based on the values in the database
  • Save the selected metric type and update the value in the database
  • Retrieve the metric type from the assignment and calculate the value of the metric
  • Display the values of the metric in the Heatgrid view

Proposed Control Flow

UML Diagram


Design Principle

For Issue #1869 we plan to use the Factory Design Pattern since we are dealing with the creation of multiple kinds of metrics. As part of our implementation, we plan on using a metric interface, which can be implemented by different concrete metric classes. A factory class acts as a middleman between the implementations and the main class that instantiates the objects. Based on the instructor's selection, the main class requests the metric object from the factory class, rather than dealing with the creation logic on its own. This pattern, therefore, enforces encapsulation and results in the low coupling, the principle which is our primary target for this project scope.

The previous implementation has dealt with issue #1869. But the drawback with the implementation is that it renders a code that is highly coupled. Whenever a new metric is added two files (assignments/edit/_general.html.erb and grades/view_team.html.erb) are to be changed, resulting in high coupling. As a consequence, tests pertaining to the highly coupled codes require new tests as a new metric is added. This is undesirable. So, the principle of low coupling is the main focus of our implementation. This principle will enable a common set of tests that would be valid for any number of metrics that will potentially be added in the future.

Files to be targeted

Issue #2019

Test file for adding test cases to implement self-reviews checks

  • spec/controllers/grades_controller_spec.rb

Issue #1869

For Heat grid view

  • app/views/grades/_view_heatgrid.html.erb
  • app/views/grades/view_team.html.erb
  • app/helpers/grades_helper.rb
  • app/controllers/grades_controller.rb
  • app/models/vm_question_response.rb
  • app/models/vm_question_row.rb
  • assets/view_team_in_grades.js

For Assignment view

  • app/views/assignment/edit/_general.html.erb
  • app/controllers/assignments_controller.rb

Implementation of Issue 1869

Previous team’s implementation

The previous team has dealt with the issue by changing “metric-1” to “verbose comment count”, which is relevant to what metric-1 refers to. For the latter half of the issue, they have provided a metric dropdown for the instructor to select while creating the assignment. This consequently requires only one metric to be displayed on the heat grid for which they’ve given a toggle option to show and hide the metric.

Changes reflected in the UI

  • metric-1 changed to verbose comment count
  • Metric dropdown provided while creating an assignment

Issue with previous team's implementation

The critical problem with their changes was, when in future a new metric is added, it forces a change in two view files: one time in assignments/edit/_general.html.erb and two times in grades/view_team.html.erb. Requiring these changes in view files that have little relevance to the heat grid is essentially causing high coupling.


Current implementation

Issue Goal

Our mentor has required us to display metrics in the heat grid with a toggle option for the user to select only the required metrics according to their preferences. This should be done keeping in mind low coupling as the primary design goal. These changes should be accompanied by minor changes such as adding comments and changing the name of “metric-1” to a self-indicative name.

Implementation details

In the original beta implementation, whenever the relevant view file is loaded, it is calling the method "populate_view_model" present in the "grades_controller.rb" file. This method, is explicitly calling another model method to calculate metric. Whenever a new metric is added, we will have to make a call to that metric in the populate view model. This is not ideal as each new metric added is introducing a new line of code in the controller body. It is also not possible to determine the metrics present dynamically. To deal with this problem, we introduced a new parent method "calculate_metrics" in model file "vm_question_response.rb". This method is responsible for calling other individual methods that calculate metrics. The call to this method is replacing the explicit calls to metric calculation in the controller. This essentially is breaking the dependency between new metric introduction and the controller. Now, whenever a new metric is added, there is no need to introduce any code changes in the controller, instead we just have to change the code in relevant model file.


Adding a new metric in future

Test plan


Test Plan

Video Demo

The video link will be provided after the final submission.

Primary Goal of Testing

  • Capybara Test cases for testing the UI of heat grid view with the expected metric for the respective assignment and the UI of team view with relevant metric selected with all other metrics in the dropdown
  • Spec test cases for testing the grades controller and assignment controller to check if they are returning the values as expected
  • Unit test cases will be added to verify the logic behind the methods to calculate the values for their metrics

RSpec Tests

Functional Tests

Scenario: Visibility of Metric dropdown list in New Assignment
Given Instructor has logged in
When Instructor visits New Assignment page
Then Metric dropdown list is visible
Scenario: Visibility of Metric dropdown list in Edit Assignment
Given Instructor has logged in
When Instructor visits Edit Assignment page
Then Metric dropdown list is visible
Scenario: Visibility of selected metric in instructor's Assign Grade view
Given Instructor has logged in
When Instructor visits on Assign Grade page
Then Selected metric is visible in heatgrid map
Scenario: Visibility of selected metric in student's View Scores view
Given Student has logged in
When Student visits View Scores page
Then Selected metric is visible in heatgrid map

Unit Tests

Scenario: The output for the metric “Comment Count”
Given: Instructor is logged in
When: Instructor selects metric as “Comment Count” for an assignment
Then: outputs 15 for the comment “The team has documented everything on the wiki page very properly following all the guidelines”
Scenario: The output for the metric “Comment Count”
Given: Instructor is logged in
When: Instructor selects metric as “Comment Count” for an assignment
Then: outputs 0 for the comment “”

Regression Tests

When the new functionalities are implemented and added, make sure the existing functionalities and test cases still pass.

Important Links