E2157. Fix issues related to deadlines and late policies
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 continuation on the previous work done at #E1978
- Issue 1 - Code is missing comments.
- Issue 2 - Two flash messages were removed which 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.
Approach & Fix
Issue 1: Code is missing comments.
Adding comments to the late policy code flow for better readability.
Issue 2: Two flash messages were removed which were conveying what went wrong.
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.
Add test file for late_policies_controller_spec.rb with appropriate test cases 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
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