CSC/ECE 517 Fall 2014/oss E1502 wwj: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 21: Line 21:


==What We Have Done==
==What We Have Done==
{| class="wikitable"
|-
! style="width:13%;"|Method Name
! style="width:33%;"|Changes Made
! style="width:43%;"|Reason For Change
|- style="vertical-align:top;"
| Copy
| Extract the content of this method as copy_questionnaires method and put it in questionnaire.rb
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model.
|-
| edit
| Deleted the old edit method
| The old edit method was not getting called due to ruby rules
|-
| new_feedback
| Deleted the old new_feedback method
| The old new_feedback method was not getting called due to ruby rules
|-
| view
| Deleted the old view method
| The old view method was not getting called due to ruby rules
|-
| redirect_when_disallowed
| rowspan="2" | Moved all of the code from redirect_when_disallowed to action_allowed and changed all of the references
| rowspan="2" | Authorization to perform actions wasn't being performed correctly, it is supposed to be done through action_allowed?
|-
| action_allowed?
|}

Revision as of 01:57, 21 March 2015

E1502: Questionnaire Controller Refactoring

Introduction to Expertiza

Project Description

What it does:

Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.

  • Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.
  • Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire
  • Turn the questionnaire into a “form object.” The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.

    Other classes involved:

  • questionnaire.rb
  • quiz_questionnaire.rb
  • questions_controller.rb

    What needs to be done:

  • Move quiz related functions to quiz_questionnaire.rb.
  • copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.
  • Debug output (print statements) should be removed.
  • Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.

    What We Have Done

    Method Name Changes Made Reason For Change
    Copy Extract the content of this method as copy_questionnaires method and put it in questionnaire.rb The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model.
    edit Deleted the old edit method The old edit method was not getting called due to ruby rules
    new_feedback Deleted the old new_feedback method The old new_feedback method was not getting called due to ruby rules
    view Deleted the old view method The old view method was not getting called due to ruby rules
    redirect_when_disallowed Moved all of the code from redirect_when_disallowed to action_allowed and changed all of the references Authorization to perform actions wasn't being performed correctly, it is supposed to be done through action_allowed?
    action_allowed?