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”.
All right. We will change it ASAP.

Thank you very much.

On Mon, Dec 1, 2014 at 10:36 AM, Andrew Kofink <notifications@github.com>
wrote:

> In app/controllers/grades_controller.rb:
>
> >      @scores = @assignment.get_scores(@questions)
> >      calculate_all_penalties(@assignment.id)
> >    end
> >
> > -  def view_my_scores
> > -    @participant = AssignmentParticipant.find(params[:id])
> > -    @average_score_results = ScoreCache.get_class_scores(@participant.id)
> > -
> > -    @statistics = @average_score_results
> > -
> > -    @average_reviews = ScoreCache.get_reviews_average(@participant.id)
> > -    @average_metareviews = ScoreCache.get_metareviews_average(@participant.id)
> > +  #the show_reviews action lists all the reviews they received.
> > +  def show_reviews
> > +    @partial='grades/'+params[:path]
>
> Only pass one (or maybe two) instance variables to the view.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/expertiza/expertiza/pull/436/files#r21095482>.
>