<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sguddet</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sguddet"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sguddet"/>
	<updated>2026-05-27T04:22:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107768</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107768"/>
		<updated>2017-04-01T01:28:52Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107766</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107766"/>
		<updated>2017-04-01T01:28:22Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107763</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107763"/>
		<updated>2017-04-01T01:27:35Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107762</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107762"/>
		<updated>2017-04-01T01:26:11Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===Test Cases===&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107760</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107760"/>
		<updated>2017-04-01T01:25:23Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===Test Cases===&lt;br /&gt;
====Test Cases====&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing all the other cases. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107737</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107737"/>
		<updated>2017-04-01T01:02:26Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===Test Cases===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107736</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107736"/>
		<updated>2017-04-01T00:58:43Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: adding tests&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
===Test Cases===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107489</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107489"/>
		<updated>2017-03-26T07:36:54Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Test case charts ===&lt;br /&gt;
'''Decline:'''&lt;br /&gt;
Assert the change of status to 'D' in the database&lt;br /&gt;
&lt;br /&gt;
'''Cancel'''&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create function'''&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To login as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107488</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107488"/>
		<updated>2017-03-26T06:02:54Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Running project remotely */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
'''Decline:'''&lt;br /&gt;
Assert the change of status to 'D' in the database&lt;br /&gt;
&lt;br /&gt;
'''Cancel'''&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create function'''&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107487</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107487"/>
		<updated>2017-03-26T05:56:39Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Running project remotely */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
'''Decline:'''&lt;br /&gt;
Assert the change of status to 'D' in the database&lt;br /&gt;
&lt;br /&gt;
'''Cancel'''&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create function'''&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[http://152.46.20.227:3000]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107486</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107486"/>
		<updated>2017-03-26T05:56:02Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
'''Decline:'''&lt;br /&gt;
Assert the change of status to 'D' in the database&lt;br /&gt;
&lt;br /&gt;
'''Cancel'''&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create function'''&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[http://152.46.20.227:3000|center]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107485</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107485"/>
		<updated>2017-03-26T05:55:06Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
&lt;br /&gt;
== Unit Test Scenarios ==&lt;br /&gt;
'''Decline:'''&lt;br /&gt;
Assert the change of status to 'D' in the database&lt;br /&gt;
&lt;br /&gt;
'''Cancel'''&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create function'''&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[http://152.46.20.227:3000|center]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107484</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107484"/>
		<updated>2017-03-26T05:45:48Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Tasks Identified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
&lt;br /&gt;
== Unit Test Scenarios ==&lt;br /&gt;
'''Decline:'''&lt;br /&gt;
Assert the change of status to 'D' in the database&lt;br /&gt;
&lt;br /&gt;
'''Destroy'''&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create function'''&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
http://152.46.20.227:3000&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:InvitationsCTest3.png&amp;diff=107483</id>
		<title>File:InvitationsCTest3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:InvitationsCTest3.png&amp;diff=107483"/>
		<updated>2017-03-26T05:35:40Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:InvitationCTest2.png&amp;diff=107482</id>
		<title>File:InvitationCTest2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:InvitationCTest2.png&amp;diff=107482"/>
		<updated>2017-03-26T05:30:44Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test1.png&amp;diff=107481</id>
		<title>File:Test1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test1.png&amp;diff=107481"/>
		<updated>2017-03-26T05:28:15Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: uploaded a new version of &amp;amp;quot;File:Test1.png&amp;amp;quot;: invitationController testcase&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107480</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107480"/>
		<updated>2017-03-26T05:24:17Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Tasks Identified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated.&lt;br /&gt;
[[File:TestInvitation1.png|center]]&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
http://152.46.20.227:3000&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TestInvitation1.png&amp;diff=107479</id>
		<title>File:TestInvitation1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TestInvitation1.png&amp;diff=107479"/>
		<updated>2017-03-26T05:20:59Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107478</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107478"/>
		<updated>2017-03-26T05:15:23Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: /* Running project remotely */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
http://152.46.20.227:3000&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Screen_Shot_2017-03-26_at_12.20.40_AM.png&amp;diff=107475</id>
		<title>File:Screen Shot 2017-03-26 at 12.20.40 AM.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Screen_Shot_2017-03-26_at_12.20.40_AM.png&amp;diff=107475"/>
		<updated>2017-03-26T04:47:36Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: create in invitations controller&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;create in invitations controller&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107474</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107474"/>
		<updated>2017-03-26T04:45:55Z</updated>

		<summary type="html">&lt;p&gt;Sguddet: Created page with &amp;quot;=== Introduction === This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU.   E...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sguddet</name></author>
	</entry>
</feed>