CSC/ECE 517 Fall 2015/oss E1560 PSV

From Expertiza_Wiki
Revision as of 05:17, 31 October 2015 by Pdeka (talk | contribs)
Jump to navigation Jump to search

E1560. Refactoring PopUpController.rb and ParticipantsController.rb

This page provides a description of the Expertiza based OSS project. This project is aimed at refactoring PopUpController.rb and ParticipantsController.rb.


Introduction to Expertiza

Expertiza is an Open Source Rails application which is used by instructors and students for creating assignments and submitting peer reviews. Expertiza allows the instructor to create and customize assignments, create a list of topics the students can sign up for, have students work on teams and then review each other's assignments at the end. The Source code of the application can be cloned from Github.

Project Desicription<ref>https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit</ref>

Files involved:

PopUpController.rb

ParticipantsController.rb

What they do

PopUpController displays a review when a user (instructor or student) clicks on a list of reviews.

ParticipantsController handles participants in an assignment.

What's wrong with them:

PopUpController contains only two prominent methods, but they are very big.

ParticipantsController contains redundant code.

What needs to be done:

1 PopUpController.rb

1.1 Action_allowed method always returns true. It needs to be fixed.

1.2 Team_user_popup method needs refactoring. @teamId is assigned but never used. Add comments to make code more readable. Rename variables based on their usage

1.3 Instance variables need to be changed to local variable wherever possible.

1.4 Refactor Participants_popup and team_users_popup methods into smaller private methods.

2 ParticipantsController.rb

2.1 In add and update_authorization methods, permissions collection object can be used to reference its elements without assigning each element to individual private variables.

2.2 Inherit and bequeath_all methods are similar. Common statements can be migrated to private method. Add comments in code to make it easy to understand.

2.3 Cluster all the flash messages under one private method to make the code more manageable

2.4 Fix email_sent method. It contains a dummy email address.

Changes Made<ref>https://github.com/viveksubbarao/expertiza/commits/master</ref>

PopUpController.rb

Case 1.1: Modified Action_allowed method to return true only if ..

Case 1.2: Refactored Team_user_popup method

Case 1.3: Redundant instance variables changed to local variables

Case 1.4: Refactored Participants_popup and team_users_popup methods into smaller private methods

ParticipantsController.rb

Case 2.1: Permissions collection object referenced directly in add and update_authorization methods

Case 2.2: Moved common functionality in Inherit and bequeath_all to private methods

Case 2.3: Flash messages clustered under a single private method

Case 2.4: Fixed email_sent method

References

<references/>