<?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=Bradhak</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=Bradhak"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Bradhak"/>
	<updated>2026-06-04T08:15:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=99287</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=99287"/>
		<updated>2015-11-10T01:57:38Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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. GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2. GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GradesController ===&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
=== GradesHelper ===&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&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&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;
&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>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Latest2.png&amp;diff=99283</id>
		<title>File:Latest2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Latest2.png&amp;diff=99283"/>
		<updated>2015-11-10T01:35:26Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Latest1.png&amp;diff=99282</id>
		<title>File:Latest1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Latest1.png&amp;diff=99282"/>
		<updated>2015-11-10T01:35:12Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98751</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98751"/>
		<updated>2015-11-07T05:28:48Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98750</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98750"/>
		<updated>2015-11-07T05:26:50Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98749</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98749"/>
		<updated>2015-11-07T05:26:14Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
#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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98748</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98748"/>
		<updated>2015-11-07T05:24:14Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
#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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98747</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98747"/>
		<updated>2015-11-07T05:23:00Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
 #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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98746</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98746"/>
		<updated>2015-11-07T05:18:00Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
*WI2 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change1_new.png&amp;diff=98745</id>
		<title>File:Change1 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change1_new.png&amp;diff=98745"/>
		<updated>2015-11-07T05:16:02Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change2_new.png&amp;diff=98744</id>
		<title>File:Change2 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change2_new.png&amp;diff=98744"/>
		<updated>2015-11-07T05:15:49Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change3_new.png&amp;diff=98743</id>
		<title>File:Change3 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change3_new.png&amp;diff=98743"/>
		<updated>2015-11-07T05:15:39Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change4_new.png&amp;diff=98742</id>
		<title>File:Change4 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change4_new.png&amp;diff=98742"/>
		<updated>2015-11-07T05:15:26Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change5_new.png&amp;diff=98741</id>
		<title>File:Change5 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change5_new.png&amp;diff=98741"/>
		<updated>2015-11-07T05:15:15Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: uploaded a new version of &amp;amp;quot;File:Change5 new.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change5_new.png&amp;diff=98740</id>
		<title>File:Change5 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change5_new.png&amp;diff=98740"/>
		<updated>2015-11-07T05:09:48Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98739</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98739"/>
		<updated>2015-11-07T05:09:34Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98738</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98738"/>
		<updated>2015-11-07T05:07:38Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&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;
Before:&lt;br /&gt;
                                       &lt;br /&gt;
      if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
        unless penalties[:submission]&lt;br /&gt;
          penalties[:submission] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:review]&lt;br /&gt;
          penalties[:review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:meta_review]&lt;br /&gt;
          penalties[:meta_review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
     if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
         @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change6_new.png&amp;diff=98737</id>
		<title>File:Change6 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change6_new.png&amp;diff=98737"/>
		<updated>2015-11-07T05:03:40Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: uploaded a new version of &amp;amp;quot;File:Change6 new.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change6_new.png&amp;diff=98736</id>
		<title>File:Change6 new.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change6_new.png&amp;diff=98736"/>
		<updated>2015-11-07T05:03:28Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change6.png&amp;diff=98728</id>
		<title>File:Change6.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change6.png&amp;diff=98728"/>
		<updated>2015-11-07T04:52:29Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change5.png&amp;diff=98726</id>
		<title>File:Change5.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change5.png&amp;diff=98726"/>
		<updated>2015-11-07T04:52:13Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change4.png&amp;diff=98725</id>
		<title>File:Change4.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change4.png&amp;diff=98725"/>
		<updated>2015-11-07T04:52:00Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change3.png&amp;diff=98724</id>
		<title>File:Change3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change3.png&amp;diff=98724"/>
		<updated>2015-11-07T04:51:48Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change2.png&amp;diff=98723</id>
		<title>File:Change2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change2.png&amp;diff=98723"/>
		<updated>2015-11-07T04:51:36Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Change1.png&amp;diff=98722</id>
		<title>File:Change1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Change1.png&amp;diff=98722"/>
		<updated>2015-11-07T04:51:22Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98718</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98718"/>
		<updated>2015-11-07T04:41:07Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Solutions Implemented and Delivered */&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;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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.GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2.GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
== GradesHelper ==&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items&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.&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented and Delivered ==&lt;br /&gt;
&lt;br /&gt;
*WI1 : 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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
Before :&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .                 &lt;br /&gt;
        if calculate_for_participants == true&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .               &lt;br /&gt;
    if calculate_for_participants	&lt;br /&gt;
      calculate_penatly_attributes(@participant) #Refactored#Removed&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      assign_all_penalties(@participant)&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated      #Refactored#Removed&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New methods:&lt;br /&gt;
      def calculate_penatly_attributes(participant)&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
      end   &lt;br /&gt;
 &lt;br /&gt;
     def assign_all_penalties(participant)&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
                                       &lt;br /&gt;
      if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
        unless penalties[:submission]&lt;br /&gt;
          penalties[:submission] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:review]&lt;br /&gt;
          penalties[:review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:meta_review]&lt;br /&gt;
          penalties[:meta_review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
     if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
         @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )&lt;br /&gt;
&lt;br /&gt;
*WI2 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
There were no exiting test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method.&lt;br /&gt;
&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;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98714</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98714"/>
		<updated>2015-11-07T04:30:25Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* calculate_all_penalties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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:&lt;br /&gt;
1.GradesController&lt;br /&gt;
2.GradesHelper&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== calculate_all_penalties ===&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;
&lt;br /&gt;
2.The following 3 methods were created after splitting the first method&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&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;
&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;
&lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before :&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .                 &lt;br /&gt;
        if calculate_for_participants == true&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .               &lt;br /&gt;
    if calculate_for_participants	&lt;br /&gt;
      calculate_penatly_attributes(@participant) #Refactored#Removed&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      assign_all_penalties(@participant)&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated      #Refactored#Removed&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New methods:&lt;br /&gt;
      def calculate_penatly_attributes(participant)&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
      end   &lt;br /&gt;
 &lt;br /&gt;
     def assign_all_penalties(participant)&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
                                       &lt;br /&gt;
      if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
        unless penalties[:submission]&lt;br /&gt;
          penalties[:submission] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:review]&lt;br /&gt;
          penalties[:review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:meta_review]&lt;br /&gt;
          penalties[:meta_review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
     if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
         @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )&lt;br /&gt;
&lt;br /&gt;
=== conflict_notification ===&lt;br /&gt;
&lt;br /&gt;
This 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== edit ===&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98713</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=98713"/>
		<updated>2015-11-07T04:29:06Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* calculate_all_penalties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&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 NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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:&lt;br /&gt;
1.GradesController&lt;br /&gt;
2.GradesHelper&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== calculate_all_penalties ===&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
The following changes were made:&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&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&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;
&lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before :&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .                 &lt;br /&gt;
        if calculate_for_participants == true&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .               &lt;br /&gt;
    if calculate_for_participants	&lt;br /&gt;
      calculate_penatly_attributes(@participant) #Refactored#Removed&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      assign_all_penalties(@participant)&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated      #Refactored#Removed&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New methods:&lt;br /&gt;
      def calculate_penatly_attributes(participant)&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
      end   &lt;br /&gt;
 &lt;br /&gt;
     def assign_all_penalties(participant)&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
                                       &lt;br /&gt;
      if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
        unless penalties[:submission]&lt;br /&gt;
          penalties[:submission] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:review]&lt;br /&gt;
          penalties[:review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:meta_review]&lt;br /&gt;
          penalties[:meta_review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
     if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
         @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )&lt;br /&gt;
&lt;br /&gt;
=== conflict_notification ===&lt;br /&gt;
&lt;br /&gt;
This 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== edit ===&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=97805</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=97805"/>
		<updated>2015-10-31T23:04:33Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&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 NCSU. It’s an open source project developed on the Ruby on Rails platform and it’s code is available of Github. It allows students to review each other’s work and improve their work upon this feedback.&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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:&lt;br /&gt;
1.GradesController&lt;br /&gt;
2.GradesHelper&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== calculate_all_penalties ===&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
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;
This was split into the following three methods:&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&gt;
Changes were also made to make the code follow ruby style. Finally some redundant code was commented out as it was non-functional.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before :&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………                   &lt;br /&gt;
        if calculate_for_participants == true&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………                     &lt;br /&gt;
    if calculate_for_participants	&lt;br /&gt;
      calculate_penatly_attributes(@participant) #Refactored#Removed&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      assign_all_penalties(@participant)&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated      #Refactored#Removed&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      def calculate_penatly_attributes(participant)&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
      end   &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     def assign_all_penalties(participant)&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
                                       &lt;br /&gt;
      if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
        unless penalties[:submission]&lt;br /&gt;
          penalties[:submission] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:review]&lt;br /&gt;
          penalties[:review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:meta_review]&lt;br /&gt;
          penalties[:meta_review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
     if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
     ################################################################## &lt;br /&gt;
     #  unless penalties[:submission]&lt;br /&gt;
     #     penalties[:submission] = 0&lt;br /&gt;
     #   end&lt;br /&gt;
     #   unless penalties[:review]&lt;br /&gt;
     #     penalties[:review] = 0&lt;br /&gt;
     #   end&lt;br /&gt;
     #   unless penalties[:meta_review]&lt;br /&gt;
     #    penalties[:meta_review] = 0&lt;br /&gt;
     #  end&lt;br /&gt;
     ###################################################################&lt;br /&gt;
     @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #################################################################&lt;br /&gt;
    # if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
    ################################################################# &lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )     &lt;br /&gt;
                                  &lt;br /&gt;
&lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== conflict_notification ===&lt;br /&gt;
&lt;br /&gt;
This 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    if session[:user].role_id !=6&lt;br /&gt;
      @instructor = session[:user]&lt;br /&gt;
    else&lt;br /&gt;
      @instructor = Ta.get_my_instructor(session[:user].id)&lt;br /&gt;
    end&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    @caction = &amp;quot;view&amp;quot;&lt;br /&gt;
    @submission = params[:submission]&lt;br /&gt;
    if @submission == &amp;quot;review&amp;quot;&lt;br /&gt;
      @caction = &amp;quot;view_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;review&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.reviews, &amp;quot;ReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_of_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;metareview&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Metareview&amp;quot;, &amp;quot;Metareviewer&amp;quot;, @participant.metareviews, &amp;quot;MetareviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_feedback&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;feedback&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Feedback&amp;quot;, &amp;quot;Author&amp;quot;, @participant.feedback, &amp;quot;AuthorFeedbackQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;teammate_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;teammate&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Teammate Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.teammate_reviews, &amp;quot;TeammateReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    @subject = &amp;quot; Your &amp;quot;+@collabel.downcase+&amp;quot; score for &amp;quot; + @assignment.name + &amp;quot; conflicts with another &amp;quot;+@rowlabel.downcase+&amp;quot;'s score.&amp;quot;&lt;br /&gt;
    @body = get_body_text(params[:submission])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    if session[:user].role_id !=6&lt;br /&gt;
      @instructor = session[:user]&lt;br /&gt;
    else&lt;br /&gt;
      @instructor = Ta.get_my_instructor(session[:user].id)&lt;br /&gt;
    end&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #	@questions = Hash.new&lt;br /&gt;
    #    questionnaires = assignment.questionnaires&lt;br /&gt;
    #    questionnaires.each {&lt;br /&gt;
    #        |questionnaire|&lt;br /&gt;
    #      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    #    }&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    #################################################################################&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    @caction = &amp;quot;view&amp;quot;&lt;br /&gt;
    @submission = params[:submission]&lt;br /&gt;
    if @submission == &amp;quot;review&amp;quot;&lt;br /&gt;
      @caction = &amp;quot;view_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;review&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.reviews, &amp;quot;ReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_of_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;metareview&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Metareview&amp;quot;, &amp;quot;Metareviewer&amp;quot;, @participant.metareviews, &amp;quot;MetareviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_feedback&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;feedback&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Feedback&amp;quot;, &amp;quot;Author&amp;quot;, @participant.feedback, &amp;quot;AuthorFeedbackQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;teammate_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;teammate&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Teammate Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.teammate_reviews, &amp;quot;TeammateReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    @subject = &amp;quot; Your &amp;quot;+@collabel.downcase+&amp;quot; score for &amp;quot; + @assignment.name + &amp;quot; conflicts with another &amp;quot;+@rowlabel.downcase+&amp;quot;'s score.&amp;quot;&lt;br /&gt;
    @body = get_body_text(params[:submission])&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== edit ===&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #	@questions = Hash.new&lt;br /&gt;
    #    questionnaires = assignment.questionnaires&lt;br /&gt;
    #    questionnaires.each {&lt;br /&gt;
    #        |questionnaire|&lt;br /&gt;
    #      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    #    }&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    #################################################################################&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=97803</id>
		<title>CSC/ECE 517 Fall 2015/oss E1566 ARB</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1566_ARB&amp;diff=97803"/>
		<updated>2015-10-31T23:04:05Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: Created page with &amp;quot;== Expertiza ==  Expertiza  is an educational web application created and maintained by the joint efforts of the students and  the faculty at NCSU. It’s an open source project ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&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 NCSU. It’s an open source project developed on the Ruby on Rails platform and it’s code is available of Github. It allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&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 the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. 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:&lt;br /&gt;
1.GradesController&lt;br /&gt;
2.GradesHelper&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GradesController ==&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== calculate_all_penalties ===&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
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;
This was split into the following three methods:&lt;br /&gt;
i.	calculate_all_penalties&lt;br /&gt;
ii.	calculate_penatly_attributes&lt;br /&gt;
iii.	assign_all_penalties&lt;br /&gt;
Changes were also made to make the code follow ruby style. Finally some redundant code was commented out as it was non-functional.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before :&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………                   &lt;br /&gt;
        if calculate_for_participants == true&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def calculate_all_penalties(assignment_id)&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………&lt;br /&gt;
    ………………………………………………………………………………………………………………………………………………………………                     &lt;br /&gt;
    if calculate_for_participants	&lt;br /&gt;
      calculate_penatly_attributes(@participant) #Refactored#Removed&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      assign_all_penalties(@participant)&lt;br /&gt;
    end&lt;br /&gt;
    unless @assignment.is_penalty_calculated      #Refactored#Removed&lt;br /&gt;
      @assignment.update_attribute(:is_penalty_calculated, true)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      def calculate_penatly_attributes(participant)&lt;br /&gt;
          penalty_attr1 = {:deadline_type_id =&amp;gt; 1,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:submission]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr1)&lt;br /&gt;
          penalty_attr2 = {:deadline_type_id =&amp;gt; 2,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr2)&lt;br /&gt;
          penalty_attr3 = {:deadline_type_id =&amp;gt; 5,:participant_id =&amp;gt; @participant.id, :penalty_points =&amp;gt; penalties[:meta_review]}&lt;br /&gt;
          CalculatedPenalty.create(penalty_attr3)&lt;br /&gt;
      end   &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     def assign_all_penalties(participant)&lt;br /&gt;
      @all_penalties[participant.id] = {}&lt;br /&gt;
      @all_penalties[participant.id][:submission] = penalties[:submission]&lt;br /&gt;
      @all_penalties[participant.id][:review] = penalties[:review]&lt;br /&gt;
      @all_penalties[participant.id][:meta_review] = penalties[:meta_review]&lt;br /&gt;
      @all_penalties[participant.id][:total_penalty] = @total_penalty&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
                                       &lt;br /&gt;
      if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
        unless penalties[:submission]&lt;br /&gt;
          penalties[:submission] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:review]&lt;br /&gt;
          penalties[:review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        unless penalties[:meta_review]&lt;br /&gt;
          penalties[:meta_review] = 0&lt;br /&gt;
        end&lt;br /&gt;
        @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
     if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
     ################################################################## &lt;br /&gt;
     #  unless penalties[:submission]&lt;br /&gt;
     #     penalties[:submission] = 0&lt;br /&gt;
     #   end&lt;br /&gt;
     #   unless penalties[:review]&lt;br /&gt;
     #     penalties[:review] = 0&lt;br /&gt;
     #   end&lt;br /&gt;
     #   unless penalties[:meta_review]&lt;br /&gt;
     #    penalties[:meta_review] = 0&lt;br /&gt;
     #  end&lt;br /&gt;
     ###################################################################&lt;br /&gt;
     @total_penalty = (penalties[:submission] + penalties[:review] + penalties[:meta_review])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #################################################################&lt;br /&gt;
    # if(penalties[:submission] != 0 || penalties[:review] != 0 || penalties[:meta_review] != 0)&lt;br /&gt;
    ################################################################# &lt;br /&gt;
&lt;br /&gt;
    unless(penalties[:submission].zero? || penalties[:review].zero? || penalties[:meta_review].zero? )     &lt;br /&gt;
                                  &lt;br /&gt;
&lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== conflict_notification ===&lt;br /&gt;
&lt;br /&gt;
This 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;
Before:&lt;br /&gt;
&lt;br /&gt;
   def conflict_notification&lt;br /&gt;
    if session[:user].role_id !=6&lt;br /&gt;
      @instructor = session[:user]&lt;br /&gt;
    else&lt;br /&gt;
      @instructor = Ta.get_my_instructor(session[:user].id)&lt;br /&gt;
    end&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    @caction = &amp;quot;view&amp;quot;&lt;br /&gt;
    @submission = params[:submission]&lt;br /&gt;
    if @submission == &amp;quot;review&amp;quot;&lt;br /&gt;
      @caction = &amp;quot;view_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;review&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.reviews, &amp;quot;ReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_of_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;metareview&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Metareview&amp;quot;, &amp;quot;Metareviewer&amp;quot;, @participant.metareviews, &amp;quot;MetareviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_feedback&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;feedback&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Feedback&amp;quot;, &amp;quot;Author&amp;quot;, @participant.feedback, &amp;quot;AuthorFeedbackQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;teammate_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;teammate&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Teammate Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.teammate_reviews, &amp;quot;TeammateReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    @subject = &amp;quot; Your &amp;quot;+@collabel.downcase+&amp;quot; score for &amp;quot; + @assignment.name + &amp;quot; conflicts with another &amp;quot;+@rowlabel.downcase+&amp;quot;'s score.&amp;quot;&lt;br /&gt;
    @body = get_body_text(params[:submission])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
    def conflict_notification&lt;br /&gt;
    if session[:user].role_id !=6&lt;br /&gt;
      @instructor = session[:user]&lt;br /&gt;
    else&lt;br /&gt;
      @instructor = Ta.get_my_instructor(session[:user].id)&lt;br /&gt;
    end&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = Assignment.find(@participant.parent_id)&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #	@questions = Hash.new&lt;br /&gt;
    #    questionnaires = assignment.questionnaires&lt;br /&gt;
    #    questionnaires.each {&lt;br /&gt;
    #        |questionnaire|&lt;br /&gt;
    #      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    #    }&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    #################################################################################&lt;br /&gt;
    @reviewers_email_hash = Hash.new&lt;br /&gt;
    @caction = &amp;quot;view&amp;quot;&lt;br /&gt;
    @submission = params[:submission]&lt;br /&gt;
    if @submission == &amp;quot;review&amp;quot;&lt;br /&gt;
      @caction = &amp;quot;view_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;review&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.reviews, &amp;quot;ReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_of_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;metareview&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Metareview&amp;quot;, &amp;quot;Metareviewer&amp;quot;, @participant.metareviews, &amp;quot;MetareviewQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;review_feedback&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;feedback&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Feedback&amp;quot;, &amp;quot;Author&amp;quot;, @participant.feedback, &amp;quot;AuthorFeedbackQuestionnaire&amp;quot;)&lt;br /&gt;
    elsif @submission == &amp;quot;teammate_review&amp;quot;&lt;br /&gt;
      @symbol = &amp;quot;teammate&amp;quot;&lt;br /&gt;
      process_response(&amp;quot;Teammate Review&amp;quot;, &amp;quot;Reviewer&amp;quot;, @participant.teammate_reviews, &amp;quot;TeammateReviewQuestionnaire&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    @subject = &amp;quot; Your &amp;quot;+@collabel.downcase+&amp;quot; score for &amp;quot; + @assignment.name + &amp;quot; conflicts with another &amp;quot;+@rowlabel.downcase+&amp;quot;'s score.&amp;quot;&lt;br /&gt;
    @body = get_body_text(params[:submission])&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== edit ===&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;
Before:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
      |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
    def edit&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #	@questions = Hash.new&lt;br /&gt;
    #    questionnaires = assignment.questionnaires&lt;br /&gt;
    #    questionnaires.each {&lt;br /&gt;
    #        |questionnaire|&lt;br /&gt;
    #      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    #    }&lt;br /&gt;
    ##################################################################################&lt;br /&gt;
    #Refactored--&amp;gt; Replaced with a methood call&lt;br /&gt;
    list_questions (@assignment)&lt;br /&gt;
    #################################################################################&lt;br /&gt;
    @scores = @participant.scores(@questions)&lt;br /&gt;
  end&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;
  def list_questions (assignment)&lt;br /&gt;
    @questions = Hash.new&lt;br /&gt;
    questionnaires = assignment.questionnaires&lt;br /&gt;
    questionnaires.each {&lt;br /&gt;
        |questionnaire|&lt;br /&gt;
      @questions[questionnaire.symbol] = questionnaire.questions&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97768</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97768"/>
		<updated>2015-10-31T22:33:25Z</updated>

		<summary type="html">&lt;p&gt;Bradhak: /* Writing Assignment 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VGA]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/oss_E1573_sap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1559 rrz]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1570 avr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1556 CHM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1504 JJD]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1562 APS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1550 KMM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1551 RGS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1555 GMR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1552 NRR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1565 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1561 WZL]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1553 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1554 AAR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1569 JNR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1560 PSV]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1505 MSV]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1557 GXM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1566 ARB]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1567 APT]]&lt;/div&gt;</summary>
		<author><name>Bradhak</name></author>
	</entry>
</feed>