<?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=Rahuja</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=Rahuja"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Rahuja"/>
	<updated>2026-08-12T15:57:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100131</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=100131"/>
		<updated>2015-12-04T23:29:58Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1586 AnonymousChatBetweenAuthorAndReviewer'''&lt;br /&gt;
&lt;br /&gt;
This page provides a brief description of the '''Expertiza''' project. The project is aimed at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
==Project==&lt;br /&gt;
&lt;br /&gt;
=== Introduction to Expertiza ===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a peer review based system which provides an incremental class based learning together with the instructors and the peers. This project has been developed together by faculty and students using [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza handles assignment submissions, team formations, assignment reviews and grades, etc.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help to extract, store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
The implementation team expects that the following design patterns be used in the solution:&lt;br /&gt;
 &lt;br /&gt;
* '''Observer Pattern'''&amp;lt;ref&amp;gt;Observer Design Pattern https://en.wikipedia.org/wiki/Observer_pattern&amp;lt;/ref&amp;gt;: The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For example, we are notifying the team members whenever the reviewer submits the query.&lt;br /&gt;
&lt;br /&gt;
* '''Iterator Pattern''': In our instance, we need to display the entire chat history of a particular interaction, hence we can use the iterator design pattern to iterate through the previous chat messages.&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_chats.png]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ARSNUsecase.jpeg]]&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
1. For use case 1, test whether all the team members receive email with the question.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. For use case 2, test whether the reviewer receive email with the response.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Test whether all the previous interactions are displayed as chat history.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The 'Ask Question' button should not be enabled until some text has been entered in the text area.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model '''ReviewChat''' .&lt;br /&gt;
&lt;br /&gt;
*Create a new controller '''ReviewChats'''.&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flowchart'''&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNFlowchart1.png]]&lt;br /&gt;
&lt;br /&gt;
'''Flow'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Submit&amp;quot; button.&lt;br /&gt;
[[File: FinalProject1.jpg]]&lt;br /&gt;
*On clicking this button the appropriate method is called in ReviewChats controller which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
[[File: FinalProject4.jpg]]&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*The authorized users will also be able to see a link to open existing chat interaction log.&lt;br /&gt;
[[File: FinalProject3.jpg]]&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
[[File: FinalProject2.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
&lt;br /&gt;
* Expertiza Github repository&amp;lt;ref&amp;gt;Expertiza Github repository https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_chats.png&amp;diff=100128</id>
		<title>File:Review chats.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_chats.png&amp;diff=100128"/>
		<updated>2015-12-04T23:29:07Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99222</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99222"/>
		<updated>2015-11-10T00:44:45Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Use Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help extract,store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
'''Name:''' Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Name:''' Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Actor:''' Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
'''Description:''' The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified:-'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model chat_feedback.rb &lt;br /&gt;
&lt;br /&gt;
*Create a new controller review_interactions_controller.rb&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flow:-'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Ask Question&amp;quot; button.&lt;br /&gt;
*On clicking this button the appropriate method is called in review_interactions_controller.rb which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99221</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99221"/>
		<updated>2015-11-10T00:44:06Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help extract,store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''Files created/modified:-'''&lt;br /&gt;
&lt;br /&gt;
*Create a new model chat_feedback.rb &lt;br /&gt;
&lt;br /&gt;
*Create a new controller review_interactions_controller.rb&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
'''Flow:-'''&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Ask Question&amp;quot; button.&lt;br /&gt;
*On clicking this button the appropriate method is called in review_interactions_controller.rb which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99220</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99220"/>
		<updated>2015-11-10T00:43:46Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help extract,store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Files created/modified:-&lt;br /&gt;
&lt;br /&gt;
*Create a new model chat_feedback.rb &lt;br /&gt;
&lt;br /&gt;
*Create a new controller review_interactions_controller.rb&lt;br /&gt;
&lt;br /&gt;
*Create new views as discussed in the design.&lt;br /&gt;
&lt;br /&gt;
*Modify view expertiza/app/views/response/response.html.erb to incorporate text box and corresponding submit button.&lt;br /&gt;
&lt;br /&gt;
Flow:-&lt;br /&gt;
&lt;br /&gt;
*The reviewer enters his question in the text area provided and clicks on the &amp;quot;Ask Question&amp;quot; button.&lt;br /&gt;
*On clicking this button the appropriate method is called in review_interactions_controller.rb which sends an email to all the authors of the topic indicating that a question has been asked about their work. The email contains a link which when clicked on will redirect the author to the appropriate view where he/she can answer the question.&lt;br /&gt;
*On answering the question, the reviewer receives an email indicating that his question has been answered. It also contains a link which redirects the reviewer to the appropriate view where the answer will be displayed.&lt;br /&gt;
*This view also contains the chat history between the author/s and the reviewer for the entire duration of the interaction.&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99216</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99216"/>
		<updated>2015-11-10T00:21:22Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Discussion of Resolution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
&lt;br /&gt;
We will make the following modifications to implement the chat feature:- &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create a new model which will help extract,store and validate data in the database table which contains information about the interaction between the author/s and reviewer.&lt;br /&gt;
&lt;br /&gt;
*Edit the view which is used by the response controller to incorporate the text area input field on the review form where the reviewer can ask his/her initial query.&lt;br /&gt;
&lt;br /&gt;
*Create a new controller which will contain methods to send emails to the author and reviewers as well as retrieve and display the chat history between the two.&lt;br /&gt;
&lt;br /&gt;
*Create a new view which will facilitate the author to respond to the queries asked by the reviewer. The reviewer can also use this view to ask any follow up questions.&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99081</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99081"/>
		<updated>2015-11-09T16:56:57Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Database Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviewer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99080</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99080"/>
		<updated>2015-11-09T08:27:17Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Database Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
The above figure shows the schema of a new table which will be created in Expertiza to store relevant information about the chat. It contains the following attributes:&lt;br /&gt;
* id: This attribute is auto-generated by rails when we create a table and is auto incremented with each record. It is also the primary key of our table.&lt;br /&gt;
* assignment_id: Stores the ID of the assignment for which the interaction between author and reviewer is taking place.&lt;br /&gt;
* reviwer_id: Stores the ID of the reviewer who asks the questions.&lt;br /&gt;
* team_id: Stores the ID of the team to which the topic belongs.&lt;br /&gt;
* type_flag: Flag which is used to indicate if the particular tuple contains a question or answer. It can take two values, 'Q' for question and 'A' for answer.&lt;br /&gt;
* content: Stores the question asked by the reviewer or the response given by the author/s depending on the value of the type flag.&lt;br /&gt;
&lt;br /&gt;
Records for a particular interaction can be identified by using a combination of assignment_id, reviewer_id and team_id.&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99079</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99079"/>
		<updated>2015-11-09T08:19:59Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Database Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:DatabaseTable.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DatabaseTable.jpg&amp;diff=99078</id>
		<title>File:DatabaseTable.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DatabaseTable.jpg&amp;diff=99078"/>
		<updated>2015-11-09T08:19:01Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99077</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99077"/>
		<updated>2015-11-09T07:50:59Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Use Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Reviewer. &amp;lt;br&amp;gt;&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&amp;lt;br&amp;gt;&lt;br /&gt;
Actor: Author/s&amp;lt;br&amp;gt;&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99076</id>
		<title>CSC/ECE 517 Fall 2015 E1586 AnonymousChatBetweenAuthorAndReviewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1586_AnonymousChatBetweenAuthorAndReviewer&amp;diff=99076"/>
		<updated>2015-11-09T07:42:26Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Use Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Intro&lt;br /&gt;
&lt;br /&gt;
== Assignment ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This project aims at developing an email based anonymous session between author and a reviewer so that reviewers can ask questions to the authors for any doubts related to the assignments during peer reviewing.&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
During reviews, many times reviewers will be having questions about the submitted material and if it's a blocker there is no way that the reviewer can progress further with the review.  As a result, reviewers will end up submitting the empty or incomplete review.&lt;br /&gt;
&lt;br /&gt;
=== Scope ===&lt;br /&gt;
This project is limited to an email based conversation for asking questions and answers. The reviewers would ask questions related to assignment submission doubts to which authors can respond. All this would be taken care as email responses using a link provided in the email. This project does not cater to any live interactive session with spontaneous back-to-back questions and responses.&lt;br /&gt;
&lt;br /&gt;
Following tasks would be incorporated in the project:&lt;br /&gt;
* Provide a ‘TextArea’ input field on review forms, where any reviewer can type in their questions.&lt;br /&gt;
* Create a new button ‘Ask for Quick Help’ on the review forms.&lt;br /&gt;
* An email would be send to the author with the link where he can respond to the questions asked by the reviewers for their submitted work.&lt;br /&gt;
* Reviewers would be notified by an email when authors respond to the the questions.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Discussion of Resolution ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Mock-Ups ===&lt;br /&gt;
The sample question box would look like:&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup1.JPG]]&lt;br /&gt;
&lt;br /&gt;
An interface with the question would be displayed on opening a link from the email.&lt;br /&gt;
The authors can reply the query which reviewers ask.&lt;br /&gt;
&lt;br /&gt;
[[File: ARSNMockup2.JPG]]&lt;br /&gt;
&lt;br /&gt;
=== Design Patterns ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
=== Use Cases ===&lt;br /&gt;
Name: Send a question to the author/s about their work.&lt;br /&gt;
Actor: Reviewer&lt;br /&gt;
Description: The reviewer enters his question in the text area which is provided and clicks on the &amp;quot;Ask question&amp;quot; button which is provided as shown in the mock up. On clicking this button an email is sent to the author/s along which a link to answer the question.&lt;br /&gt;
&lt;br /&gt;
Name: Answer the question which has been asked by the reviewer.&lt;br /&gt;
Actor: Author/s&lt;br /&gt;
Description: The author/s click on the link received in their email and are redirected to a page where they can answer the question. Once they submit the answer, an email is sent to the reviewer notifying him/her that their question has been answered.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Tests ===&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum&lt;br /&gt;
&lt;br /&gt;
== Suggestions for Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* This can be extended to a live interactive author-reviewer anonymous chat session inside the Expertiza reviews window.&lt;br /&gt;
* A purging script can be developed which will clear all the interaction records every semester.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98735</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98735"/>
		<updated>2015-11-07T05:02:01Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needed to be done'''===&lt;br /&gt;
* Keep only &amp;quot;auto selected&amp;quot; and &amp;quot;instructor selected reviewing&amp;quot;.&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
==='''Change in problem statement'''===&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality was needed to be removed.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing which needs to be removed.&lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb (Entire file deleted)&lt;br /&gt;
*  dynamic_review_assignment_helper.rb (Entire file deleted)&lt;br /&gt;
*  review_mapping_controller.rb (Only specific method mentioned below deleted)&lt;br /&gt;
&lt;br /&gt;
The method show_available_submissions() in review_mapping_controller.rb was calling student selected reviewing. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this was the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted the entire helper classes and there has been no code addition, we cannot add any new test cases for deleted code. However, we can manually test to ensure that the code deletion did not cause any broken links by following the steps mentioned below.&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98734</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98734"/>
		<updated>2015-11-07T04:59:58Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Deletion of &amp;quot;student-selected&amp;quot; reviewing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needed to be done'''===&lt;br /&gt;
* Keep only &amp;quot;auto selected&amp;quot; and &amp;quot;instructor selected reviewing&amp;quot;.&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
==='''Change in problem statement'''===&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality was needed to be removed.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing which needs to be removed.&lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb (Entire file deleted)&lt;br /&gt;
*  dynamic_review_assignment_helper.rb (Entire file deleted)&lt;br /&gt;
*  review_mapping_controller.rb (Only specific method mentioned below deleted)&lt;br /&gt;
&lt;br /&gt;
The method show_available_submissions() in review_mapping_controller.rb was calling student selected reviewing. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this was the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98733</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98733"/>
		<updated>2015-11-07T04:55:06Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* What needed to be done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needed to be done'''===&lt;br /&gt;
* Keep only &amp;quot;auto selected&amp;quot; and &amp;quot;instructor selected reviewing&amp;quot;.&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
==='''Change in problem statement'''===&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality was needed to be removed.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98732</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98732"/>
		<updated>2015-11-07T04:53:53Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Change in problem statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needed to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
==='''Change in problem statement'''===&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality was needed to be removed.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98730</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98730"/>
		<updated>2015-11-07T04:53:13Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Change in problem statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needed to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
==='''Change in problem statement'''===&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98727</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98727"/>
		<updated>2015-11-07T04:52:15Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needed to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
==='''Change in problem statement'''===&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98721</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98721"/>
		<updated>2015-11-07T04:47:28Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Classes involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98720</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98720"/>
		<updated>2015-11-07T04:47:03Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring, we had to delete the code and hence no design pattern is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98719</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98719"/>
		<updated>2015-11-07T04:46:08Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
&lt;br /&gt;
The project involved refactoring code which was used for student selected reviewing. However since this feature was removed from Expertiza during the refactoring we had to delete the code and hence no design patterns is applicable.&lt;br /&gt;
&lt;br /&gt;
=='''Testing'''==&lt;br /&gt;
&lt;br /&gt;
Since we have deleted t&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98269</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98269"/>
		<updated>2015-11-06T08:20:23Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''Testing from UI'''==&lt;br /&gt;
&lt;br /&gt;
Creating an Assignment:&lt;br /&gt;
#Login using instructor.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;New Public Assignment&lt;br /&gt;
#	Add couple of topics to the assignments from the topics tab.&lt;br /&gt;
#	Check “Allow reviewer to choose which topic to review” and “Enable authors to review others working on same topic” in the same tab.&lt;br /&gt;
#	Choose the review strategy as Auto-Selected in Review Strategy tab.&lt;br /&gt;
#	Choose appropriate deadlines in the due dates tab.&lt;br /&gt;
#	Go to Manage--&amp;gt;Assignments--&amp;gt;&amp;lt;Your Assignment Name&amp;gt; &lt;br /&gt;
#	Add participants to the assignment.&lt;br /&gt;
&lt;br /&gt;
Signing up and submitting the Assignment:&lt;br /&gt;
#	Login using participant1. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Sign up for a topic.&lt;br /&gt;
#	Submit your work before the deadline.&lt;br /&gt;
#	Repeat the same for all participants.&lt;br /&gt;
&lt;br /&gt;
Reviewing work of other Participants: &lt;br /&gt;
#	Login using participants. Select the Assignment from the list of assignments.&lt;br /&gt;
#	Click on Other’s Work. You will see a list of topics which are eligible for reviewing.&lt;br /&gt;
&lt;br /&gt;
Validation Criteria:&lt;br /&gt;
#	You should not be able to review your own submission&lt;br /&gt;
#	You can review other submissions of the topic if you have checked “Enable authors to review others working on the same topic” while creating the assignment.&lt;br /&gt;
#	You should not be able to review a submission which has already been reviewed by you.&lt;br /&gt;
#	You should not be able to review a submission which has reached maximum number of potential reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98050</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NFR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NFR&amp;diff=98050"/>
		<updated>2015-11-01T03:37:35Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: Created page with &amp;quot;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt; =='''Overview'''== &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=98049</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=98049"/>
		<updated>2015-11-01T03:36:27Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &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;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97994</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97994"/>
		<updated>2015-11-01T01:42:24Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Deletion of &amp;quot;student-selected&amp;quot; reviewing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, this is the only call being made to dynamic_review_assignment_helper.rb and this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence the two helper files have been deleted after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97986</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97986"/>
		<updated>2015-11-01T01:38:15Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Deletion of &amp;quot;student-selected&amp;quot; reviewing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
While making changes to the helper classes to remove student selected reviewing, a commit was made to the expertiza repository which deleted the page for student selected reviewing.&lt;br /&gt;
https://github.com/expertiza/expertiza/commit/b62182b4bb42f563ba3cee88917119be378db439&lt;br /&gt;
&lt;br /&gt;
In this page the method show_available_submissions() in review_mapping_controller.rb was being called. Since this was the only place the method was being called we decided to delete the below code snippet.&lt;br /&gt;
&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id ,&lt;br /&gt;
                                                                              reviewer.id,&lt;br /&gt;
                                                                              requested_topic_id ,&lt;br /&gt;
                                                                              Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On further understanding the code we noticed this was the only call being made to dynamic_review_assignment_helper.rb and that this helper is not used in instructor selected and auto selected reviewing strategies. For these strategies another view is being rendered specifically _set_dynamic_review.html.erb.&lt;br /&gt;
Similarly dynamic_quiz_assignment_helper.rb is also not being used by any controller.&lt;br /&gt;
Hence we decided to go ahead and delete these two files after confirmation from the developer.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97964</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97964"/>
		<updated>2015-11-01T01:22:15Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* What needs to be done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97962</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97962"/>
		<updated>2015-11-01T01:21:31Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* What needs to be done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
* Remove the code for “student-selected” reviewing&lt;br /&gt;
* The find_submissions_in_current_cycle method returns a list of participants. It should return a list of team.&lt;br /&gt;
* Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes&lt;br /&gt;
* The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97956</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97956"/>
		<updated>2015-11-01T01:12:18Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Deletion of &amp;quot;student-selected&amp;quot; reviewing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
*  The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams. Returning a list of participants leads to redundant entries in the hash, if they are done by multi-member teams. There used to be a need for dealing with participants rather than teams, but in the current Expertiza, submissions always belong to teams rather than individuals. (This may also require changing the call site for some calls to methods of this class.)&lt;br /&gt;
*  The comment at the beginning of the class lists a number of criteria that have to hold for a submission to be reviewable (e.g., it was not written by the potential reviewer, it has not already been reviewed by the potential reviewer).  It’s not clear where these conditions are checked for.  Probably the different conditions are checked for in different places.  Sometimes they are checked for late (e.g., if a user has written on Topic 2, (s)he is allowed to select Topic 2 as a topic to review, but after (s)he selects it, (s)he is told that there are no more submissions to review on that topic).  It would be better to check for all of these conditions in dynamic_review_assignment_helper; then the user would not even be able to select topics that have no available reviews.&lt;br /&gt;
*  There is code for “student-selected” reviewing. This would have allowed a student to choose a particular submission, not just a particular topic. This feature had never been used, and did not work correctly, so we removed it from the system. Thus, the code for student-selected reviewing should be removed.&lt;br /&gt;
*  The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic.The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97940</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97940"/>
		<updated>2015-11-01T01:00:10Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: /* Modification of find_submissions_in_current_cycle method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
*  The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams. Returning a list of participants leads to redundant entries in the hash, if they are done by multi-member teams. There used to be a need for dealing with participants rather than teams, but in the current Expertiza, submissions always belong to teams rather than individuals. (This may also require changing the call site for some calls to methods of this class.)&lt;br /&gt;
*  The comment at the beginning of the class lists a number of criteria that have to hold for a submission to be reviewable (e.g., it was not written by the potential reviewer, it has not already been reviewed by the potential reviewer).  It’s not clear where these conditions are checked for.  Probably the different conditions are checked for in different places.  Sometimes they are checked for late (e.g., if a user has written on Topic 2, (s)he is allowed to select Topic 2 as a topic to review, but after (s)he selects it, (s)he is told that there are no more submissions to review on that topic).  It would be better to check for all of these conditions in dynamic_review_assignment_helper; then the user would not even be able to select topics that have no available reviews.&lt;br /&gt;
*  There is code for “student-selected” reviewing. This would have allowed a student to choose a particular submission, not just a particular topic. This feature had never been used, and did not work correctly, so we removed it from the system. Thus, the code for student-selected reviewing should be removed.&lt;br /&gt;
*  The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply selects maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic. However, the reviewer could have got his own submission if it had been the one with least reviews. This was an undesirable aspect of student-selected reviewing.&lt;br /&gt;
The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97936</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97936"/>
		<updated>2015-11-01T00:55:56Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
*  The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams. Returning a list of participants leads to redundant entries in the hash, if they are done by multi-member teams. There used to be a need for dealing with participants rather than teams, but in the current Expertiza, submissions always belong to teams rather than individuals. (This may also require changing the call site for some calls to methods of this class.)&lt;br /&gt;
*  The comment at the beginning of the class lists a number of criteria that have to hold for a submission to be reviewable (e.g., it was not written by the potential reviewer, it has not already been reviewed by the potential reviewer).  It’s not clear where these conditions are checked for.  Probably the different conditions are checked for in different places.  Sometimes they are checked for late (e.g., if a user has written on Topic 2, (s)he is allowed to select Topic 2 as a topic to review, but after (s)he selects it, (s)he is told that there are no more submissions to review on that topic).  It would be better to check for all of these conditions in dynamic_review_assignment_helper; then the user would not even be able to select topics that have no available reviews.&lt;br /&gt;
*  There is code for “student-selected” reviewing. This would have allowed a student to choose a particular submission, not just a particular topic. This feature had never been used, and did not work correctly, so we removed it from the system. Thus, the code for student-selected reviewing should be removed.&lt;br /&gt;
*  The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to participants rather than teams, however currently there is no need for this since if an instructor wants individual assignments he/she simply select maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which are present in the model for AssignmentParticipant. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic. However, the reviewer could have got his own submission if it had been the one with least reviews. This was an undesirable aspect of student-selected reviewing.&lt;br /&gt;
The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97884</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97884"/>
		<updated>2015-11-01T00:22:05Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
*  The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams. Returning a list of participants leads to redundant entries in the hash, if they are done by multi-member teams. There used to be a need for dealing with participants rather than teams, but in the current Expertiza, submissions always belong to teams rather than individuals. (This may also require changing the call site for some calls to methods of this class.)&lt;br /&gt;
*  The comment at the beginning of the class lists a number of criteria that have to hold for a submission to be reviewable (e.g., it was not written by the potential reviewer, it has not already been reviewed by the potential reviewer).  It’s not clear where these conditions are checked for.  Probably the different conditions are checked for in different places.  Sometimes they are checked for late (e.g., if a user has written on Topic 2, (s)he is allowed to select Topic 2 as a topic to review, but after (s)he selects it, (s)he is told that there are no more submissions to review on that topic).  It would be better to check for all of these conditions in dynamic_review_assignment_helper; then the user would not even be able to select topics that have no available reviews.&lt;br /&gt;
*  There is code for “student-selected” reviewing. This would have allowed a student to choose a particular submission, not just a particular topic. This feature had never been used, and did not work correctly, so we removed it from the system. Thus, the code for student-selected reviewing should be removed.&lt;br /&gt;
*  The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to Participants rather than teams, however currently there is no need for this since if want an individual project we simply select maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which present in the model for AssignmentTeam. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic. However, the reviewer could have got his own submission if it had been the one with least reviews. This was an undesirable aspect of student-selected reviewing.&lt;br /&gt;
The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97880</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97880"/>
		<updated>2015-11-01T00:18:01Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
*  The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams. Returning a list of participants leads to redundant entries in the hash, if any are done by multi-member teams. There used to be a need for dealing with participants rather than teams, but in the current Expertiza, submissions always belong to teams rather than individuals. (This may also require changing the call site for some calls to methods of this class.)&lt;br /&gt;
*  The comment at the beginning of the class lists a number of criteria that have to hold for a submission to be reviewable (e.g., it was not written by the potential reviewer, it has not already been reviewed by the potential reviewer).  It’s not clear where these conditions are checked for.  Probably the different conditions are checked for in different places.  Sometimes they are checked for late (e.g., if a user has written on Topic 2, (s)he is allowed to select Topic 2 as a topic to review, but after (s)he selects it, (s)he is told that there are no more submissions to review on that topic).  It would be better to check for all of these conditions in dynamic_review_assignment_helper; then the user would not even be able to select topics that have no available reviews.&lt;br /&gt;
*  There is code for “student-selected” reviewing. This would have allowed a student to choose a particular submission, not just a particular topic. This feature had never been used, and did not work correctly, so we removed it from the system. Thus, the code for student-selected reviewing should be removed.&lt;br /&gt;
*  The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to Participants rather than teams, however currently there is no need for this since if want an individual project we simply select maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which present in the model for AssignmentTeam. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic. However, the reviewer could have got his own submission if it had been the one with least reviews. This was an undesirable aspect of student-selected reviewing.&lt;br /&gt;
The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97876</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97876"/>
		<updated>2015-11-01T00:15:09Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;b&amp;gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure&lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring: Improving the Design of Existing Code&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - &lt;br /&gt;
by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Robert&lt;br /&gt;
[https://books.google.com/books/about/Refactoring.html?id=HmrDHwgkbPsC&amp;amp;printsec=frontcover&amp;amp;source=kp_read_button#v=onepage&amp;amp;q&amp;amp;f=false]&amp;lt;/ref&amp;gt;. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.&lt;br /&gt;
There are many benefits of refactoring as follows: &lt;br /&gt;
&amp;lt;ref&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Refactoring Software using Design Patterns&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt; - by Masatomo Noborikawa&lt;br /&gt;
[http://www.cs.uni.edu/~wallingf/miscellaneous/student-papers/noborikawa-paper.pdf]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactoring improves the design of software. Refactoring often cleans up codes by deleting duplicates, divides a big chunk of codes into several methods, and makes the program more understandable.&lt;br /&gt;
* Because refactoring makes a design cleaner, it helps the programmers understand codes better and see things that may have not been seen before.&lt;br /&gt;
* Refactoring helps spot bugs since it makes the software more comprehensible.&lt;br /&gt;
* Refactoring turns an adverse design into a good design, which allows for rapid software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Peer Reviewing'''==&lt;br /&gt;
It is the process of evaluating work done by an individual or a team by another team or an individual with expertise in the concerned area. &lt;br /&gt;
Types of Reviewing Strategies in Expertiza -&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Instructor Selected Reviewing&amp;lt;/b&amp;gt; - Using this strategy the instructor assigns reviews to all participants of the assignment. After selecting this strategy the instructor has the following two options - &lt;br /&gt;
**  Set number of reviews done by each student.&lt;br /&gt;
**  Set minimum number of reviews done for each submission.&lt;br /&gt;
Then the instructor can click on assign reviewers and map the students to the topics which should be reviewed by them.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment.png‎  |frame|center|Instructor selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Auto Selected Reviewing&amp;lt;/b&amp;gt; - If the instructor selects this strategy, students need to select reviews themselves. Either the student is given a list of topics to choose from and he selects which topic he wants to review, or he checks “I don’t care which topic I review” and he/she will be randomly assigned a topic to review. The instructor can also specify two parameters after selecting this strategy - &lt;br /&gt;
**  Review topic threshold: - Let us assume Topic 1 has a submission than has not been reviewed. Topic 2 has submissions that has been reviewed atleast 2 times and k is set 2. Then the student will not be able to select topic 2 until all of topic 1’s submission has been reviewed atleast 2 times. &lt;br /&gt;
**  Maximum number of reviews per submission: - This specifies the maximum number of times a particular top can be reviewed.&lt;br /&gt;
&lt;br /&gt;
[[File:editing_assignment_2.png‎  |frame|center|Auto selected Reviewing]]&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;Student Selected Reviewing&amp;lt;/b&amp;gt; - &lt;br /&gt;
In this strategy the student selects a particular submission to review instead of a particular topic. This feature had never been used and did not work correctly. Hence it has been removed from the system. However there are a lot of places where the code for student selected reviewing exists however it not being called anywhere.&lt;br /&gt;
&lt;br /&gt;
=='''Project Resources'''==&lt;br /&gt;
* [https://github.com/rahuja910/expertiza GitHub Repository]&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/602 GitHub Pull Request Link]&lt;br /&gt;
* [http://152.46.20.183:3000/ VCL Deployment Link] &amp;lt;b&amp;gt;(For Instructor - username: instructor6, password: password. For student - username: student5700, password: password)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Problem Statement'''==&lt;br /&gt;
==='''Classes involved'''===&lt;br /&gt;
 dynamic_quiz_assignment_helper.rb&lt;br /&gt;
 dynamic_review_assignment_helper.rb&lt;br /&gt;
 review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==='''What it does'''&amp;lt;br&amp;gt;===&lt;br /&gt;
dynamic_review_assignment_helper.rb allows the system choose a team to review when a student chooses a topic to review.  It helps the code choose topics that have submissions with fewer reviews than other topics.  A threshold k is used to decide whether a particular topic can be chosen.  If, e.g., Topic 1 has a submission that has not yet been reviewed, and Topic 2 has no submission that has been reviewed by fewer than 3 reviewers, then the incoming reviewer can only choose Topic 2 if the k ≥ 3.  This class does not actually decide what is reviewable, but it does make up a sorted list of the submissions by the number of the reviews they have.  dynamic_quiz_assignment_helper.rb is similar, but for quizzes.&lt;br /&gt;
&lt;br /&gt;
==='''What needs to be done'''===&lt;br /&gt;
*  The find_submissions_in_current_cycle method returns a list of participants. It should return a list of teams. Returning a list of participants leads to redundant entries in the hash, if any are done by multi-member teams. There used to be a need for dealing with participants rather than teams, but in the current Expertiza, submissions always belong to teams rather than individuals. (This may also require changing the call site for some calls to methods of this class.)&lt;br /&gt;
*  The comment at the beginning of the class lists a number of criteria that have to hold for a submission to be reviewable (e.g., it was not written by the potential reviewer, it has not already been reviewed by the potential reviewer).  It’s not clear where these conditions are checked for.  Probably the different conditions are checked for in different places.  Sometimes they are checked for late (e.g., if a user has written on Topic 2, (s)he is allowed to select Topic 2 as a topic to review, but after (s)he selects it, (s)he is told that there are no more submissions to review on that topic).  It would be better to check for all of these conditions in dynamic_review_assignment_helper; then the user would not even be able to select topics that have no available reviews.&lt;br /&gt;
*  There is code for “student-selected” reviewing. This would have allowed a student to choose a particular submission, not just a particular topic. This feature had never been used, and did not work correctly, so we removed it from the system. Thus, the code for student-selected reviewing should be removed.&lt;br /&gt;
*  The two classes have a lot of duplicated code.  Remove all DRY problems.&lt;br /&gt;
&lt;br /&gt;
=='''Modification of &amp;lt;i&amp;gt;find_submissions_in_current_cycle&amp;lt;/i&amp;gt; method'''==&lt;br /&gt;
&lt;br /&gt;
This function returns a list of participants for the particular assignment. This leads to redundant entries in the hash since most teams are made up of more than one member. Earlier the submissions belonged to Participants rather than teams, however currently there is no need for this since if want an individual project we simply select maximum number of size of a team as one. Correspondingly changes need to be made to the call sites.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Before Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
      submissions_in_current_cycle = AssignmentParticipant.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        users = TeamsUser.where(team_id: signUp.team_id)&lt;br /&gt;
        users.each do |user|&lt;br /&gt;
          participant = Participant.where(user_id: user_id, parent_id: @assignment_id)&lt;br /&gt;
          if participant&lt;br /&gt;
            submissions_in_current_cycle &amp;lt;&amp;lt; participant&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;After Code Snippet -&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.find_submissions_in_current_cycle()&lt;br /&gt;
&lt;br /&gt;
    if @topic_id.blank?&lt;br /&gt;
    submissions_in_current_cycle = AssignmentTeam.where(parent_id: @assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
      #using topic_id to find participant.id(s).&lt;br /&gt;
      signUps = SignedUpTeam.where(topic_id: @topic_id)&lt;br /&gt;
      signUps.each do |signUp|&lt;br /&gt;
        team=Team.where(team_id: signUp.team_id)&lt;br /&gt;
        if team&lt;br /&gt;
          submissions_in_current_cycle &amp;lt;&amp;lt; team&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    submissions_in_current_cycle = submissions_in_current_cycle.reject { |submission| !submission.has_submissions? }&lt;br /&gt;
&lt;br /&gt;
    #  Create a new Hash to store the number of reviews that have already been done (or are in progress) for&lt;br /&gt;
    #  each submission.&lt;br /&gt;
    @submission_review_count = Hash.new&lt;br /&gt;
    submissions_in_current_cycle.each do |submission|&lt;br /&gt;
      # Each 'ResponseMap' entry indicates a review has been performed or is in progress.&lt;br /&gt;
      existing_maps = ResponseMap.where(reviewee_id:  submission.id, reviewed_object_id: @assignment_id )&lt;br /&gt;
      if existing_maps.nil?&lt;br /&gt;
        @submission_review_count[submission.id] = 0 # There are no reviews in progress (potential or completed).&lt;br /&gt;
      else&lt;br /&gt;
        @submission_review_count[submission.id] = existing_maps.size&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Sort and return the list of submissions by the number of reviews that they have.&lt;br /&gt;
    sorted_review_count =  @submission_review_count.sort {|a, b| a[1]&amp;lt;=&amp;gt;b[1]}&lt;br /&gt;
    return sorted_review_count&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As seen from the above code we have replaced AssignmentParticipant with AssignmentTeam. Now &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; will contain list of participants rather than a list of teams. Also note the model for AssignmentTeam contains the same methods which present in the model for AssignmentTeam. In the same helper class we had to modify code to handle the aspect that &amp;lt;i&amp;gt;submissions_in_current_cycle&amp;lt;/i&amp;gt; now contains teams rather than participants. Hence we made changes in &amp;lt;i&amp;gt;build_submissions_availability().&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation of Criteria'''==&lt;br /&gt;
'''Making sure all the conditions mentioned at the beginning of the class are implemented in both the helper classes.'''&amp;lt;br&amp;gt;&lt;br /&gt;
The helper classes while returning a list of teams should check the below set of conditions. Each of the below conditions need to be checked at one place to ensure better code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not written by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review its own submission and hence a check for this condition is required. However, it was already implemented in the code beforehand.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article was not already reviewed by the potential reviewer.&amp;lt;/b&amp;gt;&lt;br /&gt;
The potential reviewer should not be able to review a topic which is already reviewed by him/her. The same was also implemented along with the above condition.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article is not on the same topic as the potential reviewer has previously written about.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should not be able to review on the same topic that he/she submitted as the reviewer could give biased reviews to make his/her own submission seem better. This was not implemented previously and was implemented in the code changes by checking the topic id.&lt;br /&gt;
&lt;br /&gt;
'''Implementation :'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.build_submissions_availability()&lt;br /&gt;
    least_review_count = -1;&lt;br /&gt;
    max_no_reviews = 5&lt;br /&gt;
    reviewer_teams=TeamsUser.where(user_id: @reviewer_id)&lt;br /&gt;
&lt;br /&gt;
    @submissions_availability = Hash.new&lt;br /&gt;
    unless @submissions_in_current_cycle.nil?&lt;br /&gt;
      @submissions_in_current_cycle.each { |submission|&lt;br /&gt;
        team_check=false&lt;br /&gt;
        if( least_review_count == -1)&lt;br /&gt;
          least_review_count = submission[1]&lt;br /&gt;
        end&lt;br /&gt;
        reviewer_teams.each do |reviewer_team|&lt;br /&gt;
          if submission[0] == reviewer_team.team_id&lt;br /&gt;
            team_check=true&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if !team_check&lt;br /&gt;
          @submissions_availability[submission[0]] = get_state(least_review_count,submission[1],max_no_reviews)&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
    end&lt;br /&gt;
    return @submissions_availability&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article does not already have the maximum number of potential reviews in progress.&amp;lt;/b&amp;gt;&lt;br /&gt;
The reviewer should only be able to review topics that have not reached the maximum number of reviews. The check for the same is done in get_state method where the current_review_count is compared with max_review_count and make it unavailable.&lt;br /&gt;
&lt;br /&gt;
*  &amp;lt;b&amp;gt;The article has the minimum number of reviews for that assignment.&amp;lt;/b&amp;gt;&lt;br /&gt;
The article is made available if it has the minimum number of reviews for the assignment and the same is checked in get_state method where the current_review_count is compared with least_review_count and make it available.     &lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.get_state(least_review_count,current_review_count,max_review_count)&lt;br /&gt;
    if(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == max_review_count)&lt;br /&gt;
      return -1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count &amp;gt; least_review_count)&lt;br /&gt;
      return 1&lt;br /&gt;
    elsif(current_review_count != -1 &amp;amp;&amp;amp; current_review_count == least_review_count)&lt;br /&gt;
      return 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Deletion of &amp;quot;student-selected&amp;quot; reviewing'''==&lt;br /&gt;
The following files had code for “student-selected” reviewing – &lt;br /&gt;
&lt;br /&gt;
*  dynamic_quiz_assignment_helper.rb&lt;br /&gt;
*  dynamic_review_assignment_helper.rb&lt;br /&gt;
*  review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
In student-selected reviewing, a student was allowed to review a particular submission and not just a particular topic. However, the reviewer could have got his own submission if it had been the one with least reviews. This was an undesirable aspect of student-selected reviewing.&lt;br /&gt;
The functionality for “student-selected” reviewing was never implemented successfully. Hence, the methods corresponding to the aforementioned functionality were removed from respective files.&lt;br /&gt;
&lt;br /&gt;
Changes were made at the following places -&amp;lt;br&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_quiz_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicQuizAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.quiz_assignment(assignment_id, reviewer_id, questionnaire_id, quiz_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @questionnaire_id = questionnaire_id&lt;br /&gt;
&lt;br /&gt;
    if (quiz_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      @questionnaires = Array.new&lt;br /&gt;
      @questionnaires &amp;lt;&amp;lt; Questionnaire.find(@questionnaire_id)#student_selected_quiz_assignment( )&lt;br /&gt;
      return @questionnaires&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;dynamic_review_assignment_helper.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# TODO: Remove this helper, this code is not well-designed.&lt;br /&gt;
# Look at Assignment.contributor_to_review() as an example of a better approach&lt;br /&gt;
module DynamicReviewAssignmentHelper&lt;br /&gt;
&lt;br /&gt;
  #  * The article was not written by the potential reviewer.&lt;br /&gt;
  #  * The article was not already reviewed by the potential reviewer.&lt;br /&gt;
  #  * The article is not on the same topic as the potential reviewer has previously written about.&lt;br /&gt;
  #  * The article does not already have the maximum number of potential reviews in progress.&lt;br /&gt;
  #  * The article has the minimum number of reviews for that assignment.&lt;br /&gt;
&lt;br /&gt;
  def self.review_assignment(assignment_id, reviewer_id, topic_id, review_type )&lt;br /&gt;
    @assignment_id = assignment_id&lt;br /&gt;
    @current_assignment = Assignment.find(assignment_id)&lt;br /&gt;
    @reviewer_id = reviewer_id&lt;br /&gt;
    @topic_id = topic_id&lt;br /&gt;
&lt;br /&gt;
    if (review_type == Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
      return student_selected_review_assignment( )&lt;br /&gt;
    else&lt;br /&gt;
      return nil&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;review_mapping_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Get all the available submissions&lt;br /&gt;
  def show_available_submissions&lt;br /&gt;
    assignment = Assignment.find(params[:assignment_id])&lt;br /&gt;
    reviewer   = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id:  assignment.id).first&lt;br /&gt;
    requested_topic_id = params[:topic_id]&lt;br /&gt;
    @available_submissions =  Hash.new&lt;br /&gt;
    @available_submissions = DynamicReviewAssignmentHelper::review_assignment(assignment.id, reviewer.id, requested_topic_id, Assignment::RS_STUDENT_SELECTED)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97515</id>
		<title>CSC/ECE 517 Fall 2015/oss E1552 NRR</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1552_NRR&amp;diff=97515"/>
		<updated>2015-10-31T15:56:57Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: Created page with &amp;quot;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1552 Refactoring dynamic_review_assignment_helper.rb and dynamic_quiz_assignment_helper.rb'''&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97293</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=97293"/>
		<updated>2015-10-30T03:22:18Z</updated>

		<summary type="html">&lt;p&gt;Rahuja: &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;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 E1555 GMR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1552 NRR]]&lt;/div&gt;</summary>
		<author><name>Rahuja</name></author>
	</entry>
</feed>