E2157. Fix issues related to deadlines and late policies

From Expertiza_Wiki
Jump to navigation Jump to search

Problem Description

Expertiza can automatically deduct points if a student is late in performing some action (e.g., submitting or reviewing). This is implemented by defining a new “late policy” and applying it to the assignment. Late policies are managed on the Due dates tab of assignment creation (or editing). The team found some issues in the current implementation which either cause errors are completely not functional. The goal of this project is to eliminate these issues by making necessary changes and adding new test cases which cover all scenarios.

Issues with the Current Implementation

This Project will be a continuation of the previous work done at #E1978

Following problems were fixed in the previous work:

  • In the UI, the policy is sometimes called a “late policy” and sometimes a “penalty policy”. To avoid confusion, use “late policy” exclusively.
  • Late policies cannot be created without raising an error.
  • After creating a late policy, the “back” link does not take the user back to editing the assignment.
  • The "+" and "-" buttons for Show/Hide Date Updater do not work. Expertiza has a way of adjusting due dates for a new assignment.

While reviewing these changes, Expertiza developers raised the following issues/comments :

  • Issue 1 - Code is missing comments.
  • Issue 2 - Two flash messages were removed that were conveying what went wrong.
  • Issue 3 - late_policy.rb and late_policies_controller.rb doesn't have any tests.
  • Issue 4 - have a test to check the min penalty as well rather than just the cap.

These issues have made it difficult for the team to merge changes into the live code and thus our goal is to fix these issues and make the code ready for deployment.

Problem description, Approach & Fix

Issue 1: Code is missing comments.

Problem Description: These changes were part of an already extensive implementation and thus the lack of comments makes it hard to follow the code. Proper use of commenting can make code maintenance much easier, as well as helping make finding bugs faster. Further, commenting is very important when writing functions that other people will use.

Fix: Adding comments to the late policy code flow for better readability.

Issue 2: Two flash messages were removed which were conveying what went wrong.

Problem Description: The flash messages were good enough and helped convey what went wrong. Without them, it could be difficult for a user to figure out their mistakes and make it harder for them to make corrections. Retaining them will make our system more user-friendly.

Fix: Ensure that all correct error messages are flashed to the user.

Issue 3: Neither late_policy.rb nor late_policies_controller.rb have any tests at all. Define a test plan, and write appropriate tests for these classes.

Problem Description: The purpose of a test case is to determine if different features within a system are performing as expected and to confirm that the system satisfies all related standards, guidelines, and customer requirements. The process of writing a test case can also help reveal errors or defects within the system.

Fix: 1. Add test file for late_policies_controller_spec.rb with appropriate test cases.

2. Add test file for late_policies_spec.rb with appropriate test cases

Issue 4: Have a test to check the min penalty as well rather than just the cap and make sure all checks pass

Problem Description: Currently we do not have a test that can also check the min penalty. Though it does not break anything, it will be a good to have check in the system.

Fix: Add new test cases wherever required in the code and increase the test coverage and also ensure all existing test cases are passing and functionality is working as expected.


Expected Results

We expect the new code changes should not break existing functionality and the following results upon completion:

  • Issue 1 - Once this issue is fixed, the Due Dates tab while editing an assignment will have no ambiguity between "late policy" and "penalty policy", as "late policy" will be used exclusively.



  • Issue 2 - Once this issue is fixed, late policies can be created and saved successfully without raising the "The following error occurred while saving the penalty policy:" error.



  • Issue 3 - Once this issue is fixed, the back link after creating a late policy will rightly take the user to the General tab on the Edit Assignment page.



  • Issue 4 - Once this issue is fixed, "+" and "-" buttons for Show/Hide Date Updater will work and update all the dates relative to the first date keeping the days gap between all the dates the same as before.



  • Issue 5 - The code coverage will increase once tests for late_policy.rb and late_policies_controller.rb are written.





Test Plan


Before fix

Manual Testing ()

Log in to Expertiza as an Instructor by entering the credentials: Username: instructor6, Password: password

The following route is common to testing all the issues:

 Welcome page -> Manage Assignments -> Select a Course -> Select Edit option for any assignment -> Edit Assignment (General) ->

Issue 1 -

 Due Dates -> No 'penalty policy' on the page. 

Issue 2 -

 Due Dates -> New late policy -> Enter information and Create -> Late policy is successfully created and saved. 

Issue 3 -

 Due Dates -> New late policy -> Enter information and Create -> Back -> Edit Assignment (General) 

Issue 4 -

 Due Dates -> Show/Hide Date Updater -> Enter number of days -> Hit + / - 


Automated Testing Using RSpec

We plan to create two new files, late_policy_spec.rb and late_policies_controller_spec.rb to write tests for late_policy.rb and late_policies_controller.rb repesctively.


Automated Testing Using Capybara

We plan to create UI test framework using Capybara with Cucumber that automates the manual testing path and saves time and repetitive effort. These tests will be written prior to code and define the expected behavior of policy controller.

Coverage

To make sure we are covering all of our code with test cases we will use the Ruby Code Coverage plugin of RubyMine and SimpleCov gem. After manually running the test file, the SimpleCov gem will highlight the lines of code which are being covered by our test cases in green color, and for those which are not being covered in red.

Milestones

10/25 – Project Selection

11/03 – Develop Project Design Document

Project Mentors

  • Tirth Patel

Team Members

  • Anmol Lunavat
  • Shubham Waghe
  • Vishal Sharma

Useful Links

E2157

  1. GitHub forked repository
  2. Pull Request

Expertiza

  1. Expertiza on GitHub
  2. Live Expertiza website