E1868 remove reports from review mapping controller

From Expertiza_Wiki
Revision as of 02:26, 21 November 2018 by Skeerth (talk | contribs) (→‎Test Plan)
Jump to navigation Jump to search

Background

review_mapping_controller is the largest controller in Expertiza with 614 lines of code. The basic functionality of this controller is to assign reviewers to review artefacts or submissions by other participants or teams. But this controller includes a major chunk of code for generating and rendering several reports to the instructors. As part of the project E1837[1], the review_mapping_controller.rb file has been significantly modified to improve maintainability, code quality and code readability. To summarize, the review_mapping_controller was modified by separating the report generation functionality into a new helper named report_formatter_helper. This helper serves the logic for rendering different reports as per the instructor's request, thus segregating the controller specific code from the code for rendering the reports.

Refactoring from E1837 served as one of the primary design improvements to achieve scalability with different reports. But, this improvement contradicts with the single responsibility Object-Oriented Design Principles. The aim of this project is to extrapolate the report_formatter_helper code into a reports_controller.

Goals

- Separation of concerns
- Generalize code to render reports
- Modify the UI to list reports
- Testing the newly introduced reports_controller

Separation of Concerns

The reports and reviews are two different components which should not be clubbed. As part of this refactoring, the existing design of review_mapping_controller handles the following two different functionalities:

1. Manage various reviewers
2. Display and manage different reports

This violates the single responsibility principle[2] by handling two different functionalities. This project aims to segregate these functionalities into the following two controllers:

1. review_mapping_controller to manage the functionalities of reviewers
2. reports_controller to handle the reports functionalities

Generalize code to display reports

The reports provide functionality such as presenting reviews for grading, showing author feedback (rejoinders), showing a table of all teammate reviews, showing a calibration report in an assignment where students rate the same work that has been previously rated by an instructor, and showing how many answers students have tagged.

Every report boils down to one single idea i.e. loop through either participants or teams. This loop can be generalized so that the layout (includes headers, footers etc) can be consistent across reports while delivering the desired content.

Modify the UI to list reports

In the current implementation, the reports are accessed by clicking on the “view review report” button in the buttons tray of an assignment, which leads into the review report page. This page contains a drop-down menu listing various reports to navigate to.

This two-step navigation to view the reports can be converted into a single step. There are two ways of doing so:

1. Introduce a new ‘...’ icon in the buttons tray, which on hovering on it, would show the menu of various reports
2. Rename the "view review report" button to reports with a drop down menu listing all the report types

Testing the new controller

Since the logic for report generation has been abstracted into a new controller, existing tests for report generation must be verified for regression and also check for improving the code coverage statistics.

Implementation specifics

Refactored Design

In order to follow good design practices, the logic to differentiate reports will be implemented using Strategy Pattern[3].

Currently, there are eight different reports

1. Review report
2. Author feedback report
3. Teammate review report
4. Aggregated comments by rubric question
5. Comment summary by reviewee (team)
6. Potential collusion report
7. Answer tagging report
8. Calibration report

The new implementation will have ReportStrategy class with following subclasses

- ReviewReportStrategy
- AuthorFeedbackReportStrategy
- TeammateReviewReportStrategy
- RubricQuestionReportStrategy
- RevieweeCommentReportStrategy
- CollusionReportStrategy
- AnswerTagReportStrategy
- CalibrationReportStrategy

Below is a simple UML diagram of these new classes

File:Report strategy compressed 85 keerthi.jpg

Modified UI

1. One of the proposed changes to existing UI involves adding a new button to the buttons tray. For the assignment ‘Final Project (and Design Document)’ below, hovering over the ‘...’ icon (highlighted in the red box) should bring up the menu of additional reports. The image is only an illustration.



2. Another proposed change is to modify "view review report" button to "view reports" drop-down menu listing all the available reports for the respective assignment.

Test Plan

File:Report use case 75 compressed E1868.jpg

We are using RSpec testing framework to test our review mapping controller. We are planning to implement the following test cases:

1 When the type is SummaryByRevieweeAndCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.
2 When the type is SummaryByCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.
3 When the type is ReviewResponseMap we check the corresponding report data is rendered. This returns participants, average and range.
4 When the type is FeedbackResponseMap and assignment has varying_rubrics_by_round feature we check the corresponding report data is rendered. It should return participants.
5 When the type is FeedbackResponseMap and when assignment does not have varying_rubrics_by_round feature we check the corresponding page to report is rendered and participants are rendered.
6 When the type is TeammateReviewResponseMap we check that there is a correct mapping between the participant and its response. We will return participant for the corresponding response.
7 When the type is Calibration and participant variable is nil we check if the correct report is rendered or not.
8 When the type is PlagiarismCheckerReport we check if the correct report page is rendered or not.