CSC/ECE 517 Fall 2016/E1635. Refactor join team requests controller.rb and invitation controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 10: Line 10:
* refactored the create and update methods
* refactored the create and update methods
* changed the wordings of the flash messages to make them more meaningful
* changed the wordings of the flash messages to make them more meaningful
== InvitationController==
* Rename to invitations_controller.rb, in accordance with current naming convention.
* Convert if nested inside else to elsif.
* Add comments explaining what each method does, and comments on how important variables are used.
* Refactor create and accept methods. Shorten and clarify them by adding private methods (e.g. extract a ready_to_join? method and call it from accept method)
* Change awkward flash messages.
== JoinTeamRequestsController==
* Add comments on some important variables.
* Convert if nested inside else to elsif
* Remove duplicate code: Common code in index, show and new method are moved into a private method.
* Create and update do not share any code. This raises the spectre of DRY problems. Make sure that all functionality used in creating a request is available when editing a request, and that no code is duplicated.
* Fix wording of message.

Revision as of 08:34, 30 October 2016

E1635. Refactor invitations controller.rb

This page provides a description of the Expertiza based OSS project.

About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

Problem Statement

The following tasks were accomplished in this project:

  • Renamed the "invitation_controller.rb" to "invitation_controller.rb"
  • For simple if nested in else, we changed it to elsif and thus decreased number of layers in the if nest.
  • For added comments to explains what each method does and explaining important variables
  • refactored the create and update methods
  • changed the wordings of the flash messages to make them more meaningful

InvitationController

  • Rename to invitations_controller.rb, in accordance with current naming convention.
  • Convert if nested inside else to elsif.
  • Add comments explaining what each method does, and comments on how important variables are used.
  • Refactor create and accept methods. Shorten and clarify them by adding private methods (e.g. extract a ready_to_join? method and call it from accept method)
  • Change awkward flash messages.

JoinTeamRequestsController

  • Add comments on some important variables.
  • Convert if nested inside else to elsif
  • Remove duplicate code: Common code in index, show and new method are moved into a private method.
  • Create and update do not share any code. This raises the spectre of DRY problems. Make sure that all functionality used in creating a request is available when editing a request, and that no code is duplicated.
  • Fix wording of message.