E1466, Refactor grades_controller

Project Description

Classes involved: grades_controller.rb

What it does:

This class lists the grades of all the participants for an assignments and also their reviews. Instructor can edit scores, calculate penalties and send emails for conflicts.

What needs to be done:

1. Modify calculate_all_penalties method which is too complex and long.

2. Put the get_body_text method in a mailer rather than in the grades_controller.

3. Refactor conflict_nofication method to conflict_email and make it delegated to the mailer.

4. Refactor view_my_scores method to grades_show and delete the unnecessary variables.

5. Try not to query for reviews and meta reviews in grades_show method.

What we have done:

1. Modify calculate_all_penalties method.

2. Refactor the conflict_notification method to conflict_email method.

3. Simplify sending email function and make it delegated to the mailer.

4. Send a conflict email to the reviewer automatically when instructor click the button “email reviewer”.

5. Remove get_body_text and send_grading_email method from grades_controller.

6. Refactor conflict_nofication method to conflict_email and make it delegated to the mailer.

7. Use Design Pattern Delegation in ConflictMailer.

8. Refactor view_my_scores method to grades_show method.

9. Search for the key reasons which lead to huge waiting time for getting score.

10. Refactor get_assessments_for method in response_map.rb and lead to more than 90% off the original view scores' running time.

11. Eliminate the search for reviews and meta reviews during the grades_show method.

12. Delete unnecessary instance Variables.

Extra Credits:

1. Refactor get_assessments_for method in response_map.rb and lead to more than 90% off the original view scores' running time.

2. Use Design Pattern Delegation in ConflictMailer.

3. Send a conflict email to the reviewer automatically when instructor click the button “email reviewer”.
This is really bad.  The old code referred to deadline types by name, but the new code uses magic subscripts!  If the deadline_types table changes, this code is in trouble!  If should use the NAMES of these deadlines instead.