CSC/ECE 517 Fall 2013/oss ssp: Difference between revisions
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
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]] | ||
This method has definition for waitlist_teams and is defined in waitlist model. | This method has definition for waitlist_teams and is defined in waitlist model. | ||
=====Cancel waitlist===== | =====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. | 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. | ||
[[File:cancel_all_waitlists.png]] | [[File:cancel_all_waitlists.png]] | ||
=====Reassign a topic===== | =====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. | 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]] | [[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 shows the method delete_signup_for_topic in sign_up_sheet controller that contains call to reassign_topic method in sign_up_topic model. | ||
[[File:for_reassign_topic.png]] | [[File:for_reassign_topic.png]] | ||
This method has definition for reassign_topic and is defined in sign_up_topic model. | This method has definition for reassign_topic and is defined in sign_up_topic model. | ||
=====Remove team from topic===== | =====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. | 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. | ||
[[File:signup_topics.png]] | [[File:signup_topics.png]] | ||
This shows the method signup_topics in sign_up_sheet controller that contains call to remove_team method 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. | ||
[[File:remove_team.png]] | [[File:remove_team.png]] | ||
This method has definition for remove_team and is defined 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. | Rest, we have done renaming at a few places in sign_up_sheet controller. | ||
Line 51: | Line 62: | ||
====Snapshots==== | ====Snapshots==== | ||
Here, we have a few snapshots that would guide one to walk-through our work and the areas wherein we did refactoring. | Here, we have a few snapshots that would guide one to walk-through our work and the areas wherein we did refactoring. | ||
[[File:Login_admin.png]] | [[File:Login_admin.png]] | ||
Login as an admin. | Login as an admin. | ||
[[File:manage_courses.png]] | [[File:manage_courses.png]] | ||
Go to manage->courses | Go to manage->courses | ||
[[File:create_assignment.png]] | [[File:create_assignment.png]] | ||
Create an assignment by filling in the required fields and selecting the checkboxes. | Create an assignment by filling in the required fields and selecting the checkboxes. | ||
[[File:create_users.png]] | [[File:create_users.png]] | ||
Create users by filling in the required fields. | Create users by filling in the required fields. | ||
[[File:add_participants_admin.png]] | [[File:add_participants_admin.png]] | ||
Again go to Manage courses and as shown in the snapshot above, one can see actions associated with an assignment. Click on add participants. | Again go to Manage courses and as shown in the snapshot above, one can see actions associated with an assignment. Click on add participants. | ||
[[File:add_participants2_admin.png]] | [[File:add_participants2_admin.png]] | ||
Add a user to an assignment as a participant. | Add a user to an assignment as a participant. | ||
[[File:participant_added.png]] | [[File:participant_added.png]] | ||
The participant is added. | The participant is added. | ||
[[File:add_signupsheet.png]] | [[File:add_signupsheet.png]] | ||
Also, through manage-> courses, add signup sheet to an assignment in a similar manner as adding participants. | Also, through manage-> courses, add signup sheet to an assignment in a similar manner as adding participants. | ||
[[File:add_topic.png]] | [[File:add_topic.png]] | ||
When a signup sheet is created, add new topics to it in the similar manner | When a signup sheet is created, add new topics to it in the similar manner | ||
[[File:topic_created.png]] | [[File:topic_created.png]] | ||
Topic is successfully created. Logout of admin system | Topic is successfully created. Logout of admin system | ||
[[File:login.png]] | [[File:login.png]] | ||
Now login as an user. | Now login as an user. | ||
[[File:top.png]] | [[File:top.png]] | ||
Go to the assignments on top | Go to the assignments on top | ||
[[File:select_one_assignment.png]] | [[File:select_one_assignment.png]] | ||
Select one assignment from the list of assignments. | Select one assignment from the list of assignments. | ||
[[File:click_signup_sheet.png]] | [[File:click_signup_sheet.png]] | ||
Select signup sheet | Select signup sheet | ||
[[File:can_view_signup_sheet.png]] | [[File:can_view_signup_sheet.png]] | ||
One can view signup sheet and signup for the topic | One can view signup sheet and signup for the topic | ||
[[File:signing_up.png]] | [[File:signing_up.png]] | ||
After signing up, here for example for topic 1234, the user has the topic and the no. of available slot shows 0 | After signing up, here for example for topic 1234, the user has the topic and the no. of available slot shows 0 | ||
[[File:shows_waiting.png]] | [[File:shows_waiting.png]] | ||
Now, if another user tries to sign up for the same topic, he is put on waitlist. | 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. | This is a brief illustration of the changes we have made as a part of our project. | ||
Revision as of 07:25, 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.
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.