<?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=Sshaikh2</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=Sshaikh2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sshaikh2"/>
	<updated>2026-04-15T20:15:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:UMLstep2-517project.png&amp;diff=102166</id>
		<title>File:UMLstep2-517project.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:UMLstep2-517project.png&amp;diff=102166"/>
		<updated>2016-04-11T22:43:20Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102163</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102163"/>
		<updated>2016-04-11T22:40:50Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Web_page Web pages] make use of [https://en.wikipedia.org/wiki/Session_(computer_science) sessions] all the time. These are required to persist throughout the life of the user's interaction with the web site or web application.This is supported by Servo as of today. However it doesn't support the persistence of data upon the closing and reopening of the web browser.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is a web browser layout engine written in Rust and is currently being developed by Mozilla Research. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 1'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 2'''===&lt;br /&gt;
&lt;br /&gt;
[[File:download (1).png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''UML for step 4'''===&lt;br /&gt;
&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102117</id>
		<title>M1606: Implementing HTTP authorization UI and persistent sessions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions&amp;diff=102117"/>
		<updated>2016-04-11T21:21:32Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: typo corrected&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''' M1606: Implementing HTTP authorization UI and persistent sessions '''&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Web_page Web pages] make use of [https://en.wikipedia.org/wiki/Session_(computer_science) sessions] all the time. These are required to persist throughout the life of the user's interaction with the web site or web application.This is supported by Servo as of today. However it doesn't support the persistence of data upon the closing and reopening of the web browser.&amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Persistent-sessions-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this project we aim to create the necessary infrastructure to support this.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Servo ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo] is a web browser layout engine written in Rust and is currently being developed by Mozilla Research. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Rust ===&lt;br /&gt;
&lt;br /&gt;
[http://doc.rust-lang.org/book/README Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Rust_(programming_language)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Previous Related Work''' ==&lt;br /&gt;
&lt;br /&gt;
'''A Wiki Page regarding this work can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606 here ]'''&lt;br /&gt;
&lt;br /&gt;
1) Added a new command line flag &amp;lt;code&amp;gt; --profile-dir [path]&amp;lt;/code&amp;gt; that stores an optional directory path in the Opts struct in &amp;lt;code&amp;gt;opts.rs&amp;lt;/code&amp;gt;, creates the directory if it does not exist.&lt;br /&gt;
&lt;br /&gt;
[[File:Step2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Created [http://doc.rust-lang.org/book/ffi.html  Rust FFI bindings] for the &amp;lt;code&amp;gt;[https://github.com/jdm/tinyfiledialogs tinyfiledialogs] &amp;lt;/code&amp;gt;library to allow calling the C methods from Servo.&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-1Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Step3-2Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) In &amp;lt;code&amp;gt;resource_thread.rs&amp;lt;/code&amp;gt;, defined an HTTP authorization cache storage (username, password, URL) and instantiated it like the cookie_storage member (inside an &amp;lt;code&amp;gt;Arc&amp;lt;Rwlock&amp;lt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; value, to enable sharing it between threads).&lt;br /&gt;
&lt;br /&gt;
[[File:Step4Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
4) In &amp;lt;code&amp;gt;modify_request_headers&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;http_loader.rs&amp;lt;/code&amp;gt;, implemented the remaining pieces of step 12 of the [https://fetch.spec.whatwg.org/#http-network-or-cache-fetch appropriate specification ] using the authorization cache.&lt;br /&gt;
&lt;br /&gt;
[[File:Step5Wiki2spring16.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Scope''' ==&lt;br /&gt;
The scope of the project comprises of the 4 steps listed below:&lt;br /&gt;
&lt;br /&gt;
1) Ensure the appearance of an authorization UI in case a [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 401 HTTP response] is received. In load in the [https://github.com/servo/servo/blob/master/components/net/http_loader.rs http_loader.rs], immediately before attempting to process an HTTP redirection, the new [https://sourceforge.net/projects/tinyfiledialogs/ tinyfiledialogs] is made use of to make two prompts to pop up (for username and password), subsequently the request is restarted and the new authorization value present applied. If an authorization value was indeed present and the response is successful, the credentials are added to the authorization cache.&lt;br /&gt;
&lt;br /&gt;
2) If the command-line option of the profile directory is present when the ResourceThread is instructed to exit, the data contained in the cookie_storage, hsts_list, and the new HTTP authorization cache is serialized. This serialized data is then written in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
3) Perform similar serialization upon shutdown for local_data in [https://doc.servo.org/src/net_traits/storage_thread.rs.html storage_thread.rs], which represents the LocalStorage API.&lt;br /&gt;
&lt;br /&gt;
4) Check if the command-line option is present in the profile directory in the ResourceThreadconstructor and look for files that will contain serialized versions of the previous steps. If such files do exist, populate the appropriate fields with deserialized versions of the file’s contents.&lt;br /&gt;
&lt;br /&gt;
== '''Design Patterns''' ==&lt;br /&gt;
The team was not given much freedom for design patterns.  We followed and used the existing servo design strategy.  You can read about the servo design [https://github.com/servo/servo/wiki/Design here]&lt;br /&gt;
&lt;br /&gt;
We do use a facade pattern by creating a safe RUST wrapper around the RUST FFI for the tinyfiledialogs library that we will use for the UI.  We could have just called the FFI functions from servo, but instead we created a safe and simple interface to call the library functions.&lt;br /&gt;
&lt;br /&gt;
== '''Implementation / Design Decisions''' ==&lt;br /&gt;
&lt;br /&gt;
Here are some of the design decisions that we have made for implementing the steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/M1606:_Implementing_HTTP_authorization_UI_and_persistent_sessions#Scope Scope] :&lt;br /&gt;
&lt;br /&gt;
=== Step 1 ===&lt;br /&gt;
&lt;br /&gt;
Objective: Make an authorization UI appear when a 401 HTTP response is received &lt;br /&gt;
&lt;br /&gt;
Using the tinyfiledialogs RUST FFI bindings that the team created in the initial steps we will create a UI for the user to enter his username and password when a 401 request is received for a basic HTTP authentication.  We will first check if the status code of the http response is &amp;quot;unauthorized&amp;quot;. If the code is unauthorized we will display the UI for the user to enter his username and password.  After the username and password are entered the request is restarted with the authentication header added.  If the request is now successful we create a new authentication entry struct and place it into the Authentication hash map for future use.&lt;br /&gt;
&lt;br /&gt;
=== Step 2 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the data contained in cookie_storage, hsts_list, and the new HTTP authorization cache, and write the serialized data in separate files inside the profile directory.&lt;br /&gt;
&lt;br /&gt;
When a Resource Thread exits we will check if the opts structure located in opts.rs contains an entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present when the Resource Thread exits we will open or create a file for each data set we are saving.  After each file is opened or created we will serialize the data that corresponds to that file with the rust serialize library and save the serialized data to the file.&lt;br /&gt;
&lt;br /&gt;
=== Step 3 ===&lt;br /&gt;
&lt;br /&gt;
Objective: On shutdown serialize the local_data in storage_thread.r&lt;br /&gt;
&lt;br /&gt;
This is similar to step 2 and some code re-use will be used.  However, the difference between this step and step 2 is that the local data contained in storage_thread.rs will be the data that is being serialized and saved into the same directory.&lt;br /&gt;
&lt;br /&gt;
=== Step 4 ===&lt;br /&gt;
&lt;br /&gt;
Objective: If the command line option for profile-dir is present then load the serialized data present in the directory that is given.&lt;br /&gt;
&lt;br /&gt;
When a resource thread is created we will check if the opts structure located in opts.rs contains a entry for the command line option &amp;quot;--profile dir&amp;quot;.  If the option is present then the data from each file contained in the directory will be opened and deserialized using the serialize rust library. The data will then be placed in the appropriate fields. i.e (cookie_storage, hsts_lists, authorization_cache)&lt;br /&gt;
&lt;br /&gt;
=='''UML for step 1'''==&lt;br /&gt;
[[File:517project.png ]]&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
===Testing the new command line flag --profile-dir===&lt;br /&gt;
&lt;br /&gt;
Steps for Testing the new command line flag --profile-dir can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Testing_the_new_command_line_flag_--profile-dir here]&lt;br /&gt;
&lt;br /&gt;
=== Unit Test for set authorization header if url does not have credentials ===&lt;br /&gt;
&lt;br /&gt;
Steps for Unit Tests for set authorization header if url does not have credentials can be found [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#Unit_Test_for_set_authorization_header_if_url_does_not_have_credentials here]&lt;br /&gt;
&lt;br /&gt;
=== GUI test for the tinyfiledialogs lib ===&lt;br /&gt;
&lt;br /&gt;
Steps for GUI test for the tinyfiledialogs lib can be found  [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016_OSS_M1606#GUI_test_for_the_tinyfiledialogs_lib here ]&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101656</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101656"/>
		<updated>2016-04-02T03:36:50Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
'''For Admin:'''&lt;br /&gt;
&lt;br /&gt;
Username: administrator5&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
'''For Student:'''&lt;br /&gt;
&lt;br /&gt;
Username: student5884&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student6420&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101654</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101654"/>
		<updated>2016-04-02T03:18:55Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
'''For Admin:'''&lt;br /&gt;
&lt;br /&gt;
Username: administrator5&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
'''For Student:'''&lt;br /&gt;
&lt;br /&gt;
Username: student5884&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student6420&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101653</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101653"/>
		<updated>2016-04-02T03:18:12Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
[[For Admin:]]&lt;br /&gt;
&lt;br /&gt;
Username: administrator5&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
[[For Student:]]&lt;br /&gt;
&lt;br /&gt;
Username: student5884&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student6420&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101652</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101652"/>
		<updated>2016-04-02T03:17:34Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
For Admin:&lt;br /&gt;
&lt;br /&gt;
Username: administrator5&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
For Student:&lt;br /&gt;
&lt;br /&gt;
Username: student5884&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student6420&lt;br /&gt;
&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101650</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101650"/>
		<updated>2016-04-02T03:17:17Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
For Admin:&lt;br /&gt;
&lt;br /&gt;
Username: administrator5&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
For Student:&lt;br /&gt;
&lt;br /&gt;
Username: student5884&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student6420&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101649</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101649"/>
		<updated>2016-04-02T03:15:55Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
For Admin:&lt;br /&gt;
Username: administrator5&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
For Student:&lt;br /&gt;
Username: student5884&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student6420&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101579</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101579"/>
		<updated>2016-04-01T17:48:06Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
For testing, the following parameters can be used:&lt;br /&gt;
&lt;br /&gt;
For Admin:&lt;br /&gt;
Username: administrator5&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
For Student:&lt;br /&gt;
Username: student16&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
Username: student18&lt;br /&gt;
Password: password&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Sshaikh2&amp;diff=101277</id>
		<title>User:Sshaikh2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Sshaikh2&amp;diff=101277"/>
		<updated>2016-03-24T02:29:17Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: moved User:Sshaikh2 to CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb]]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101276</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101276"/>
		<updated>2016-03-24T02:29:17Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: moved User:Sshaikh2 to CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101264</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101264"/>
		<updated>2016-03-24T02:18:41Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
====Creating teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams====&lt;br /&gt;
&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101263</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101263"/>
		<updated>2016-03-24T02:17:28Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;br /&gt;
This project deals entirely with the creation, deletion, modification, import and export of teams on Expertiza. Following is the step-by-step guide to test functionalities.&lt;br /&gt;
&lt;br /&gt;
====Creating teams===&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
4) On the bottom of the page, there is a link to create new team.&lt;br /&gt;
5) Fill in the required details and save the team.&lt;br /&gt;
6) Verify whether the new team has been created. &lt;br /&gt;
&lt;br /&gt;
====Importing teams===&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
4) On the bottom of the page, there is a link to import new team.&lt;br /&gt;
5) Select the .csv file from the system and click on import.&lt;br /&gt;
6) Verify whether import was successful.&lt;br /&gt;
 &lt;br /&gt;
====Exporting teams===&lt;br /&gt;
1) Login in with administrator.&lt;br /&gt;
2) Go to course/assignment tab.&lt;br /&gt;
3) Click on create team against the desired course/assignment, it will redirect to a new page where all the teams are displayed.&lt;br /&gt;
4) On the bottom of the page, there is a link to export all the teams.&lt;br /&gt;
5) Verify whether .csv file was successfully exported to the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/nikraina/expertiza.git 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;br /&gt;
#[http://ruby-doc.org/ Ruby Documentation]&lt;br /&gt;
#[https://sourcemaking.com/design_patterns/prototype Prototype Pattern]&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101258</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101258"/>
		<updated>2016-03-24T01:59:13Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refactored has_submissions? In Assignment Team to :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def has_submissions?&lt;br /&gt;
 (self.submitted_files.length &amp;gt; 0) or self.submitted_hyperlinks.blank?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pretty-Printing the code ====&lt;br /&gt;
*Deleted unnecessary white spaces, and pretty printed the whole code in all the 3 classes.&lt;br /&gt;
*Debugged and figured out the usage of every method in the classes and have provided small comments for reader to understand the operation of the defined method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101256</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101256"/>
		<updated>2016-03-24T01:56:37Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*add_participant​ in course_team.rb.&lt;br /&gt;
*participant_type in assignment_team.rb.&lt;br /&gt;
*assignment in team.rb.&lt;br /&gt;
*email method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*self.first_member(team_id): Shows if a team is empty or not.&lt;br /&gt;
*set_student_directory_number: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101255</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101255"/>
		<updated>2016-03-24T01:54:30Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
====Refactoring ====&lt;br /&gt;
&lt;br /&gt;
'''Import''' :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Export ''':This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Helper Methods''': Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prototype Design Pattern is an ideal fit to handle this child parent relationship, but prototype pattern one needs to clone the child objects and then pass them to the parent’s calling method. But since Ruby allows for deep copy but does not allow for cloning objects, this is not possible. Hence a similar behavior has been simulated by creating objects in child classes and passing them as parameters to the parent class. A prototype method is defined in child classes that returns an object of that class which is then passed to the parent where reflection is used  to identify the source calling method and act based on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Deleting Deprecated Methods ====&lt;br /&gt;
&lt;br /&gt;
The following methods have been deleted as they are not in use anymore:&lt;br /&gt;
*&amp;lt;pre&amp;gt;add_participant​&amp;lt;/pre&amp;gt; in course_team.rb.&lt;br /&gt;
*&amp;lt;pre&amp;gt;participant_type&amp;lt;/pre&amp;gt; in assignment_team.rb.&lt;br /&gt;
*&amp;lt;pre&amp;gt;assignment&amp;lt;/pre&amp;gt; in team.rb.&lt;br /&gt;
*&amp;lt;pre&amp;gt;email&amp;lt;/pre&amp;gt; method was removed.&lt;br /&gt;
&lt;br /&gt;
The following methods were not removed as they are still used elsewhere in the code:&lt;br /&gt;
*&amp;lt;pre&amp;gt;self.first_member(team_id)&amp;lt;/pre&amp;gt;: Shows if a team is empty or not.&lt;br /&gt;
*&amp;lt;pre&amp;gt;set_student_directory_number&amp;lt;/pre&amp;gt;: Sets the team to submission relation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101251</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101251"/>
		<updated>2016-03-24T01:42:04Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
* '''Problem 1:''' &lt;br /&gt;
&lt;br /&gt;
Import :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Helper Code: Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 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;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changes to the child classes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 AssignmentTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.prototype&lt;br /&gt;
 CourseTeam.new&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101250</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101250"/>
		<updated>2016-03-24T01:40:46Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
* '''Problem 1:''' &lt;br /&gt;
&lt;br /&gt;
Import :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export :This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.export(csv, parent_id, options, teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   teams = CourseTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   teams = AssignmentTeam.where([&amp;quot;parent_id =?&amp;quot;, parent_id])&lt;br /&gt;
 end&lt;br /&gt;
 teams.each do |team|&lt;br /&gt;
   output = Array.new&lt;br /&gt;
   output.push(team.name)&lt;br /&gt;
   if options[&amp;quot;team_name&amp;quot;] == &amp;quot;false&amp;quot;&lt;br /&gt;
     team_members = TeamsUser.where(['team_id = ?', team.id])&lt;br /&gt;
     team_members.each do |user|&lt;br /&gt;
       output.push(user.name)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
   output.push(teams.name)&lt;br /&gt;
   csv &amp;lt;&amp;lt; output&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Helper Code: Some of the helper methods also had to be refactored to the parent class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.create_team_and_node(id,teamtype)&lt;br /&gt;
 if teamtype.is_a?(CourseTeam)&lt;br /&gt;
   curr_course = Course.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_course.name)&lt;br /&gt;
   team = CourseTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
   curr_assignment = Assignment.find(id)&lt;br /&gt;
   team_name = Team.generate_team_name(curr_assignment.name)&lt;br /&gt;
   team = AssignmentTeam.create(name: team_name, parent_id: id)&lt;br /&gt;
   TeamNode.create(parent_id: id, node_object_id: team.id)&lt;br /&gt;
 end&lt;br /&gt;
 team&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
def self.handle_duplicate(team, name, id, handle_dups, teamtype)&lt;br /&gt;
 if team.nil? #no duplicate&lt;br /&gt;
   return name&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;ignore&amp;quot; #ignore: do not create the new team&lt;br /&gt;
   p '&amp;gt;&amp;gt;&amp;gt;setting name to nil ...'&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;rename&amp;quot; #rename: rename new team&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     return self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     return self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 if handle_dups == &amp;quot;replace&amp;quot; #replace: delete old team&lt;br /&gt;
   team.delete&lt;br /&gt;
   return name&lt;br /&gt;
 else # handle_dups = &amp;quot;insert&amp;quot;&lt;br /&gt;
   return nil&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101249</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101249"/>
		<updated>2016-03-24T01:38:05Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
* '''Problem 1:''' Import &lt;br /&gt;
&lt;br /&gt;
This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang = &amp;quot;irb&amp;quot;&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Export&lt;br /&gt;
This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101247</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101247"/>
		<updated>2016-03-24T01:36:08Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
* '''Problem 1:''' Import &lt;br /&gt;
&lt;br /&gt;
This method was refactored to the parent class team.rb from the assignment_team.rb and the course_team.rb. The new code is :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.import(row, id, options,teamtype)&lt;br /&gt;
 raise ArgumentError, &amp;quot;Not enough fields on this line&amp;quot; if (row.length &amp;lt; 2 &amp;amp;&amp;amp; options[:has_column_names] == &amp;quot;true&amp;quot;) || (row.length &amp;lt; 1 &amp;amp;&amp;amp; options[:has_column_names] != &amp;quot;true&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 if options[:has_column_names] == &amp;quot;true&amp;quot;&lt;br /&gt;
   name = row[0].to_s.strip&lt;br /&gt;
   team = where([&amp;quot;name =? &amp;amp;&amp;amp; parent_id =?&amp;quot;, name, id]).first&lt;br /&gt;
   team_exists = !team.nil?&lt;br /&gt;
   name = handle_duplicate(team, name, id, options[:handle_dups],teamtype)&lt;br /&gt;
   index = 1&lt;br /&gt;
 else&lt;br /&gt;
   if teamtype.is_a?(CourseTeam)&lt;br /&gt;
     name = self.generate_team_name(Course.find(id).name)&lt;br /&gt;
   elsif teamtype.is_a?(AssignmentTeam)&lt;br /&gt;
     name = self.generate_team_name(Assignment.find(id).name)&lt;br /&gt;
   end&lt;br /&gt;
   index = 0&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 if name&lt;br /&gt;
   team = Team.create_team_and_node(id,teamtype)&lt;br /&gt;
   team.name = name&lt;br /&gt;
   team.save&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 # insert team members into team unless team was pre-existing &amp;amp; we ignore duplicate teams&lt;br /&gt;
 team.import_team_members(index, row) if !(team_exists &amp;amp;&amp;amp; options[:handle_dups] == &amp;quot;ignore&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101234</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101234"/>
		<updated>2016-03-24T01:21:18Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;br /&gt;
&lt;br /&gt;
=== Solutions Provided ===&lt;br /&gt;
&lt;br /&gt;
=== Testing from UI ===&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101232</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101232"/>
		<updated>2016-03-24T01:19:48Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;br /&gt;
&lt;br /&gt;
=== System Design ===&lt;br /&gt;
This project deals with the &amp;quot;team&amp;quot; module of Expertiza which handles the creation of teams and other aspects related to teams like submission, importing and exporting. Expertiza has 3 models, team.rb, course_team.rb and assignment_team.rb for teams in general, teams for a course and teams for each assignment.&lt;br /&gt;
 &lt;br /&gt;
The design specific to these models is as follows::&lt;br /&gt;
&lt;br /&gt;
Here the course_team and assignment_team are subclasses of team. The parent_id field in the database of teams refer to the id of course or assignment based on the type for which it was created. Hence in course_team instances the parent_id contains the course ID and for assignment_team the parent_id contains the assignment ID.&lt;br /&gt;
The main table stores the team members is TeamUsers, where each line is uniquely identified by the user_id and the team_id. This table is linked to Team, Participant &amp;amp; Users.&lt;br /&gt;
The understanding of this system design is core to understanding the functionality of team.rb, course_team.rb and assignment_team.rb models.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101227</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101227"/>
		<updated>2016-03-24T01:09:20Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction to Expertiza ===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101226</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101226"/>
		<updated>2016-03-24T01:08:29Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101225</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101225"/>
		<updated>2016-03-24T01:07:12Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Create a common method for importing and exporting teams in the team.rb file instead of having 2 separate functions in the assignment_team.rb and course_team.rb files using the [https://sourcemaking.com/design_patterns/prototype prototype pattern].&lt;br /&gt;
*Move the create_team_and_method to superclass (team.rb).&lt;br /&gt;
*Delete deprecated methods.&lt;br /&gt;
*Rewrite the method for checking if a team has submission.&lt;br /&gt;
*Remove unnecessary white spaces and add comments before methods to describe what the method does.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101216</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101216"/>
		<updated>2016-03-24T00:58:55Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The three classes in question- team, assignment team and course team, deal with teams of students that do assignments.&amp;quot;team.rb&amp;quot; is the superclass; course_team is a team created for a course (if students are expected to stay in the same team all semester), and assignment_team is a team created for an assignment.  Either the instructor can set up course or assignment teams (using the “Create teams” icon on the course or assignment Actions menu), or the students can, by issuing and accepting invitations.&lt;br /&gt;
The code for 'importing', 'exporting', and 'copying' teams for assignment and course violates the DRY principle. There is a paucity of comments and there are deprecated methods and other methods that may not be used anymore, and could be deleted.&lt;br /&gt;
&lt;br /&gt;
===Tasks Identified===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Improved the clarity of code by improving the variable and parameter names.&lt;br /&gt;
* Long character strings were taken and given appropriate names.&lt;br /&gt;
* Handled pagination by a separate helper module, which can be used by multiple controllers.&lt;br /&gt;
* Implemented action_allowed for access_control  to prevent unauthorized access of methods.&lt;br /&gt;
* Prevented displaying of all versions for all users and tables when a user views the index page.&lt;br /&gt;
* Added missing CRUD methods to Versions Controller&lt;br /&gt;
* Added RSPEC testcases for testing changes done in Versions Controller&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101213</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101213"/>
		<updated>2016-03-24T00:53:52Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an [https://en.wikipedia.org/wiki/Open-source_software open source project] developed on [http://rubyonrails.org/ Ruby on Rails] framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101207</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101207"/>
		<updated>2016-03-24T00:52:22Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Introduction to Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[Expertiza] is an [open open source, https://en.wikipedia.org/wiki/Open-source_software] project developed on Ruby on Rails framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101205</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101205"/>
		<updated>2016-03-24T00:51:54Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: /* Introduction to Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[Expertiza] is an open open source [https://en.wikipedia.org/wiki/Open-source_software] project developed on Ruby on Rails framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101204</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101204"/>
		<updated>2016-03-24T00:51:34Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the Expertiza based OSS project on refactoring.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[Expertiza] is an [open open source https://en.wikipedia.org/wiki/Open-source_software] project developed on Ruby on Rails framework. It is primarily developed as a platform for instructors to create, assign and grade assignments and quizzes and for the students to view, submit assignments and take quizzes. Other activities involved in a course can also be done via Expertiza, like creating teams, reviewing assignments among others.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101202</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101202"/>
		<updated>2016-03-24T00:43:33Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== 1 E1611 Refactor team.rb, course_team.rb, and assignment_team.rb ==&lt;br /&gt;
This page provides the description of the EXpertia based OSS project on refactoring.&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101198</id>
		<title>CSC 517 S2016 E1611 Refactor team.rb, course team.rb, and assignment team.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC_517_S2016_E1611_Refactor_team.rb,_course_team.rb,_and_assignment_team.rb&amp;diff=101198"/>
		<updated>2016-03-24T00:41:29Z</updated>

		<summary type="html">&lt;p&gt;Sshaikh2: Created page with &amp;quot; == askdhasd ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== askdhasd ==&lt;/div&gt;</summary>
		<author><name>Sshaikh2</name></author>
	</entry>
</feed>