<?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=Zganatr</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=Zganatr"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Zganatr"/>
	<updated>2026-05-08T04:49:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100135</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100135"/>
		<updated>2015-12-04T23:38:12Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Running the Project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] tool, [http://community.pentaho.com/projects/data-integration/ Pentaho Kettle] to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data. An example of transformation is while mapping of participants table in the expertiza database to actors table in the PRML database. Each value of the id field is incremented by 1000 while inserting in the participants table.  &lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are three types of loading implemented on the tables depending on the size of the table – initial load,partial loading and full loading.&lt;br /&gt;
Initial Loading:The first time the data is loaded from the expertiza database to PRML database, it is the initial load.&lt;br /&gt;
&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps and checksums.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
We have tested our conversion by using a set of sample expertiza data. We run the extract, transform and load methodology on it. Queries are run on the PRML database to check if it gives the same results as the expertiza database. &lt;br /&gt;
Though the testing is not through, this is the only way the project can be tested.&lt;br /&gt;
&lt;br /&gt;
==Running the Project==&lt;br /&gt;
'''Required Software:'''&lt;br /&gt;
*Pentaho’s Data Integration (Kettle).&lt;br /&gt;
*MySQL&lt;br /&gt;
*JAVA&lt;br /&gt;
&lt;br /&gt;
'''Setup:'''&lt;br /&gt;
*Download and Install MySQL and JAVA&lt;br /&gt;
*Import to MySQL expertiza database dump file.&lt;br /&gt;
*Import to MySQL PRML database dump file.&lt;br /&gt;
*Download Pentaho's Data Integration(Kettle) Community Edition (its a copy deployment hence no installation is required).&lt;br /&gt;
*Download MySql Connector jar file and copy to &amp;lt;pentaho_root_directory\data-integration\lib&amp;gt;&lt;br /&gt;
*Start Spoon.bat if you are using a windows machine or Spoon.sh if you using Linux (pentaho_root_directory\data-integration)&lt;br /&gt;
*Download the transformations and jobs attached&lt;br /&gt;
*You can open a kettle transformation (.ktr file) using Spoon and run it (Make sure proper MySql DB connections are configured)&lt;br /&gt;
*You may also open the kettle job (.kjb file) using spoon and run it (Make sure the path for transformations in the job are correct)&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100124</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100124"/>
		<updated>2015-12-04T23:25:43Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] tool, [http://community.pentaho.com/projects/data-integration/ Pentaho Kettle] to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data. An example of transformation is while mapping of participants table in the expertiza database to actors table in the PRML database. Each value of the id field is incremented by 1000 while inserting in the participants table.  &lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are three types of loading implemented on the tables depending on the size of the table – initial load,partial loading and full loading.&lt;br /&gt;
Initial Loading:The first time the data is loaded from the expertiza database to PRML database, it is the initial load.&lt;br /&gt;
&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps and checksums.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
We have tested our conversion by using a set of sample expertiza data. We run the extract, transform and load methodology on it. Queries are run on the PRML database to check if it gives the same results as the expertiza database. &lt;br /&gt;
Though the testing is not through, this is the only way the project can be tested.&lt;br /&gt;
&lt;br /&gt;
==Running the Project==&lt;br /&gt;
'''Required Software:'''&lt;br /&gt;
*Pentaho’s Data Integration (Kettle).&lt;br /&gt;
*MySQL&lt;br /&gt;
*JAVA&lt;br /&gt;
&lt;br /&gt;
'''Setup:'''&lt;br /&gt;
*Download and Install MySQL and JAVA&lt;br /&gt;
*Import to MySQL expertiza database dump file.&lt;br /&gt;
*Import to MySQL PRML database dump file.&lt;br /&gt;
*Download Pentaho's Data Integration(Kettle) Community Edition (its a copy deployment hence no installation is required).&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100111</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100111"/>
		<updated>2015-12-04T22:21:05Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] tool, [http://community.pentaho.com/projects/data-integration/ Pentaho Kettle] to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data.&lt;br /&gt;
Some of the transformation performed for the project are:&lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are three types of loading implemented on the tables depending on the size of the table – initial load,partial loading and full loading.&lt;br /&gt;
Initial Loading:The first time the data is loaded from the expertiza database to PRML database, it is the initial load.&lt;br /&gt;
&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps and checksums.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
We have tested our conversion by using a set of sample expertiza data. We run the extract, transform and load methodology on it. Queries are run on the PRML database to check if it gives the same results as the expertiza database. &lt;br /&gt;
Though the testing is not through, this is the only way the project can be tested.&lt;br /&gt;
&lt;br /&gt;
==Running the Project==&lt;br /&gt;
'''Required Software:'''&lt;br /&gt;
*Pentaho’s Data Integration (Kettle).&lt;br /&gt;
*MySQL&lt;br /&gt;
*JAVA&lt;br /&gt;
&lt;br /&gt;
'''Setup:'''&lt;br /&gt;
*Download and Install MySQL and JAVA&lt;br /&gt;
*Import to MySQL expertiza database dump file.&lt;br /&gt;
*Import to MySQL PRML database dump file.&lt;br /&gt;
*Download Pentaho's Data Integration(Kettle) Community Edition (its a copy deployment hence no installation is required).&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100107</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100107"/>
		<updated>2015-12-04T21:48:29Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load (https://en.wikipedia.org/wiki/Extract,_transform,_loadETL) tool, [[Pentaho Kettle]] (http://community.pentaho.com/projects/data-integration/) to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data.&lt;br /&gt;
Some of the transformation performed for the project are:&lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are three types of loading implemented on the tables depending on the size of the table – initial load,partial loading and full loading.&lt;br /&gt;
Initial Loading:The first time the data is loaded from the expertiza database to PRML database, it is the initial load.&lt;br /&gt;
&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps and checksums.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
We have tested our conversion by using a set of sample expertiza data. We run the extract, transform and load methodology on it. Queries are run on the PRML database to check if it gives the same results as the expertiza database. &lt;br /&gt;
Though the testing is not through, this is the only way the project can be tested.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100106</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100106"/>
		<updated>2015-12-04T21:45:39Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load (https://en.wikipedia.org/wiki/Extract,_transform,_loadETL) tool, [[Pentaho Kettle]] (http://community.pentaho.com/projects/data-integration/) to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data.&lt;br /&gt;
Some of the transformation performed for the project are:&lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are two types of loading implemented on the tables depending on the size of the table – partial loading and full loading.&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
We have tested our conversion by using a set of sample expertiza data. We run the extract, transform and load methodology on it. Queries are run on the PRML database to check if it gives the same results as the expertiza database. &lt;br /&gt;
Though the testing is not through, this is the only way the project can be tested.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diagram.png&amp;diff=100104</id>
		<title>File:Diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diagram.png&amp;diff=100104"/>
		<updated>2015-12-04T21:45:04Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: uploaded a new version of &amp;amp;quot;File:Diagram.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diagram.png&amp;diff=100101</id>
		<title>File:Diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diagram.png&amp;diff=100101"/>
		<updated>2015-12-04T21:41:56Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100098</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100098"/>
		<updated>2015-12-04T21:35:47Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load (https://en.wikipedia.org/wiki/Extract,_transform,_loadETL) tool, [[Pentaho Kettle]] (http://community.pentaho.com/projects/data-integration/) to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data.&lt;br /&gt;
Some of the transformation performed for the project are:&lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are two types of loading implemented on the tables depending on the size of the table – partial loading and full loading.&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
We have tested our conversion by using a set of sample expertiza data. We run the extract, transform and load methodology on it. Queries are run on the PRML database to check if it gives the same results as the expertiza database. &lt;br /&gt;
Though the testing is not through, this is the only way the project can be tested.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100095</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100095"/>
		<updated>2015-12-04T21:27:30Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
We have used an Extract, Transform and Load (https://en.wikipedia.org/wiki/Extract,_transform,_loadETL) tool, [[Pentaho Kettle]] (http://community.pentaho.com/projects/data-integration/) to perform the data migration  from Expertiza to PRML database.&lt;br /&gt;
[[File:diagram.png]]&lt;br /&gt;
The Pentaho Kettle tool extracts data from the expertise schema, performs transformation on it and load the data in the PRML format.&lt;br /&gt;
The tables are mapped as shown in the schema map above. &lt;br /&gt;
The operations performed by the ETL tool:&lt;br /&gt;
&lt;br /&gt;
'''Extraction'''&lt;br /&gt;
The data is extracted from the expertise database and brought into the staging area by this operation of the ETL tool. It is the staging area in which all the transformation are done.&lt;br /&gt;
&lt;br /&gt;
'''Transformation'''&lt;br /&gt;
Many operations are performed on the data in the staging area so that the expertise schema can be converted to the PRML schema. This is called transformation of the data.&lt;br /&gt;
Some of the transformation performed for the project are:&lt;br /&gt;
&lt;br /&gt;
'''Loading:'''&lt;br /&gt;
The transformed data when moved from the staging area to the PRML database is called as loading. There are two types of loading implemented on the tables depending on the size of the table – partial loading and full loading.&lt;br /&gt;
Partial Loading: Only the new or updated entries in the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for table with very large number of entries. Eg: Reviews&lt;br /&gt;
Full Loading: All the entries from the expertiza table are transformed and loaded in the corresponding PRML table. This is generally done for tables will less number of entries.&lt;br /&gt;
Eg: Courses&lt;br /&gt;
Full and partial loading is implemented with the help of timestamps.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100094</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100094"/>
		<updated>2015-12-04T21:20:16Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Expertiza database schema to PRML database schema map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions, questionnaires	&lt;br /&gt;
!criterion&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.txt	&lt;br /&gt;
|CriterionTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|CriterionDescription&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questions.type	&lt;br /&gt;
|Type&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|questionnaires.max_question_score	&lt;br /&gt;
|MaxLabel&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|questionnaires.min_question_score	&lt;br /&gt;
|MinLabel&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!question_advices	&lt;br /&gt;
!Level&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|LevelID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|score	&lt;br /&gt;
|LevelLabel&lt;br /&gt;
|-	&lt;br /&gt;
|&lt;br /&gt;
|advice	&lt;br /&gt;
|LevelDescription&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!questions	&lt;br /&gt;
!Rubric&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|questions.id&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!teams	&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|type&lt;br /&gt;
|&lt;br /&gt;
|- 	&lt;br /&gt;
|&lt;br /&gt;
|parent_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
!participants&lt;br /&gt;
!Actor&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|type 	&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|parent_id&lt;br /&gt;
|-	&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
!ActorTask&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|		&lt;br /&gt;
!teams_users	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|team_id&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!participants	&lt;br /&gt;
!Participant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|user_id	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|id	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ActorParticipant&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|RoleID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Enrollment&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ParticipantID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AppID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!Teams	&lt;br /&gt;
!Artifact&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ActorID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|name	&lt;br /&gt;
|ArtifactContent&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactCharLength&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|ArtifactEnd&lt;br /&gt;
|-		&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Item&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|ItemContent&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ArtifactId&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!Review&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
!TABLE NAME&lt;br /&gt;
|		&lt;br /&gt;
!ReviewCriterionLevel&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES&lt;br /&gt;
|		&lt;br /&gt;
|AssessorActorID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|AssessedArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CriterionID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|CritiqueArtifactID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalMode&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|EvalLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|	&lt;br /&gt;
|ValueOrdinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|ValueCardinal&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|	&lt;br /&gt;
|Comment&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100090</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100090"/>
		<updated>2015-12-04T19:47:28Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Expertiza database schema to PRML database schema map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
!TABLE NAME	&lt;br /&gt;
!due_dates, deadline_types	&lt;br /&gt;
!Task&lt;br /&gt;
|-&lt;br /&gt;
!ATTRIBUTES	&lt;br /&gt;
|due_dates.id	&lt;br /&gt;
|TaskID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.deadline_type_id	&lt;br /&gt;
|TaskTypeID&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|deadline_types.name	&lt;br /&gt;
|TaskTitle&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.description_url	&lt;br /&gt;
|TaskDescription&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|NULL	&lt;br /&gt;
|TaskOpen&lt;br /&gt;
|-&lt;br /&gt;
|	&lt;br /&gt;
|due_dates.due_at	&lt;br /&gt;
|TaskDue&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100089</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100089"/>
		<updated>2015-12-04T19:41:33Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Expertiza database schema to PRML database schema map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Assignments&lt;br /&gt;
! Assignment&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| AssignmentId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|AssignmentCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|AssignmentTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|spec_location	&lt;br /&gt;
|AssignmentDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|course_id	&lt;br /&gt;
|CourseID&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100088</id>
		<title>User:Mrohatg2</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mrohatg2&amp;diff=100088"/>
		<updated>2015-12-04T19:37:30Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;E1575 - Share the data in Expertiza to a remote server via PRML format&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza database schema to PRML database schema map ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Table Name&lt;br /&gt;
! Courses&lt;br /&gt;
! Course&lt;br /&gt;
|-&lt;br /&gt;
!Attributes&lt;br /&gt;
| id&lt;br /&gt;
| CourseId&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null&lt;br /&gt;
|CourseCIPCode&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|name	&lt;br /&gt;
|CourseTitle&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|info	&lt;br /&gt;
|CourseDescription&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseLevelID&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|created_at	&lt;br /&gt;
|CourseCreated&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseStarted&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|null	&lt;br /&gt;
|CourseEnded&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| row 2, cell 1&lt;br /&gt;
| row 2, cell 2&lt;br /&gt;
| row 2, cell 3&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:PRML.png&amp;diff=100087</id>
		<title>File:PRML.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:PRML.png&amp;diff=100087"/>
		<updated>2015-12-04T19:18:02Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: uploaded a new version of &amp;amp;quot;File:PRML.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:PRML.png&amp;diff=100086</id>
		<title>File:PRML.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:PRML.png&amp;diff=100086"/>
		<updated>2015-12-04T19:17:31Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: uploaded a new version of &amp;amp;quot;File:PRML.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:PRML.png&amp;diff=100085</id>
		<title>File:PRML.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:PRML.png&amp;diff=100085"/>
		<updated>2015-12-04T19:15:29Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1575_Share_the_data_in_Expertiza_to_a_remote_server_via_PRML_format&amp;diff=100084</id>
		<title>CSC/ECE 517 Fall 2015 E1575 Share the data in Expertiza to a remote server via PRML format</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1575_Share_the_data_in_Expertiza_to_a_remote_server_via_PRML_format&amp;diff=100084"/>
		<updated>2015-12-04T19:11:08Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: Created page with &amp;quot;== Problem Statement == Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use.  Each peer-review system has a dif...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
Educational peer-review systems like Expertiza contains a huge volume of data accumulated during the course of its use. &lt;br /&gt;
Each peer-review system has a different database design. The relational model is so diverse that, it is often difficult to share the data across different peer-review systems.&lt;br /&gt;
&lt;br /&gt;
In order to migrate a student’s data from one peer-review system to another, one will have to do the following:&lt;br /&gt;
#Understand the database design/schema of the source peer-review system&lt;br /&gt;
#Understand the database design/schema of the destination peer-review system&lt;br /&gt;
#Find the equivalent tables and relations in the destination peer-review system for the source peer-review system&lt;br /&gt;
#Retrieve the data from the source peer-review system&lt;br /&gt;
#Modify it to match the schema of the destination peer-review system&lt;br /&gt;
#Insert the data to the destination peer-review system database.&lt;br /&gt;
&lt;br /&gt;
This is a very tedious job. Moreover, with such a diverse schema it is quite difficult to leverage the power of this large structured data and run any sort of analytics on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution ==&lt;br /&gt;
One solution to the above mentioned problem is to have a common schema which can capture the essence of all the reviews in a peer-review system to its entirety. Moreover, this schema should not capture any information specific to a particular peer-review system. Once such a schema standard is in place the different peer-review systems can export the data in their database to this new standard and the data can be easily shared across different peer-review systems.&lt;br /&gt;
=== PRML ===&lt;br /&gt;
Peer Review Markup Language is such a standard schema which can capture information about different reviews to its entirety.&lt;br /&gt;
&lt;br /&gt;
== Scope of the Project  ==&lt;br /&gt;
The scope of this project is to export the data from the Expertiza database to PRML format.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Design Document ==&lt;br /&gt;
[[File:Pg_development.png]]&lt;br /&gt;
&lt;br /&gt;
== Expertiza Database Diagram ==&lt;br /&gt;
[[File:PRML.png]]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=100083</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=100083"/>
		<updated>2015-12-04T19:10:36Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Final Project Design Document */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VGA]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/oss_E1573_sap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1559 rrz]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1570 avr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1556 CHM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1504 JJD]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1562 APS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1550 KMM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1551 RGS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1555 GMR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1552 NFR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1565 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1561 WZL]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1553 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1554 AAR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1569 JNR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1560 PSV]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1505 MSV]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1557 GXM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1566 ARB]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1567 APT]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1574 BKS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/ossA1550RAN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1571]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1563 ASA]]&lt;br /&gt;
&lt;br /&gt;
==Final Project Design Document==&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1577 MayYellowRoverJump]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1580 Text metrics]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1582 Create integration tests for the instructor interface using capybara and rspec]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1576 Refactoring submitted content (hyperlinks and files)]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1585 Use Ajax for Add Participants, Add TA ,Edit Questionnaires Screens]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1581 Integration testing for student interface]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1583 Fix the CSS used for Menu Item]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1591 Integration testing for peer review]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1589 Automating production setup and deployment]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1502 Improve HTTP monitoring devtool support]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1503 Integrate xml5ever XML parser]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1505 Add conformance tests to unicode-bidi and fix conformance bugs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 M1501 Report CSS errors to the devtools, both stored and live]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1579 Instructor account creation over the web]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 A1550 Web Socket Implementation in Apache Ambari]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1584 Send Feedback to Support]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015 E1575 Share the data in Expertiza to a remote server via PRML format]]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97715</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97715"/>
		<updated>2015-10-31T21:41:00Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
The VCL image of the project is: http://152.46.17.13:3000/ &lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code, from create and accept methods.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb added method for messages and invitation====&lt;br /&gt;
{| class ==&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|private def set_messages(name) &lt;br /&gt;
    @@messages[:user_not_found] = &amp;quot;\&amp;quot;#{name}\&amp;quot; does not exist. Please make sure entered name is correct.&amp;quot;&lt;br /&gt;
    @@messages[:user_not_participant] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
    @@messages[:max_members] = &amp;quot;Maximum team limit has been reached.&amp;quot;&lt;br /&gt;
    @@messages[:already_member] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is already a team member.&amp;quot;&lt;br /&gt;
    @@messages[:already_invited] = &amp;quot;You have already sent an invitation to \&amp;quot;#{name}\&amp;quot;.&amp;quot;&lt;br /&gt;
    @@messages[:full_team] = &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
    @@messages[:invitation_not_exist]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    @@messages[:fail_to_add] = &amp;quot;Something went wrong in the system. Hence failed to add you to the team which invited you. Please try again.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
private def set_invitation(to_id,from_id,assignment_id,reply_status)&lt;br /&gt;
    @invitation = Invitation.new&lt;br /&gt;
    @invitation.to_id = to_id&lt;br /&gt;
    @invitation.from_id = from_id&lt;br /&gt;
    @invitation.assignment_id = assignment_id&lt;br /&gt;
    @invitation.reply_status = reply_status&lt;br /&gt;
    @invitation.save&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== joinTeamRequestsController.rb - Decline and destroy method should check for successful operation before returning.====&lt;br /&gt;
{| class= &amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D'&lt;br /&gt;
    @join_team_request.save&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:teams_user_id]&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D' #'D' stands for decline&lt;br /&gt;
&lt;br /&gt;
    if @join_team_request.save&lt;br /&gt;
      redirect_to view_student_teams_path student_id: params[:teams_user_id], notice: &amp;quot;JoinTeamRequest was successfully declined.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;Decline request could not be performed.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
|-&lt;br /&gt;
|def destroy&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.destroy&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
      format.xml  { head :ok }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def destroy # destroy a join_team_request entry of a particular id&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    if @join_team_request.destroy&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
        format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
        format.xml  { head :ok }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;JoinTeamRequest could not deleted.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
== References ==&lt;br /&gt;
[https://github.com/mandgerohit/expertiza Our Repository]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit Document for our project requirement]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Repository]&lt;br /&gt;
&lt;br /&gt;
[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza wiki page]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/589 Expertiza pull requests]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97708</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97708"/>
		<updated>2015-10-31T21:36:36Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
The VCL image of the project is: http://152.46.17.13:3000/ &lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code, from create and accept methods.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb added method for messages and invitation====&lt;br /&gt;
{| class ==&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|private def set_messages(name) &lt;br /&gt;
    @@messages[:user_not_found] = &amp;quot;\&amp;quot;#{name}\&amp;quot; does not exist. Please make sure entered name is correct.&amp;quot;&lt;br /&gt;
    @@messages[:user_not_participant] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
    @@messages[:max_members] = &amp;quot;Maximum team limit has been reached.&amp;quot;&lt;br /&gt;
    @@messages[:already_member] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is already a team member.&amp;quot;&lt;br /&gt;
    @@messages[:already_invited] = &amp;quot;You have already sent an invitation to \&amp;quot;#{name}\&amp;quot;.&amp;quot;&lt;br /&gt;
    @@messages[:full_team] = &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
    @@messages[:invitation_not_exist]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    @@messages[:fail_to_add] = &amp;quot;Something went wrong in the system. Hence failed to add you to the team which invited you. Please try again.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
private def set_invitation(to_id,from_id,assignment_id,reply_status)&lt;br /&gt;
    @invitation = Invitation.new&lt;br /&gt;
    @invitation.to_id = to_id&lt;br /&gt;
    @invitation.from_id = from_id&lt;br /&gt;
    @invitation.assignment_id = assignment_id&lt;br /&gt;
    @invitation.reply_status = reply_status&lt;br /&gt;
    @invitation.save&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== joinTeamRequestsController.rb - Decline and destroy method should check for successful operation before returning.====&lt;br /&gt;
{| class= &amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D'&lt;br /&gt;
    @join_team_request.save&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:teams_user_id]&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D' #'D' stands for decline&lt;br /&gt;
&lt;br /&gt;
    if @join_team_request.save&lt;br /&gt;
      redirect_to view_student_teams_path student_id: params[:teams_user_id], notice: &amp;quot;JoinTeamRequest was successfully declined.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;Decline request could not be performed.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
|-&lt;br /&gt;
|def destroy&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.destroy&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
      format.xml  { head :ok }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def destroy # destroy a join_team_request entry of a particular id&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    if @join_team_request.destroy&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
        format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
        format.xml  { head :ok }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;JoinTeamRequest could not deleted.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
== References ==&lt;br /&gt;
[https://github.com/mandgerohit/expertiza Our Repository]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit Document for our project requirement]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Repository]&lt;br /&gt;
&lt;br /&gt;
[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza wiki page]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pulls Expertiza pull requests]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97703</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97703"/>
		<updated>2015-10-31T21:27:06Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code, from create and accept methods.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb added method for messages and invitation====&lt;br /&gt;
{| class ==&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|private def set_messages(name) &lt;br /&gt;
    @@messages[:user_not_found] = &amp;quot;\&amp;quot;#{name}\&amp;quot; does not exist. Please make sure entered name is correct.&amp;quot;&lt;br /&gt;
    @@messages[:user_not_participant] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
    @@messages[:max_members] = &amp;quot;Maximum team limit has been reached.&amp;quot;&lt;br /&gt;
    @@messages[:already_member] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is already a team member.&amp;quot;&lt;br /&gt;
    @@messages[:already_invited] = &amp;quot;You have already sent an invitation to \&amp;quot;#{name}\&amp;quot;.&amp;quot;&lt;br /&gt;
    @@messages[:full_team] = &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
    @@messages[:invitation_not_exist]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    @@messages[:fail_to_add] = &amp;quot;Something went wrong in the system. Hence failed to add you to the team which invited you. Please try again.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
private def set_invitation(to_id,from_id,assignment_id,reply_status)&lt;br /&gt;
    @invitation = Invitation.new&lt;br /&gt;
    @invitation.to_id = to_id&lt;br /&gt;
    @invitation.from_id = from_id&lt;br /&gt;
    @invitation.assignment_id = assignment_id&lt;br /&gt;
    @invitation.reply_status = reply_status&lt;br /&gt;
    @invitation.save&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== joinTeamRequestsController.rb - Decline and destroy method should check for successful operation before returning.====&lt;br /&gt;
{| class= &amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D'&lt;br /&gt;
    @join_team_request.save&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:teams_user_id]&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D' #'D' stands for decline&lt;br /&gt;
&lt;br /&gt;
    if @join_team_request.save&lt;br /&gt;
      redirect_to view_student_teams_path student_id: params[:teams_user_id], notice: &amp;quot;JoinTeamRequest was successfully declined.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;Decline request could not be performed.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
|-&lt;br /&gt;
|def destroy&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.destroy&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
      format.xml  { head :ok }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def destroy # destroy a join_team_request entry of a particular id&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    if @join_team_request.destroy&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
        format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
        format.xml  { head :ok }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;JoinTeamRequest could not deleted.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
== References ==&lt;br /&gt;
[https://github.com/mandgerohit/expertiza Our Repository]&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit Document for our project requirement]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Repository]&lt;br /&gt;
&lt;br /&gt;
[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza wiki page]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pulls Expertiza pull requests]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97692</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97692"/>
		<updated>2015-10-31T21:21:23Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code, from create and accept methods.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb added method for messages and invitation====&lt;br /&gt;
{| class ==&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|private def set_messages(name) &lt;br /&gt;
    @@messages[:user_not_found] = &amp;quot;\&amp;quot;#{name}\&amp;quot; does not exist. Please make sure entered name is correct.&amp;quot;&lt;br /&gt;
    @@messages[:user_not_participant] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
    @@messages[:max_members] = &amp;quot;Maximum team limit has been reached.&amp;quot;&lt;br /&gt;
    @@messages[:already_member] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is already a team member.&amp;quot;&lt;br /&gt;
    @@messages[:already_invited] = &amp;quot;You have already sent an invitation to \&amp;quot;#{name}\&amp;quot;.&amp;quot;&lt;br /&gt;
    @@messages[:full_team] = &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
    @@messages[:invitation_not_exist]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    @@messages[:fail_to_add] = &amp;quot;Something went wrong in the system. Hence failed to add you to the team which invited you. Please try again.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
private def set_invitation(to_id,from_id,assignment_id,reply_status)&lt;br /&gt;
    @invitation = Invitation.new&lt;br /&gt;
    @invitation.to_id = to_id&lt;br /&gt;
    @invitation.from_id = from_id&lt;br /&gt;
    @invitation.assignment_id = assignment_id&lt;br /&gt;
    @invitation.reply_status = reply_status&lt;br /&gt;
    @invitation.save&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== joinTeamRequestsController.rb - Decline and destroy method should check for successful operation before returning.====&lt;br /&gt;
{| class= &amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D'&lt;br /&gt;
    @join_team_request.save&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:teams_user_id]&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D' #'D' stands for decline&lt;br /&gt;
&lt;br /&gt;
    if @join_team_request.save&lt;br /&gt;
      redirect_to view_student_teams_path student_id: params[:teams_user_id], notice: &amp;quot;JoinTeamRequest was successfully declined.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;Decline request could not be performed.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
|-&lt;br /&gt;
|def destroy&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.destroy&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
      format.xml  { head :ok }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def destroy # destroy a join_team_request entry of a particular id&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    if @join_team_request.destroy&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
        format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
        format.xml  { head :ok }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;JoinTeamRequest could not deleted.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
== References ==&lt;br /&gt;
[https://github.com/mandgerohit/expertiza Our Repository]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97680</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97680"/>
		<updated>2015-10-31T21:10:38Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code, from create and accept methods.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb added method for messages and invitation====&lt;br /&gt;
{| class ==&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|private def set_messages(name) &lt;br /&gt;
    @@messages[:user_not_found] = &amp;quot;\&amp;quot;#{name}\&amp;quot; does not exist. Please make sure entered name is correct.&amp;quot;&lt;br /&gt;
    @@messages[:user_not_participant] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
    @@messages[:max_members] = &amp;quot;Maximum team limit has been reached.&amp;quot;&lt;br /&gt;
    @@messages[:already_member] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is already a team member.&amp;quot;&lt;br /&gt;
    @@messages[:already_invited] = &amp;quot;You have already sent an invitation to \&amp;quot;#{name}\&amp;quot;.&amp;quot;&lt;br /&gt;
    @@messages[:full_team] = &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
    @@messages[:invitation_not_exist]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    @@messages[:fail_to_add] = &amp;quot;Something went wrong in the system. Hence failed to add you to the team which invited you. Please try again.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
private def set_invitation(to_id,from_id,assignment_id,reply_status)&lt;br /&gt;
    @invitation = Invitation.new&lt;br /&gt;
    @invitation.to_id = to_id&lt;br /&gt;
    @invitation.from_id = from_id&lt;br /&gt;
    @invitation.assignment_id = assignment_id&lt;br /&gt;
    @invitation.reply_status = reply_status&lt;br /&gt;
    @invitation.save&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== joinTeamRequestsController.rb - Decline and destroy method should check for successful operation before returning.====&lt;br /&gt;
{| class= &amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D'&lt;br /&gt;
    @join_team_request.save&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:teams_user_id]&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def decline&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.status = 'D' #'D' stands for decline&lt;br /&gt;
&lt;br /&gt;
    if @join_team_request.save&lt;br /&gt;
      redirect_to view_student_teams_path student_id: params[:teams_user_id], notice: &amp;quot;JoinTeamRequest was successfully declined.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;Decline request could not be performed.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
|-&lt;br /&gt;
|def destroy&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    @join_team_request.destroy&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
      format.xml  { head :ok }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def destroy # destroy a join_team_request entry of a particular id&lt;br /&gt;
    @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
    if @join_team_request.destroy&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
        format.html { redirect_to(join_team_requests_url) }&lt;br /&gt;
        format.xml  { head :ok }&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to root_path, notice: &amp;quot;JoinTeamRequest could not deleted.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97679</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97679"/>
		<updated>2015-10-31T21:02:06Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb added method for messages and invitation====&lt;br /&gt;
{| class ==&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|private def set_messages(name) &lt;br /&gt;
    @@messages[:user_not_found] = &amp;quot;\&amp;quot;#{name}\&amp;quot; does not exist. Please make sure entered name is correct.&amp;quot;&lt;br /&gt;
    @@messages[:user_not_participant] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
    @@messages[:max_members] = &amp;quot;Maximum team limit has been reached.&amp;quot;&lt;br /&gt;
    @@messages[:already_member] = &amp;quot;\&amp;quot;#{name}\&amp;quot; is already a team member.&amp;quot;&lt;br /&gt;
    @@messages[:already_invited] = &amp;quot;You have already sent an invitation to \&amp;quot;#{name}\&amp;quot;.&amp;quot;&lt;br /&gt;
    @@messages[:full_team] = &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
    @@messages[:invitation_not_exist]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    @@messages[:fail_to_add] = &amp;quot;Something went wrong in the system. Hence failed to add you to the team which invited you. Please try again.&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
private def set_invitation(to_id,from_id,assignment_id,reply_status)&lt;br /&gt;
    @invitation = Invitation.new&lt;br /&gt;
    @invitation.to_id = to_id&lt;br /&gt;
    @invitation.from_id = from_id&lt;br /&gt;
    @invitation.assignment_id = assignment_id&lt;br /&gt;
    @invitation.reply_status = reply_status&lt;br /&gt;
    @invitation.save&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97678</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97678"/>
		<updated>2015-10-31T20:56:53Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97677</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97677"/>
		<updated>2015-10-31T20:56:10Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*'''Change the find_by_sql call(s) to Rails (Active Record) statements.'''&lt;br /&gt;
*'''Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb create and accept methods refactored====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb Change the find_by_sql call(s) to Rails (Active Record) statements.====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!! After&lt;br /&gt;
|-&lt;br /&gt;
| @users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank? ||User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb changed to allow TA and instructor to be a part of a team ====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def action_allowed?&lt;br /&gt;
    current_role_name.eql?(&amp;quot;Student&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
||&lt;br /&gt;
def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
  end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97675</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97675"/>
		<updated>2015-10-31T20:42:33Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*'''Change the find_by_sql call(s) to Rails (Active Record) statements.'''&lt;br /&gt;
*'''Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97673</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97673"/>
		<updated>2015-10-31T20:41:45Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*'''Refactor create and accept methods.'''  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*'''Change the find_by_sql call(s) to Rails (Active Record) statements.'''&lt;br /&gt;
*'''Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== InvitationController.rb====&lt;br /&gt;
{| class = &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Before!!After&lt;br /&gt;
|-&lt;br /&gt;
|def create&lt;br /&gt;
    user = User.find_by_name(params[:user][:name].strip)&lt;br /&gt;
    team = AssignmentTeam.find(params[:team_id])&lt;br /&gt;
    student = AssignmentParticipant.find(params[:student_id])&lt;br /&gt;
    return unless current_user_id?(student.user_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the invited user is valid&lt;br /&gt;
    if !user&lt;br /&gt;
      flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; does not exist. Please make sure the name entered is correct.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      participant= AssignmentParticipant.where('user_id =? and parent_id =?', user.id, student.parent_id).first&lt;br /&gt;
      #check if the user is a participant of the assignment&lt;br /&gt;
      if !participant&lt;br /&gt;
        flash[:note] = &amp;quot;\&amp;quot;#{params[:user][:name].strip}\&amp;quot; is not a participant of this assignment.&amp;quot;&lt;br /&gt;
      elsif team.full?&lt;br /&gt;
         flash[:error] = &amp;quot;Your team already has max members.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        team_member = TeamsUser.where(['team_id =? and user_id =?', team.id, user.id])&lt;br /&gt;
        #check if invited user is already in the team&lt;br /&gt;
        if (team_member.size &amp;gt; 0)&lt;br /&gt;
          flash[:note] = &amp;quot;\&amp;quot;#{user.name}\&amp;quot; is already a member of team.&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
          #check if the invited user is already invited (i.e. awaiting reply)&lt;br /&gt;
          if Invitation.is_invited?(student.user_id, user.id, student.parent_id)&lt;br /&gt;
            @invitation = Invitation.new&lt;br /&gt;
            @invitation.to_id = user.id&lt;br /&gt;
            @invitation.from_id = student.user_id&lt;br /&gt;
            @invitation.assignment_id = student.parent_id&lt;br /&gt;
            @invitation.reply_status = 'W'&lt;br /&gt;
            @invitation.save&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = &amp;quot;You have already sent an invitation to \&amp;quot;#{user.name}\&amp;quot;.&amp;quot;&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
def accept&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    ready_to_join=false&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= &amp;quot;The team which invited you does not exist any more.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      if inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= &amp;quot;The team which invited you is full now.&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        ready_to_join=true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
||&lt;br /&gt;
def create    #adds the new invitation to the table&lt;br /&gt;
          if Invitation.is_invited?(@student.user_id, @user.id, @student.parent_id)&lt;br /&gt;
            set_invitation(@user.id,@student.user_id,@student.parent_id,'W') #'W states the invitation is waitlisted, still not accepted'&lt;br /&gt;
          else&lt;br /&gt;
            flash[:note] = @@messages[:already_invited]&lt;br /&gt;
          end&lt;br /&gt;
    update_join_team_request @user,@student&lt;br /&gt;
    redirect_to view_student_teams_path student_id: @student.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def update_join_team_request(user,student) #update the status in the join_team_request to A&lt;br /&gt;
    if user &amp;amp;&amp;amp; student&lt;br /&gt;
      participant= AssignmentParticipant.where(['user_id =? and parent_id =?', user.id, student.parent_id]).first&lt;br /&gt;
      if participant&lt;br /&gt;
        old_entry = JoinTeamRequest.where(['participant_id =? and team_id =?', participant.id,params[:team_id]]).first&lt;br /&gt;
        if old_entry&lt;br /&gt;
          old_entry.update_attribute(&amp;quot;status&amp;quot;,'A') # 'A' states that the invitation has been accepted&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def auto_complete_for_user_name # searches the user name in the user table for auto complete&lt;br /&gt;
    search = params[:user][:name].to_s&lt;br /&gt;
    User.where(User.arel_table[:name].matches(&amp;quot;%#{search}%&amp;quot;))&lt;br /&gt;
    #@users = User.find_by_sql(&amp;quot;select * from users where LOWER(name) LIKE '%&amp;quot;+search+&amp;quot;%'&amp;quot;) unless search.blank?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def accept # allows accepting of the invitation&lt;br /&gt;
    @inv = Invitation.find(params[:inv_id])&lt;br /&gt;
    student = Participant.find(params[:student_id])&lt;br /&gt;
    assignment_id=@inv.assignment_id&lt;br /&gt;
    inviter_user_id=@inv.from_id&lt;br /&gt;
    inviter_participant = AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id,assignment_id)&lt;br /&gt;
&lt;br /&gt;
    #check if the inviter's team is still existing, and have available slot to add the invitee&lt;br /&gt;
    inviter_assignment_team = AssignmentTeam.team(inviter_participant)&lt;br /&gt;
    if inviter_assignment_team.nil?&lt;br /&gt;
      flash[:error]= @@messages[:invitation_not_exist]&lt;br /&gt;
    elsif inviter_assignment_team.full?&lt;br /&gt;
        flash[:error]= @@messages[:full_team]&lt;br /&gt;
    else&lt;br /&gt;
      @inv.reply_status = 'A'&lt;br /&gt;
      @inv.save&lt;br /&gt;
&lt;br /&gt;
      #Remove the users previous team since they are accepting an invite for possibly a new team.&lt;br /&gt;
      TeamsUser.remove_team(student.user_id, params[:team_id])&lt;br /&gt;
&lt;br /&gt;
      #Accept the invite and return boolean on whether the add was successful&lt;br /&gt;
      add_successful = Invitation.accept_invite(params[:team_id], @inv.from_id, @inv.to_id, student.parent_id)&lt;br /&gt;
&lt;br /&gt;
      unless add_successful&lt;br /&gt;
        flash[:error] = @@messages[:fail_to_add]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to view_student_teams_path student_id: params[:student_id]&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97667</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97667"/>
		<updated>2015-10-31T20:30:54Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring join_team_request_controller.rb and invitation_controller.rb files so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
''JoinTeamRequestsController'' and ''InvitationController''&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
'''invitation_controller.rb''' is used by a user to invite other users to join his/her team. It performs validation before creating a request. Following chunk of code checks whether the user is allowed to get the invite or not.&lt;br /&gt;
    def action_allowed? # user specified only have access to the functionality of the controller&lt;br /&gt;
    ['Student', 'Instructor', 'Teaching Assistant'].include?(current_role_name)&lt;br /&gt;
    end&lt;br /&gt;
Now, invited user can accept or reject the request.&lt;br /&gt;
Once the user has accepted the request, he can be seen as a part of the team.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb''' is used when user decides to join a team.&lt;br /&gt;
This is achieved by creating an advertisement for the team.&lt;br /&gt;
Once the advertisement is created, it is shown in the Topic Selection section.&lt;br /&gt;
The user who wants to join the team can send a &amp;quot;Request&amp;quot; to the members of the team.&lt;br /&gt;
The members can then decide whether to send him/her an invite or decline the request.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The invitation_controller.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the ''accept'' and ''create'' method can be broken down into separate methods.&lt;br /&gt;
&lt;br /&gt;
In join_team_request_controller.rb has duplicate code in various methods which can be removed by creating a separate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''invitation_controller.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*'''Refactor create and accept methods.'''  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*'''Change the find_by_sql call(s) to Rails (Active Record) statements.'''&lt;br /&gt;
*'''Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''join_team_requests_controller.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||170 &lt;br /&gt;
&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
||  resources :join_team_requests do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :decline&lt;br /&gt;
      get :edit&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/join_team_requests/_list_received.html.erb ||33||  &amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt; ||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97496</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97496"/>
		<updated>2015-10-31T06:29:50Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*'''Refactor create and accept methods.'''  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*'''Change the find_by_sql call(s) to Rails (Active Record) statements.'''&lt;br /&gt;
*'''Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*'''Update create and accept method to share code.'''&lt;br /&gt;
*'''Decline and destroy method should check for successful operation before returning.'''&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97494</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97494"/>
		<updated>2015-10-31T06:24:12Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*Update create and accept method to share code.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/controllers/invitations_controller.rb||1||class InvitationController &amp;lt; ApplicationController||class InvitationsController &amp;lt; ApplicationController&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97493</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97493"/>
		<updated>2015-10-31T06:22:07Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*Update create and accept method to share code.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
|-&lt;br /&gt;
|    ||&lt;br /&gt;
|-&lt;br /&gt;
| def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
     respond_to do |format|&lt;br /&gt;
       format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request }&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
||private def render_request&lt;br /&gt;
      respond_to do |format|&lt;br /&gt;
      format.html &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_request } &lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def show # searches the join team requests for a particular id&lt;br /&gt;
     @join_team_request = JoinTeamRequest.find(params[:id]) &lt;br /&gt;
      render_request # show.html.erb&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
def new # create a new join team request entry instance&lt;br /&gt;
     @join_team_request = JoinTeamRequest.new&lt;br /&gt;
     render_request # new.html.erb&lt;br /&gt;
   end&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97487</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97487"/>
		<updated>2015-10-31T06:16:06Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*Update create and accept method to share code.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== JoinTeamRequestController.rb removed duplicate code====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
|def index                                                 &lt;br /&gt;
    @join_team_requests = JoinTeamRequest.all                     &lt;br /&gt;
    respond_to do |format|                                       &lt;br /&gt;
      format.html # index.html.erb                                &lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @join_team_requests }       &lt;br /&gt;
 end &lt;br /&gt;
||def index&lt;br /&gt;
    @join_team_request = JoinTeamRequest.all&lt;br /&gt;
    render_request # index.html.erb&lt;br /&gt;
 end&lt;br /&gt;
| &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97471</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97471"/>
		<updated>2015-10-31T05:58:42Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*Update create and accept method to share code.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
The controller renaming had to be incorporated in different files of the project. The table contain the file names along with the lines before and after the changes.&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97468</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97468"/>
		<updated>2015-10-31T05:52:47Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to Invitations_Controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*Update create and accept method to share code.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
==== Renamed invitation_controller.rb to invitations_controller.rb====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File Name !! Line no. !! Before !! After&lt;br /&gt;
|-&lt;br /&gt;
| config/routes.rb ||160 || resources :invitation do || resources :invitations do&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb ||151||  {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'cancel', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| app/views/student_teams/view.html.erb || 193 || {:controller =&amp;gt; 'invitation', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id}, ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'accept', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id, :team_id =&amp;gt; @team_id},&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb || 198 ||{:controller =&amp;gt; 'invitation', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt; ||{:controller =&amp;gt; 'invitations', :action =&amp;gt; 'decline', :inv_id =&amp;gt; inv.id, :student_id =&amp;gt; @student.id} %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|app/views/student_teams/view.html.erb||217||&amp;lt;%= form_tag :controller =&amp;gt; 'invitation', :action =&amp;gt; 'create' do %&amp;gt;||&amp;lt;%= form_tag :controller =&amp;gt; 'invitations', :action =&amp;gt; 'create' do %&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97461</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97461"/>
		<updated>2015-10-31T05:18:44Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* What needs to be done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to invitation_controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;br /&gt;
*Change the find_by_sql call(s) to Rails (Active Record) statements.&lt;br /&gt;
*Make sure that it can be used by a user with a TA or instructor account, if they are participating in this assignment.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;br /&gt;
&lt;br /&gt;
'''JoinTeamRequestsController.rb'''&lt;br /&gt;
*Add comments to the code.&lt;br /&gt;
*Remove duplicate code.&lt;br /&gt;
*Update create and accept method to share code.&lt;br /&gt;
*Decline and destroy method should check for successful operation before returning.&lt;br /&gt;
*Change grammatically wrong or awkward flash messages.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97458</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97458"/>
		<updated>2015-10-31T05:12:05Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
== Code Refactoring ==&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
* To remove duplicate code.&lt;br /&gt;
* To make the code more maintainable.&lt;br /&gt;
*To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
== Introduction to Expertiza  ==&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
==== Classes involved====  &lt;br /&gt;
JoinTeamRequestsController.rb and InvitationController.rb&lt;br /&gt;
&lt;br /&gt;
====What the controller does====&lt;br /&gt;
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. &lt;br /&gt;
JoinTeamRequestsController.rb is used when user decides to join a team.&lt;br /&gt;
&lt;br /&gt;
==== What's wrong with the code ====&lt;br /&gt;
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.&lt;br /&gt;
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.&lt;br /&gt;
&lt;br /&gt;
==== What needs to be done ====&lt;br /&gt;
'''InvitationController.rb''' &lt;br /&gt;
*Rename to invitation_controller.rb, as is not in accordance with current naming convention.&lt;br /&gt;
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.&lt;br /&gt;
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97445</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97445"/>
		<updated>2015-10-31T04:24:53Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Code Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ====&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
==== Code Refactoring ====&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; To remove duplicate code.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; To make the code more maintainable.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
==== Introduction to Expertiza  ====&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97444</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97444"/>
		<updated>2015-10-31T04:24:40Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* Code Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ====&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
==== Code Refactoring ====&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
-&amp;gt; To remove duplicate code.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; To make the code more maintainable.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; To divide functionality of the class&lt;br /&gt;
&lt;br /&gt;
==== Introduction to Expertiza  ====&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97443</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97443"/>
		<updated>2015-10-31T04:24:09Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* E1559: Refactoring JoinTeamRequestsController and InvitationController classes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ====&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;br /&gt;
&lt;br /&gt;
==== Code Refactoring ====&lt;br /&gt;
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:&lt;br /&gt;
-&amp;gt; To remove duplicate code.&lt;br /&gt;
-&amp;gt; To make the code more maintainable.&lt;br /&gt;
-&amp;gt; To divide functionality of the class   &lt;br /&gt;
&lt;br /&gt;
==== Introduction to Expertiza  ====&lt;br /&gt;
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97240</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97240"/>
		<updated>2015-10-28T19:13:49Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: /* E1559: Refactoring JoinTeamRequestsController and InvitationController classes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ====&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97239</id>
		<title>CSC/ECE 517 Fall 2015/oss E1559 rrz</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1559_rrz&amp;diff=97239"/>
		<updated>2015-10-28T19:13:14Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: Created page with &amp;quot;=== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  === This page gives a breif description on the expertiza based oss project that aimed at refac...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ===&lt;br /&gt;
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97238</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97238"/>
		<updated>2015-10-28T19:06:24Z</updated>

		<summary type="html">&lt;p&gt;Zganatr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VPGMAL]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/oss_E1573_sap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1559 rrz]]&lt;/div&gt;</summary>
		<author><name>Zganatr</name></author>
	</entry>
</feed>