CSC/ECE 517 Spring 2022 - E2236: Fix issues related to deadlines and late policies: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 55: Line 55:
==Project Scope==
==Project Scope==
[[File:517_Final_flow_chart.drawio.png|600px]]
[[File:517_Final_flow_chart.drawio.png|600px]]
=== Files and methods to be refactored ===
#Issue 1
We need to check how to store assignment information into session and fix it.
##app/views/late_policies/new.html.erb
##app/views/assignments/edit/_due_dates.html.erb
##app/controllers/assignments_controller.rb
#Issue 2
##app/views/late_policies/new.html.erb
##app/views/assignments/edit/_due_dates.html.erb
##app/controllers/assignments_controller.rb
We need to check how to store assignment information into session and fix it.
#sign_up_sheet_controller.rb
##switch_original_topic_to_approved_suggested_topic
###Change usage of is_waitlisted attribute in the signed_up_teams table to use the new table
###Add additional checks and transactions to make sure perform operations in an atomic way in case of failures.
#sign_up_sheet.rb
##cancel_all_wailists (typo in code) - This method currently does 2 things, it cancels waitlist and also updates the signed_up_team topic which needs to be split
##create_SignUpTeam
###It checks if topic has slots if yes it adds to signed up team, else creates a signup as waitlist
###This method should use the new table and call the helper functions of waitlist to perform actions on waitlists
#sign_up_topic.rb
##users_on_waiting_list - Move method to fetch all users on waitlist for a topic to waitlist_teams method.
##assign_to_first_waiting_team - The same functionality is being called in multiple places, it should be made DRY and moved to the waitlist_teams model
##reassign_topic - Use methods that perform actions on waitlist that should be moved to waitlist_helper, also use transactions to make it atomic.
##update_waitlisted_users - Move method to waitlist_teams model and use the new table
##find_slots_waitlisted - Move method to waitlist_teams model
##find_waitlisted_topics - Move method to waitlist_teams model
#suggestion_controller.rb
##notification
##Clean waitlist functionality should be moved to a method in waitlist_teams model. team id should be passed as a parameter to delete the waitlist for that team.
#invitation.rb
##remove_waitlists_for_team
###Removing from waitlist and adding to team to sign up should be as a single transaction
###There should be additional checks to make sure that there is enough space left before adding team to signed_up_sheet
###All functionality should be moved to waitlist_helper and implemented in a robust and dry manner


== Testing ==
== Testing ==

Revision as of 22:19, 11 April 2022

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

The following issues have been raised in the current implementation:

  • Issue 1 - When creating a late policy, the “back” link does not take the user back to editing the assignment.


  • Issue 2 - After creating a late policy, the “back” link does not take the user back to editing the assignment.



  • Issue 3 - After checking the "Apply penalty policy" box and clicking the 'save' or 'create' button on the Due dates tab, the box is unchecked on page refresh.




  • Issue 4 - There is also no indication of this penalty policy for students, and no proof it actually works




  • Issue 5 - No Botton navigating to the list of all late policies



  • Issue 6 - When creating/editing an assignment, you can’t see the detail of each late policy

  • Issue 7 - Adding test cases to check the late policy applied actually works to subtract points from the students.

Refactoring and Design Patterns

Since our goal is to fix existing functionalities we will not be updating the existing design patterns being employed in the code. Yet, we would like to discuss what makes these refactoring important. Refactoring is a systematic process of improving code without creating new functionality. Thus, a key to the success of our project is ensuring everything that was working before our changes work even after our changes have been added. To ensure this, we will continue to test the system after each issue has been fixed. This will allow us to ensure two things:

  • We are only changing what we set out to change when fixing a particular issue.
  • We are not breaking what was working before we deployed our fix.

We believe at the end our changes will increase the quality of Expertiza and improve the experience for users an developers alike.

Project Scope

Files and methods to be refactored

  1. Issue 1

We need to check how to store assignment information into session and fix it.

    1. app/views/late_policies/new.html.erb
    2. app/views/assignments/edit/_due_dates.html.erb
    3. app/controllers/assignments_controller.rb


  1. Issue 2
    1. app/views/late_policies/new.html.erb
    2. app/views/assignments/edit/_due_dates.html.erb
    3. app/controllers/assignments_controller.rb

We need to check how to store assignment information into session and fix it.


  1. sign_up_sheet_controller.rb
    1. switch_original_topic_to_approved_suggested_topic
      1. Change usage of is_waitlisted attribute in the signed_up_teams table to use the new table
      2. Add additional checks and transactions to make sure perform operations in an atomic way in case of failures.
  2. sign_up_sheet.rb
    1. cancel_all_wailists (typo in code) - This method currently does 2 things, it cancels waitlist and also updates the signed_up_team topic which needs to be split
    2. create_SignUpTeam
      1. It checks if topic has slots if yes it adds to signed up team, else creates a signup as waitlist
      2. This method should use the new table and call the helper functions of waitlist to perform actions on waitlists
  3. sign_up_topic.rb
    1. users_on_waiting_list - Move method to fetch all users on waitlist for a topic to waitlist_teams method.
    2. assign_to_first_waiting_team - The same functionality is being called in multiple places, it should be made DRY and moved to the waitlist_teams model
    3. reassign_topic - Use methods that perform actions on waitlist that should be moved to waitlist_helper, also use transactions to make it atomic.
    4. update_waitlisted_users - Move method to waitlist_teams model and use the new table
    5. find_slots_waitlisted - Move method to waitlist_teams model
    6. find_waitlisted_topics - Move method to waitlist_teams model
  4. suggestion_controller.rb
    1. notification
    2. Clean waitlist functionality should be moved to a method in waitlist_teams model. team id should be passed as a parameter to delete the waitlist for that team.
  5. invitation.rb
    1. remove_waitlists_for_team
      1. Removing from waitlist and adding to team to sign up should be as a single transaction
      2. There should be additional checks to make sure that there is enough space left before adding team to signed_up_sheet
      3. All functionality should be moved to waitlist_helper and implemented in a robust and dry manner

Testing

Testing Goals and Test Objects

  1. When logging in as a student:
    1. You can see the late policy details of your assignments
    2. The late policy works correctly if you submit your assignment late
  2. When logging in as an instructor:
    1. There is a button to navigate you to the page showing all the late policies
    2. You can see the details of the late policy when creating or editing an assignment
    3. The "back" button will lead to a correct webpage when creating or editing an assignment
    4. The "Apply penalty policy" box is saved after submitting the form when creating or editing an assignment

RSpec Unit Tests

Test cases provided here, will add RSpec code blocks for the final submission

  • Student Waitlist
Scenario: Getting added to the waitlist for a topic 
 Given: Logged in as a Student
  When: The topic for an assignment has no available slots
   And: Student tries to signup for a topic
  Then: The team that the student is a part of should be added to the waitlist for the topic.
Scenario: Getting enrolled in a topic 
 Given: Logged in as a Student
  When: The topic for an assignment has available slots
   And: Student tries to signup for a topic
  Then: The team that the student is a part of should be enrolled for the topic.
Scenario: All waitlisted topics getting dropped
 Given: Logged in as a Student
  When: Student gets enrolled into a course for which he was waitlisted before.
  Then: The team that the student is a part of should be dropped from the remaining waitlisted topics.
Scenario: All waitlisted teams getting dropped
 Given: Logged in as a Student
  When: The deadline for a topic passes.
  Then: All the waitlisted teams for that particular topic must be dropped.
Scenario: Getting enrolled in a topic
 Given: Logged in as a Student
  When: The enrolled team for a topic drops
  Then: The team that was waitlisted earlier for the topics must be enrolled.

Regression Testing

In order to ensure complete coverage, testing of the changes done between the end of last semester and this project will be done to ensure that old test cases still pass.

  1. Make sure all existing waitlist functionality still passes

Project Mentors

  • Nicholas Himes

Team Members

  • Zhiyuan Ma
  • Gaolin Zhang
  • Zhijin Yang
  • Yuyang Jiang

Useful Links

E2236

  1. GitHub Repository

Expertiza

  1. Expertiza on GitHub
  2. Live Expertiza website