CSC/ECE 517 Fall 2013/oss ssp: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 23: Line 23:
=====Add teams to waiting list=====
=====Add teams to waiting list=====
We have moved the functionality that adds teams to waiting list when the topic is unavailable. We have moved this functionality from confirm_topic in sign_up_sheet controller to waitlist_teams method that we have created in waitlist controller.
We have moved the functionality that adds teams to waiting list when the topic is unavailable. We have moved this functionality from confirm_topic in sign_up_sheet controller to waitlist_teams method that we have created in waitlist controller.
[[File:confirm_topic.png|200px|thumb|left]]
[[File:confirm_topic.png]]
This shows the method confirm_topic in sign_up_sheet controller that contains call to waitlist_teams method in waitlist controller.  
This shows the method confirm_topic in sign_up_sheet controller that contains call to waitlist_teams method in waitlist controller.  
[[File:waitlist_teams.png]]
[[File:waitlist_teams.png]]

Revision as of 07:23, 30 October 2013

OSS E803 Refactoring and testing — signup_sheet model

Motivation

The motivation of this project was to provide functionality to manage Sign Up Sheets. The intent was to improve the design of the project by modularizing the code and maintaining good naming conventions. The methods relevant to wait-listing a team were all a part of the Sign Up sheet model and controller. in order to improve the readability of the code and to have a better organization, we intended to move these methods to a separate Waitlist Model. Also, some methods had too many functionalities, a lot more than what their names suggested. To have a more elegant code, the functionalities had to be moved to relevant methods. cancel_all_waitlists and waitlist_teams methods were created in the waitlist model for this purpose. Naming conventions are considered very important for making the code more readable and understandable. Ruby is known for its 'Convention over Configuration' ideology. Thus the naming conventions had to be taken care of. In the Sign Up sheet controller, we could see the usage of Camel cases in a lot of places. We intended to replace these by the convention of Ruby where underscore is used between two words in variable names with all the alphabets in small letters.


Design

Issues

Procedure

A brief description

Our OSS project required us to do refactoring and testing of the part of Expertiza that deals with signup mainly sign_up_sheet controller. This controller manages functionalities of signup sheet for assignment. We have moved a few methods from controller to a more suitable model in order to attain the “thin controller, fat model” implementation. A major part includes the actions related to waitlist. We have put methods from sign_up_sheet controller to the waitlist model (which was earlier empty, so we created a waitlist model by adding functionalities to it) A brief description of the refactoring that we have done is given below

Add teams to waiting list

We have moved the functionality that adds teams to waiting list when the topic is unavailable. We have moved this functionality from confirm_topic in sign_up_sheet controller to waitlist_teams method that we have created in waitlist controller. This shows the method confirm_topic in sign_up_sheet controller that contains call to waitlist_teams method in waitlist controller. This method has definition for waitlist_teams and is defined in waitlist model.

Cancel waitlist

We have moved the functionality that removes a team from the waiting list, from sign_up_topic model to waitlist model. The method name is cancel_all_waitlist.

Reassign a topic

We have moved the functionality that reassigns a topic to another team when a team holding that particular topic cancels its reservation. We have moved this functionality from delete_signup_for_topic in sign_up_sheet controller to a method named reassign_topic that we have created in sign_up_topic model. File:Delete signup.png This shows the method delete_signup_for_topic in sign_up_sheet controller that contains call to reassign_topic method in sign_up_topic model. This method has definition for reassign_topic and is defined in sign_up_topic model.

Remove team from topic

We have moved the functionality that removes a team from a topic when all of the team’s members have left the team. We have moved this functionality from signup_topics in sign_up_sheet controller to a method named remove_team that we have created in sign_up_topic model. This shows the method signup_topics in sign_up_sheet controller that contains call to remove_team method in sign_up_topic model. This method has definition for remove_team and is defined in sign_up_topic model. Rest, we have done renaming at a few places in sign_up_sheet controller.

Snapshots

Here, we have a few snapshots that would guide one to walk-through our work and the areas wherein we did refactoring. Login as an admin. Go to manage->courses Create an assignment by filling in the required fields and selecting the checkboxes. Create users by filling in the required fields. Again go to Manage courses and as shown in the snapshot above, one can see actions associated with an assignment. Click on add participants. Add a user to an assignment as a participant. The participant is added. Also, through manage-> courses, add signup sheet to an assignment in a similar manner as adding participants. When a signup sheet is created, add new topics to it in the similar manner Topic is successfully created. Logout of admin system Now login as an user. Go to the assignments on top Select one assignment from the list of assignments. Select signup sheet One can view signup sheet and signup for the topic After signing up, here for example for topic 1234, the user has the topic and the no. of available slot shows 0 Now, if another user tries to sign up for the same topic, he is put on waitlist. This is a brief illustration of the changes we have made as a part of our project.


Future Work

The sign up sheet controller still has many methods relevant to other entities which need to be moved to other relevant models and controllers. save_topic_dependancies and save_topic_deadlines are two methods which can be put into SignUpTopic Model or controller. show_team method which is in sign_up_sheet controller can be moved to teams_controller. We also see another controller called SignUp controller which looks like a redundant one which has methods mostly from SignUpSheet controller. And these methods don't seem to be used. So this method can be looked into carefully and discarded if possible. There is also a function called slotAvailable? in the sign up sheet controller which merely makes a call to a method slotAvailable? in the SignUpTopic model and does nothing else. This looks like an unnecesary redirection. Dependencies can be resolved and this method can be removed and calls can directly be made to the slotAvailable? method in the SignUpTopic model. Also the method update_waitlisted_users can be moved from SignUpTopic model to Wailist Model to improve the readability of the code.