<?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=Svshingt</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=Svshingt"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Svshingt"/>
	<updated>2026-05-10T07:59:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021&amp;diff=137843</id>
		<title>CSC/ECE 517 Spring 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021&amp;diff=137843"/>
		<updated>2021-03-11T22:25:51Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: Created page with &amp;quot;== OSS Projects == * CSC/ECE 517 Spring 2021 - E2106. Fix view in student_task/list page&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2106. Fix view in student_task/list page]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=MainPage&amp;diff=137842</id>
		<title>MainPage</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=MainPage&amp;diff=137842"/>
		<updated>2021-03-11T22:24:37Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
* [[Expertiza documentation]]&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Summer 2008]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2010]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2011]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2012]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2013]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2014]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2015]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2016]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2014]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2015]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2016]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2017]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2017]]&lt;br /&gt;
* [[CSC/Independent Study Spring 2018]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2018]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2018]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2019]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2020]]&lt;br /&gt;
* [[CSC/ECE 517 Summer 2020]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021]]&lt;br /&gt;
* [[CSC 456 Spring 2011|CSC 456 Spring 2012]]&lt;br /&gt;
* [[ECE 633]]&lt;br /&gt;
* [[KCU]]&lt;br /&gt;
* [[Progress reports]]&lt;br /&gt;
* [[ReactJs Frontend]]&lt;br /&gt;
* [[Front-End/Back-End]]&lt;br /&gt;
&lt;br /&gt;
==Application Behavior==&lt;br /&gt;
* [[Grading]]&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming==&lt;br /&gt;
* [[CSC/ECE_517_Spring_2013/ch1b_1k_hf|Lecture on Metaprogramming]]&lt;br /&gt;
&lt;br /&gt;
==Development==&lt;br /&gt;
&lt;br /&gt;
''Expertiza now has a Java dependency, so the machine you are using to develop Expertiza on should have the JVM installed.''&lt;br /&gt;
&lt;br /&gt;
* [[Setting Up a Development Machine]]&lt;br /&gt;
* [[Creating a Linux Development Environment for Expertiza - Installation Guide]]&lt;br /&gt;
* [[Using git and github for projects]]&lt;br /&gt;
* [[Using heroku to deploy your projects]]&lt;br /&gt;
* [[How to Begin a Project from the Current Expertiza Repository]]&lt;br /&gt;
* [[Git]]&lt;br /&gt;
* [[How to Change a User's Password on a Development Machine]]&lt;br /&gt;
* [[Debugging Rails]]&lt;br /&gt;
* [http://rajanalwan.com/ui_guidelines/ Design Template]&lt;br /&gt;
&lt;br /&gt;
==Production==&lt;br /&gt;
* [[Deploying to Production]]&lt;br /&gt;
* [[Downloading Production Data]]&lt;br /&gt;
* [[Accessing the Production Server]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
* [[Using Cucumber with Expertiza]]&lt;br /&gt;
* [[Rails Testing Overview]]&lt;br /&gt;
* [[Expertiza Continuous Integration]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* [[Object-Oriented Design and Programming]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1991_Improvements_to_anonymized_view&amp;diff=137841</id>
		<title>CSC/ECE 517 Fall 2019 - E1991 Improvements to anonymized view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1991_Improvements_to_anonymized_view&amp;diff=137841"/>
		<updated>2021-03-07T22:07:20Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020&amp;diff=137710</id>
		<title>CSC/ECE 517 Fall 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020&amp;diff=137710"/>
		<updated>2020-11-20T15:13:06Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Writing Assignments ==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2070. Refactor response_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2068. Refactor quiz_questionnaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2062. Add test cases to review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2063. Refactor tree-display.js and tree_display_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2064. Refactor reputation_web_service_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2065. Fix view in student_task/list page]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2066. Refactor lottery controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2067. Refactor student_teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2073. Refactor course_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2057. Restrict TAs’ ability to change their own grade and limit file-size upload]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2052. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2052. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2056 Account_Request_Controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2059. Email notification to reviewers and instructors.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2058. Two issues related to assignment management]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2071. Improve assessment360_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2054. Auto generate submission directory names based on assignment names]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2060. Review report should link to the usual view for reviews]]&lt;br /&gt;
&lt;br /&gt;
== Final Project Design Documents == &lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2082. Track time between successive tag assignments]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2078. Improve self-review  Link peer review &amp;amp; self-review to derive grades]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2083. Revision_planning_tool_E2016]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2085. Allow reviewers to bid on what to review]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2086. Let course staff as well as students do reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - SQLFE. Refactor Submission.java]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2075. calibration submissions should be copied along with calibration assignments]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2076. Allow users to create an account and submit work to an &amp;quot;assignment&amp;quot; (e.g., for conference reviewing)]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2080. Track the time students look at other submissions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2081. Add a &amp;quot;cake&amp;quot; item type to rubrics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2079. Improve Search Facility In Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2087. Conflict notification. Improve Search Facility In Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020 - E2084 sort instructor reports by name ID score etc]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020&amp;diff=134451</id>
		<title>CSC/ECE 517 Fall 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020&amp;diff=134451"/>
		<updated>2020-09-30T19:29:40Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: Created page with &amp;quot;* Dummy URL&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Dummy URL]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=MainPage&amp;diff=134450</id>
		<title>MainPage</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=MainPage&amp;diff=134450"/>
		<updated>2020-09-30T19:28:30Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
* [[Expertiza documentation]]&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Summer 2008]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2010]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2011]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2012]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2013]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2014]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2015]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2016]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2014]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2015]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2016]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2017]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2017]]&lt;br /&gt;
* [[CSC/Independent Study Spring 2018]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2018]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2018]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2019]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2020]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2020]]&lt;br /&gt;
* [[CSC 456 Spring 2011|CSC 456 Spring 2012]]&lt;br /&gt;
* [[ECE 633]]&lt;br /&gt;
* [[KCU]]&lt;br /&gt;
* [[Progress reports]]&lt;br /&gt;
* [[ReactJs Frontend]]&lt;br /&gt;
* [[Front-End/Back-End]]&lt;br /&gt;
&lt;br /&gt;
==Application Behavior==&lt;br /&gt;
* [[Grading]]&lt;br /&gt;
&lt;br /&gt;
==Metaprogramming==&lt;br /&gt;
* [[CSC/ECE_517_Spring_2013/ch1b_1k_hf|Lecture on Metaprogramming]]&lt;br /&gt;
&lt;br /&gt;
==Development==&lt;br /&gt;
&lt;br /&gt;
''Expertiza now has a Java dependency, so the machine you are using to develop Expertiza on should have the JVM installed.''&lt;br /&gt;
&lt;br /&gt;
* [[Setting Up a Development Machine]]&lt;br /&gt;
* [[Creating a Linux Development Environment for Expertiza - Installation Guide]]&lt;br /&gt;
* [[Using git and github for projects]]&lt;br /&gt;
* [[Using heroku to deploy your projects]]&lt;br /&gt;
* [[How to Begin a Project from the Current Expertiza Repository]]&lt;br /&gt;
* [[Git]]&lt;br /&gt;
* [[How to Change a User's Password on a Development Machine]]&lt;br /&gt;
* [[Debugging Rails]]&lt;br /&gt;
* [http://rajanalwan.com/ui_guidelines/ Design Template]&lt;br /&gt;
&lt;br /&gt;
==Production==&lt;br /&gt;
* [[Deploying to Production]]&lt;br /&gt;
* [[Downloading Production Data]]&lt;br /&gt;
* [[Accessing the Production Server]]&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
* [[Using Cucumber with Expertiza]]&lt;br /&gt;
* [[Rails Testing Overview]]&lt;br /&gt;
* [[Expertiza Continuous Integration]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* [[Object-Oriented Design and Programming]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Due_dates&amp;diff=134444</id>
		<title>Due dates</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Due_dates&amp;diff=134444"/>
		<updated>2020-06-11T21:10:31Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Due Dates Variable Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Due Dates table gives information regarding the due dates associated to each of the assignment.&lt;br /&gt;
== Due Dates Variable Documentation ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Field Name !!Type !!Description &lt;br /&gt;
|- &lt;br /&gt;
!id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|Unique ID for each Due Date record&lt;br /&gt;
|- &lt;br /&gt;
!due_at   &lt;br /&gt;
|datetime  &lt;br /&gt;
|Deadline for submission&lt;br /&gt;
|- &lt;br /&gt;
!deadline_type_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|whether a submission deadline, a review deadline, etc.&lt;br /&gt;
|- &lt;br /&gt;
!parent_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|the assignment that the deadline is related to&lt;br /&gt;
|- &lt;br /&gt;
!submission_allowed_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|this is &amp;quot;OK&amp;quot;, &amp;quot;Late&amp;quot; or &amp;quot;No&amp;quot;, depending on whether submission is allowed before this due date&lt;br /&gt;
|- &lt;br /&gt;
!review_allowed_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|this is &amp;quot;No&amp;quot;, &amp;quot;Late&amp;quot; or &amp;quot;OK&amp;quot;, depending on whether reviewing is allowed before this due date&lt;br /&gt;
|- &lt;br /&gt;
!review_of_review_allowed_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|this is &amp;quot;OK&amp;quot;, &amp;quot;Late&amp;quot; or &amp;quot;No&amp;quot;, depending on whether meta-reviewing is allowed before this due date&lt;br /&gt;
|- &lt;br /&gt;
!round   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|Number of review rounds&lt;br /&gt;
|- &lt;br /&gt;
!flag   &lt;br /&gt;
|tinyint(1)  &lt;br /&gt;
|Not clear what this is.  It is zero in all due dates except some between 2010/11/15 and 2011/05/25.&lt;br /&gt;
|- &lt;br /&gt;
!threshold   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|How many hours before the due date a reminder is sent to participants&lt;br /&gt;
|- &lt;br /&gt;
!delayed_job_id&lt;br /&gt;
|int(11)  &lt;br /&gt;
|ID of the delayed job, presumably the job that sends reminders of this due date.&lt;br /&gt;
|- &lt;br /&gt;
!deadline_name   &lt;br /&gt;
|varchar(255)  &lt;br /&gt;
|Name of the deadline.  This is either NULL or the empty string in all deadlines.&lt;br /&gt;
|- &lt;br /&gt;
!description_url   &lt;br /&gt;
|varchar(255)  &lt;br /&gt;
|URL of the description&lt;br /&gt;
|- &lt;br /&gt;
!quiz_allowed_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|ID of the quiz associated to the Due Date.&lt;br /&gt;
|- &lt;br /&gt;
!teammate_review_allowed_id   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|The ID of the teammate whose review needs to be done.&lt;br /&gt;
|- &lt;br /&gt;
!type   &lt;br /&gt;
|int(11)  &lt;br /&gt;
|Type of the Due Date.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== E/R diagram for Parents Tables ==&lt;br /&gt;
Tables referred by the Due Date Table as Foreign Key Relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:due_dates_imported.png]]&lt;br /&gt;
&lt;br /&gt;
== E/R diagram for Child Tables ==&lt;br /&gt;
No Tables refer the Due Date Table as Foreign Key Relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Back to [http://wiki.expertiza.ncsu.edu/index.php/Documentation_on_Database_Tables Database Tables] Main page.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Assignment_questionnaires&amp;diff=134443</id>
		<title>Assignment questionnaires</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Assignment_questionnaires&amp;diff=134443"/>
		<updated>2020-05-27T18:21:21Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The assignment_questionnaires table defines the joins between a [[questionnaires|questionnaire]] and an [[assignments|assignment]]. It is also used to associate default limits for the notifications an instructor receives. &lt;br /&gt;
==Assignment Questionnaires variable documentation==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Field Name !!Type !!Description &lt;br /&gt;
|-&lt;br /&gt;
!id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The unique record id&lt;br /&gt;
|-&lt;br /&gt;
!assignment_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The ID of the [[assignments|assignment]] in this relationship. A null value is used to define the default limits&lt;br /&gt;
|-&lt;br /&gt;
!questionnaire_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The ID of the [[questionnaires|questionnaire]] in this relationship. A null value is used to define the default limits&lt;br /&gt;
|-&lt;br /&gt;
!user_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The ID of the [[users|instructor]] who created the relationship&lt;br /&gt;
|-&lt;br /&gt;
!notification_limit&lt;br /&gt;
|int(11)&lt;br /&gt;
|A percent difference between an awarded score and the current average score as an integer. This defines at which point the instructor receives a notification that a response falls outside the acceptable range&lt;br /&gt;
|-&lt;br /&gt;
!questionnaire_weight&lt;br /&gt;
|int(11)&lt;br /&gt;
|A percentage that the [[questionnaires|questionnaire]] contributes to the overall score. When both assignment_id and questionnaire_id are null, this relationship defines the defaults set by the instructor.&lt;br /&gt;
|-&lt;br /&gt;
!used_in_round&lt;br /&gt;
|int(11)&lt;br /&gt;
|Questionnaire used in which particular round.&lt;br /&gt;
|-&lt;br /&gt;
!dropdown&lt;br /&gt;
|tinyint(1)&lt;br /&gt;
|Indicating whether a dropdown is present or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== E/R diagram for Parent Tables ==&lt;br /&gt;
The table Assignment_questionnaire has not referred to any other table.&lt;br /&gt;
&lt;br /&gt;
== E/R diagram for Child Tables ==&lt;br /&gt;
Tables which refer the Assignment_questionnaires Table as Foreign Key Relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment_questionnaire_imported.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Back to the [[Documentation_on_Database_Tables|database documentation]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Response_maps&amp;diff=131390</id>
		<title>Response maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Response_maps&amp;diff=131390"/>
		<updated>2020-02-08T05:55:13Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Response maps variable documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Maps a connection between the [[participants]] as reviewers and [[participants]] or [[teams]] as reviewees&lt;br /&gt;
&lt;br /&gt;
==Response maps variable documentation==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Field Name !!Type !!Description &lt;br /&gt;
|-&lt;br /&gt;
!id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The unique record id&lt;br /&gt;
|- &lt;br /&gt;
!reviewed_object_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The object being reviewed in the [[responses|response]]. Possible objects include other ResponseMaps or [[assignments]]&lt;br /&gt;
|-&lt;br /&gt;
!reviewer_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The [[participants|participant]] (actually AssignmentParticipant) providing the response&lt;br /&gt;
|-&lt;br /&gt;
!reviewee_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The [[teams|team]] (AssignmentTeam) receiving the response&lt;br /&gt;
|-&lt;br /&gt;
!type&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|Used for subclassing the response map. Available subclasses are ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap  &lt;br /&gt;
|-&lt;br /&gt;
!created_at&lt;br /&gt;
|DATETIME&lt;br /&gt;
|Date and Time for when the record was created&lt;br /&gt;
|-&lt;br /&gt;
!updated_at&lt;br /&gt;
|DATETIME&lt;br /&gt;
|Date and Time when the last update was made&lt;br /&gt;
|-&lt;br /&gt;
!calibrate_to&lt;br /&gt;
|tinyint(1)&lt;br /&gt;
|Tells whether the record will be used for calibration or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Back to the [[Documentation_on_Database_Tables|database documentation]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Response_maps&amp;diff=131389</id>
		<title>Response maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Response_maps&amp;diff=131389"/>
		<updated>2020-02-08T05:50:02Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Response maps variable documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Maps a connection between the [[participants]] as reviewers and [[participants]] or [[teams]] as reviewees&lt;br /&gt;
&lt;br /&gt;
==Response maps variable documentation==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Field Name !!Type !!Description &lt;br /&gt;
|-&lt;br /&gt;
!id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The unique record id&lt;br /&gt;
|- &lt;br /&gt;
!reviewed_object_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The object being reviewed in the [[responses|response]]. Possible objects include other ResponseMaps or [[assignments]]&lt;br /&gt;
|-&lt;br /&gt;
!reviewer_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The [[participants|participant]] (actually AssignmentParticipant) providing the response&lt;br /&gt;
|-&lt;br /&gt;
!reviewee_id&lt;br /&gt;
|int(11)&lt;br /&gt;
|The [[teams|team]] (AssignmentTeam) receiving the response&lt;br /&gt;
|-&lt;br /&gt;
!type&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|Used for subclassing the response map. Available subclasses are ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap  &lt;br /&gt;
|-&lt;br /&gt;
!created_at&lt;br /&gt;
|DATETIME&lt;br /&gt;
|Date and Time for when the record was created&lt;br /&gt;
|-&lt;br /&gt;
!updated_at&lt;br /&gt;
|DATETIME&lt;br /&gt;
|Date and Time when the last update was made&lt;br /&gt;
|-&lt;br /&gt;
!calibrate_to&lt;br /&gt;
|BIT&lt;br /&gt;
|Tells whether the record will be used for calibration or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Back to the [[Documentation_on_Database_Tables|database documentation]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1998._Weights_in_grade_calculation&amp;diff=128833</id>
		<title>CSC/ECE 517 Fall 2019 - E1998. Weights in grade calculation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1998._Weights_in_grade_calculation&amp;diff=128833"/>
		<updated>2019-11-11T23:16:26Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page has been created to document the changes that will be made under &amp;lt;b&amp;gt;E1998 - Weights in grade calculation&amp;lt;/b&amp;gt; as a part of the final project for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== '''About Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project which can be used by instructors for a multitude of use cases such as creating assignments of various types, creating rubrics, questionnaires, allowing teams to be created (for group assignments) etc. It also allows grading of the assignments created, and provides the ability to let students peer review other students' work. Additionally, it also allows an instructor to export data for various objects created into multiple formats for further analysis.&lt;br /&gt;
&lt;br /&gt;
== '''Project Overview''' ==&lt;br /&gt;
&lt;br /&gt;
'''Background and Problem Statement'''&lt;br /&gt;
&lt;br /&gt;
The questionnaire/rubric creation feature of Expertiza also allows weights to be added to the questions being created, thereby allowing an instructor to create a questionnaire with relative ordering among the questions from a grading standpoint i.e., correctly answering a question with a higher weight will fetch more marks as compared to correctly answering a question with a lower weight. However, it has been observed that when grading is done for questionnaires, the module responsible for grading seems to ignore the weights associated with questions. &lt;br /&gt;
&lt;br /&gt;
'''Goal of the Project'''&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to understand the cause of the aforementioned issue, and to ensure that the weights associated with questions are taken into consideration when grading all types of questionnaires involving weights. &lt;br /&gt;
&lt;br /&gt;
== '''Current Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Proposed Solution''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Files which require modification (Tentative)''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
* There are many tests to check the functionalities which get involved in calculating grades using weights&lt;br /&gt;
* Currently all the test cases are passing because system considers weights as 1 to pass the validations&lt;br /&gt;
* For the future work, we will be writing a new method which will be calculating scores considering weights&lt;br /&gt;
* For the private methods, which will return the weighted scores for some particular types of questions, there is no need of tests&lt;br /&gt;
* But functions which will return the entire score of an assignment will require tests&lt;br /&gt;
&lt;br /&gt;
== '''Quick Links''' ==&lt;br /&gt;
&lt;br /&gt;
* Forked Repository Link: https://github.com/theSaurabhMhatre/expertiza&lt;br /&gt;
* Pull Request Link: To be created &lt;br /&gt;
* Demo Link: To be created&lt;br /&gt;
&lt;br /&gt;
== '''Team''' ==&lt;br /&gt;
&lt;br /&gt;
Our team:&lt;br /&gt;
&lt;br /&gt;
*Sanket Pai (sgpai2@ncsu.edu)&lt;br /&gt;
*Sanveg Rane (ssrane2@ncsu.edu)&lt;br /&gt;
*Saurabh Mhatre (smhatre@ncsu.edu)&lt;br /&gt;
*Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor: Carmen Bentley (cnaiken@ncsu.edu)&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=128660</id>
		<title>CSC/ECE 517 Fall 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=128660"/>
		<updated>2019-11-11T20:18:19Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz_questionnaire_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1965. Review report should link to the usual view for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1943. Refactor sign up sheet controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1972. OSS project J. Skellington: Accessing Assignment Rubrics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1961. Email notification to reviewers and instructors]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1971. OSS project Finklestein: Instructors &amp;amp; Institutions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1953. Tagging report for student]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1955.Write  unit tests for student_task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1954. Auto-generate submission directory names based on assignment names]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1958. Two issues related to assignment management]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1948. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1959. Intelligent copying of assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1968. Fixes for adding members to teams]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1969. Fixes for reviews not being available]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1951. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1957. Time travel Not Allowed..!!! Restrict TAs’ ability to change their own grade + limit file-size upload]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1963. Changing assignment participant role]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1941. Issues related to topic deadlines]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1966. Tabbed_reviews partial file refactor for displaying the alternate view of reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1962. Email notification upon account creation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1967. Fix glitches in author feedback]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1960. Create new late policy successfully and fixing &amp;quot;Back&amp;quot; link]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1950. Support Asynchronous Web Assembly Compilation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1985. Let course staff and students do reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1951. Implement missing OffscreenCanvas APIs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1940. Improving email notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1952. Missing DOM features project]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1945. Refactor users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1964. Export review scores for projects]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1949. Write Unit Tests for Importing assignment participants and import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1946. Refactor Questionnaire controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1982. Regulate changing of rubrics while projects are in progress]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1990. Integrate suggestion detection algorithm]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1993 Track Time Between Successive Tag Assignments]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1979. Completion/Progress view]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1980. Sort instructor reports by name, ID, score, etc.]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1984. Improve self-review  Link peer review &amp;amp; self-review to derive grades]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1994. Mentor management for assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1997. Issues related to meta-reviewing]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1981. Student-generated questions added to rubric]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1996. Enhancements to review grader]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1978. Fix issues related to deadlines and late policies]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1991. Improvements to anonymized view]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1998. Weights in grade calculation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 -E1974 Allow users to create an account and submit work to an ”assignment” Design]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 -E1988 Allow reviewer to say review can be shown to class as an example]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1975. Generalize Review Versioning]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=128099</id>
		<title>CSC/ECE 517 Fall 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=128099"/>
		<updated>2019-11-10T02:21:30Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz_questionnaire_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1965. Review report should link to the usual view for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1943. Refactor sign up sheet controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1972. OSS project J. Skellington: Accessing Assignment Rubrics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1961. Email notification to reviewers and instructors]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1971. OSS project Finklestein: Instructors &amp;amp; Institutions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1953. Tagging report for student]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1955.Write  unit tests for student_task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1954. Auto-generate submission directory names based on assignment names]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1958. Two issues related to assignment management]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1948. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1959. Intelligent copying of assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1968. Fixes for adding members to teams]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1969. Fixes for reviews not being available]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1951. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1957. Time travel Not Allowed..!!! Restrict TAs’ ability to change their own grade + limit file-size upload]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1963. Changing assignment participant role]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1941. Issues related to topic deadlines]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1966. Tabbed_reviews partial file refactor for displaying the alternate view of reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1962. Email notification upon account creation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1967. Fix glitches in author feedback]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1960. Create new late policy successfully and fixing &amp;quot;Back&amp;quot; link]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1950. Support Asynchronous Web Assembly Compilation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1951. Implement missing OffscreenCanvas APIs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1940. Improving email notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1952. Missing DOM features project]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1945. Refactor users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1964. Export review scores for projects]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1949. Write Unit Tests for Importing assignment participants and import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1946. Refactor Questionnaire controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1982. Regulate changing of rubrics while projects are in progress]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1990. Integrate suggestion detection algorithm]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1979. Completion/Progress view]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1995. Weights in grade calculation]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=127293</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=127293"/>
		<updated>2019-11-06T17:00:23Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of the changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing its observable behavior. This can be achieved through refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here and since it is intertwined with a lot of other parts in the code base, it is quite imperative that this code needs to be refactored.&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
'''assign_quiz_dynamically''' (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assign_quiz_dynamically_assign_quiz_index POST   /assign_quiz/assign_quiz_dynamically(.:format)  assign_quiz#assign_quiz_dynamically&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
==== Modified View Files: ====&lt;br /&gt;
app/views/student_quizzes/_set_dynamic_quiz.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
app/views/assignments/edit/_calibration.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126940</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126940"/>
		<updated>2019-11-03T02:03:32Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of the changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;[[File:2changes.JPG]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;[[File:2changed.JPG]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2changed.JPG&amp;diff=126939</id>
		<title>File:2changed.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2changed.JPG&amp;diff=126939"/>
		<updated>2019-11-03T02:03:18Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126938</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126938"/>
		<updated>2019-11-03T01:57:47Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of the changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;[[File:2changes.JPG]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126937</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126937"/>
		<updated>2019-11-03T01:50:54Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of the changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:2changes.JPG]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2changes.JPG&amp;diff=126936</id>
		<title>File:2changes.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2changes.JPG&amp;diff=126936"/>
		<updated>2019-11-03T01:49:37Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126934</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126934"/>
		<updated>2019-11-03T01:43:43Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of the changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:4bef.jpg&amp;diff=126931</id>
		<title>File:4bef.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:4bef.jpg&amp;diff=126931"/>
		<updated>2019-11-03T01:39:29Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:4aft.jpg&amp;diff=126930</id>
		<title>File:4aft.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:4aft.jpg&amp;diff=126930"/>
		<updated>2019-11-03T01:39:15Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: Latest&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Latest&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3bef.jpg&amp;diff=126929</id>
		<title>File:3bef.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3bef.jpg&amp;diff=126929"/>
		<updated>2019-11-03T01:38:54Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3aft.jpg&amp;diff=126928</id>
		<title>File:3aft.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3aft.jpg&amp;diff=126928"/>
		<updated>2019-11-03T01:38:38Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: Latest&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Latest&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126926</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126926"/>
		<updated>2019-11-03T01:20:57Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Files modified/created in the current project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126925</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126925"/>
		<updated>2019-11-03T01:15:45Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Files modified/created in the current project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126924</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126924"/>
		<updated>2019-11-03T01:09:18Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Files modified/created in the current project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the Review_Mapping_Controller.rb, there were some tests still present in the spec file of this controller. So, we removed such tests from the review_mapping_controller_spec.rb to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126923</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126923"/>
		<updated>2019-11-03T01:04:11Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Work-Plan Followed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FlowchartOODD.jpg&amp;diff=126922</id>
		<title>File:FlowchartOODD.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FlowchartOODD.jpg&amp;diff=126922"/>
		<updated>2019-11-03T00:56:19Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126921</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126921"/>
		<updated>2019-11-03T00:55:00Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here:&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:4_aft.jpg&amp;diff=126919</id>
		<title>File:4 aft.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:4_aft.jpg&amp;diff=126919"/>
		<updated>2019-11-03T00:48:31Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3_aft.jpg&amp;diff=126918</id>
		<title>File:3 aft.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3_aft.jpg&amp;diff=126918"/>
		<updated>2019-11-03T00:47:38Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126847</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126847"/>
		<updated>2019-11-02T01:39:51Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of the changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126693</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126693"/>
		<updated>2019-10-30T16:31:59Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing specified in wand did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:4_bef.PNG&amp;diff=126692</id>
		<title>File:4 bef.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:4_bef.PNG&amp;diff=126692"/>
		<updated>2019-10-30T16:07:14Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126689</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126689"/>
		<updated>2019-10-30T05:37:26Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing specified in wand did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126688</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126688"/>
		<updated>2019-10-30T04:12:24Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing specified in wand did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126687</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126687"/>
		<updated>2019-10-30T04:01:18Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: /* Details of changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing specified in wand did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=126600</id>
		<title>CSC/ECE 517 Fall 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019&amp;diff=126600"/>
		<updated>2019-10-29T04:11:40Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz_questionnaire_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - Project E1965. Review report should link to the usual view for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1972. OSS project J. Skellington: Accessing Assignment Rubrics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1961. Email notification to reviewers and instructors]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1971. OSS project Finklestein: Instructors &amp;amp; Institutions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1953. Tagging report for student]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1955.Write  unit tests for student_task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1954. Auto-generate submission directory names based on assignment names]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1958. Two issues related to assignment management]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1948. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1959. Intelligent copying of assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1968. Fixes for adding members to teams]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1969. Fixes for reviews not being available]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1951. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1957. Time travel Not Allowed..!!! Restrict TAs’ ability to change their own grade + limit file-size upload]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1963. Changing assignment participant role]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1941. Issues related to topic deadlines]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1966. Tabbed_reviews partial file refactor for displaying the alternate view of reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1962. Email notification upon account creation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1967. Fix glitches in author feedback]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1960. Create new late policy successfully and fixing &amp;quot;Back&amp;quot; link]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1950. Support Asynchronous Web Assembly Compilation]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1951. Implement missing OffscreenCanvas APIs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1940. Improving email notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1956. There is no shortcut to get free review points: Review Assignment Bug]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - M1952. Missing DOM features project]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1945. Refactor users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1964. Export review scores for projects]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1949. Write Unit Tests for Importing assignment participants and import glitches]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller]]&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126577</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126577"/>
		<updated>2019-10-29T03:58:51Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&amp;lt;br/&amp;gt;&lt;br /&gt;
WI6 : Change the repeated variable declaration and put into single common block.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI7 : Change ambiguous variable names to more sensible variable names&amp;lt;br/&amp;gt;&lt;br /&gt;
WI8 : Assign variables to hardcoded values&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' ‘@instructor = build(:instructor, id: 1)’ it was being called in first three test cases and in above loop too.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Changed params[:i_dont_care] to params[:no_particular_topic]&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Removed cascading effects of above change from features (CSS)&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params)&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126560</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126560"/>
		<updated>2019-10-29T03:52:58Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&amp;lt;br/&amp;gt;&lt;br /&gt;
WI6 : Change the repeated variable declaration and put into single common block.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI7 : Change ambiguous variable names to more sensible variable names&amp;lt;br/&amp;gt;&lt;br /&gt;
WI8 : Assign variables to hardcoded values&amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126552</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126552"/>
		<updated>2019-10-29T03:49:37Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&amp;lt;br/&amp;gt;&lt;br /&gt;
WI6 : Change the repeated variable declaration and put into single common block.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI7 : Change ambiguous variable names to more sensible variable names&amp;lt;br/&amp;gt;&lt;br /&gt;
WI8 : Assign variables to hardcoded values&amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126544</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126544"/>
		<updated>2019-10-29T03:48:05Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&amp;lt;br/&amp;gt;&lt;br /&gt;
WI6 : Change the repeated variable declaration and put into single common block.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI7 : Change ambiguous variable names to more sensible variable names&amp;lt;br/&amp;gt;&lt;br /&gt;
WI8 : Assign variables to hardcoded values.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126530</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126530"/>
		<updated>2019-10-29T03:44:33Z</updated>

		<summary type="html">&lt;p&gt;Svshingt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&amp;lt;br/&amp;gt;&lt;br /&gt;
WI6 : Change the repeated varaible decalreation and put into single common block.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI7 : Change ambiguous variable names in more sensible variable names&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
*Refactoring calculate_all_penalties method&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
&lt;br /&gt;
The following changes were made:&lt;br /&gt;
&lt;br /&gt;
1. This method was very complex, performing too many functions within a single method and had to be broken into 3 smaller methods each having a more well defined function.&lt;br /&gt;
2. The following 3 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
   i.  calculate_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
   ii. calculate_penatly_attributes&amp;lt;br&amp;gt;&lt;br /&gt;
   iii. assign_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
3. Changes were also made to make the code follow ruby style.The language was made more ruby friendly.&lt;br /&gt;
4. Finally some redundant code was commented out as it was non-functional.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
[[File:Change6_new.png]]&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
[[File:Change5_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Move the redundant piece of code from conflict_notification &amp;amp; edit methods to a new method list_questions &lt;br /&gt;
&lt;br /&gt;
The conflict_notification method is used to help the instructors decide if one of the reviews are unfair or inaccurate.&lt;br /&gt;
This was again split into 2 methods with some part of the code which is repeated in another method  refactored into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
  &lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
edit method:&lt;br /&gt;
&lt;br /&gt;
This method is used to edit the questionnaires. This method again has code which is repeated in the conflict_notification method and thus the repeated section was split into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change2_new.png]]&lt;br /&gt;
&lt;br /&gt;
New method:&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
&lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
Similar refactoring was performed to obtain the retrieve_questions method:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest1.png]]&lt;br /&gt;
&lt;br /&gt;
This is the new method created after the above refactoring:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest2.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
There were no existing test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method. The specs were run on the previous and current files and they return the same results implying that the refactored code does not break anything.&lt;br /&gt;
As the model was not changed, no test cases were added for the model.&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Following steps needs to be performed to test this code from UI:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Login as instructor. Create a course and an assignment under that course.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Keep the has team checkbox checked while creating the assignment. Add a grading rubric to it. Add at least two students as participants to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Create topics for the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Sign in as one of the students who were added to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Go to the assignment and sign up for a topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
6. Submit student's work by clicking 'Your work' under that assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
7. Sign in as a different student which is participant of the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
8. Go to Assignments--&amp;gt;&amp;lt;assignment name&amp;gt;--&amp;gt;Others' work (If the link is disabled, login as instructor and change the due date of the assignment to current time).&amp;lt;br/&amp;gt;&lt;br /&gt;
9. Give reviews on first student's work.&amp;lt;br/&amp;gt;&lt;br /&gt;
10. Login as instructor or first student to look at the review grades.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
1. The construct_table method in GradesHelper is not used anywhere. It has no reference in the project. So we feel it can be safely removed.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. The has_team_and_metareview? method in GradesHelper can be broken down into separate methods, one each for team and metareview. This will provide improved flexibility. It needs some analysis though, as both the entities(team &amp;amp; metareview) are currently checked in conjuction from all the views they are referenced from.&lt;/div&gt;</summary>
		<author><name>Svshingt</name></author>
	</entry>
</feed>