<?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=Bwanza</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=Bwanza"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Bwanza"/>
	<updated>2026-08-11T01:56:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138441</id>
		<title>CSC/ECE 517 Spring 2021 - E2115. Mentor management for assignments without topics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138441"/>
		<updated>2021-03-28T22:00:56Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Yi Qiu&lt;br /&gt;
* Ryan Smith&lt;br /&gt;
* Jose Molina Melendez&lt;br /&gt;
* Bahati Wanza&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Currently, Expertiza has no way to associate mentors with teams. For assignments with topics, like the OSS project, mentors are associated with topics, and then whichever team is assigned to the topic inherits the mentor for that topic However, for assignments without topics (like Program 2), there is no good way to “automatically” assign mentors to projects. The instructor needs to watch teams being formed, and every time a new team is formed, a new mentor needs to be assigned, outside of Expertiza. This leads to a lot of work for the instructor, as well as sometimes long delays before a team is assigned a mentor.&lt;br /&gt;
=== The Plan ===&lt;br /&gt;
For assignments without topics, mentors should be assigned to teams. Assume that&lt;br /&gt;
things happen in the following order:&lt;br /&gt;
* An assignment without topics is created that requires teams of size of up to k.&lt;br /&gt;
* Students sign up for teams.&lt;br /&gt;
* When a team reaches a target size of greater than 50% of the maximum teammate capacity, then:&lt;br /&gt;
** A mentor will be assigned to this team and notified via email.&lt;br /&gt;
** Participants in an assignment will be identified as mentors via their participant permissions ([https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1963._Changing_assignment_participant_role see the E1963 documentation]). This adds a fourth, “mentor” permission to the existing three permissions (“submit”, “review”, and “take quiz”). Anyone with “mentor” permission for an assignment is eligible to be automatically assigned to mentor a team when a new team is formed.&lt;br /&gt;
=== What needs to be done ===&lt;br /&gt;
Develop a trigger that:&lt;br /&gt;
* Is activated when any team has been formed that has k members, where k is greater than 50% of the maximum team capacity&lt;br /&gt;
** ex: max members = 4, trigger activated when the team size reaches 3&lt;br /&gt;
* Assign a mentor to the team&lt;br /&gt;
** Mentors should be evenly assigned to teams, so a good strategy is to assign the mentor who has the fewest teams to mentor so far.&lt;br /&gt;
* Notify the mentor via email that they are now assigned to a specific team, and provide the email addresses of the team members.&lt;br /&gt;
* Possibly notify the team members that they have been assigned the mentor with contact information (further discussion here).&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138440</id>
		<title>CSC/ECE 517 Spring 2021 - E2115. Mentor management for assignments without topics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138440"/>
		<updated>2021-03-28T21:54:29Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Yi Qiu&lt;br /&gt;
* Ryan Smith&lt;br /&gt;
* Jose Molina Melendez&lt;br /&gt;
* Bahati Wanza&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Currently, Expertiza has no way to associate mentors with teams. For assignments with topics, like the OSS project, mentors are associated with topics, and then whichever team is assigned to the topic inherits the mentor for that topic However, for assignments without topics (like Program 2), there is no good way to “automatically” assign mentors to projects. The instructor needs to watch teams being formed, and every time a new team is formed, a new mentor needs to be assigned, outside of Expertiza. This leads to a lot of work for the instructor, as well as sometimes long delays before a team is assigned a mentor.&lt;br /&gt;
=== The Plan ===&lt;br /&gt;
For assignments without topics, mentors should be assigned to teams. Assume that&lt;br /&gt;
things happen in the following order:&lt;br /&gt;
* An assignment without topics is created that requires teams of size of up to k.&lt;br /&gt;
* Students sign up for teams.&lt;br /&gt;
* When a team reaches a target size of greater than 50% of the maximum teammate capacity, then:&lt;br /&gt;
** A mentor will be assigned to this team and notified via email.&lt;br /&gt;
** Participants in an assignment will be identified as mentors via their participant permissions (see the E1963 documentation). This adds a fourth, “mentor” permission to the existing three permissions (“submit”, “review”, and “take quiz”). Anyone with “mentor” permission for an assignment is eligible to be automatically assigned to mentor a team when a new team is formed.&lt;br /&gt;
=== What needs to be done ===&lt;br /&gt;
Develop a trigger that:&lt;br /&gt;
* Is activated when any team has been formed that has k members, where k is greater than 50% of the maximum team capacity&lt;br /&gt;
** ex: max members = 4, trigger activated when the team size reaches 3&lt;br /&gt;
* Assign a mentor to the team&lt;br /&gt;
** Mentors should be evenly assigned to teams, so a good strategy is to assign the mentor who has the fewest teams to mentor so far.&lt;br /&gt;
* Notify the mentor via email that they are now assigned to a specific team, and provide the email addresses of the team members.&lt;br /&gt;
* Possibly notify the team members that they have been assigned the mentor with contact information (further discussion here).&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138439</id>
		<title>CSC/ECE 517 Spring 2021 - E2115. Mentor management for assignments without topics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138439"/>
		<updated>2021-03-28T21:51:35Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Yi Qiu&lt;br /&gt;
* Ryan Smith&lt;br /&gt;
* Jose Molina Melendez&lt;br /&gt;
* Bahati Wanza&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Currently, Expertiza has no way to associate mentors with teams. For assignments with topics, like the OSS project, mentors are associated with topics, and then whichever team is assigned to the topic inherits the mentor for that topic However, for assignments without topics (like Program 2), there is no good way to “automatically” assign mentors to projects. The instructor needs to watch teams being formed, and every time a new team is formed, a new mentor needs to be assigned, outside of Expertiza. This leads to a lot of work for the instructor, as well as sometimes long delays before a team is assigned a mentor.&lt;br /&gt;
=== The Plan ===&lt;br /&gt;
For assignments without topics, mentors should be assigned to teams. Assume that&lt;br /&gt;
things happen in the following order:&lt;br /&gt;
* An assignment without topics is created that requires teams of size of up to k.&lt;br /&gt;
* Students sign up for teams.&lt;br /&gt;
* When a team reaches a target size of greater than 50% of the maximum teammate capacity, then:&lt;br /&gt;
** A mentor will be assigned to this team and notified via email.&lt;br /&gt;
** Participants in an assignment will be identified as mentors via their participant permissions (see the E1963 documentation). This adds a fourth, “mentor” permission to the existing three permissions (“submit”, “review”, and “take quiz”). Anyone with “mentor” permission for an assignment is eligible to be automatically assigned to mentor a team when a new team is formed.&lt;br /&gt;
=== What needs to be done ===&lt;br /&gt;
* Develop a trigger that:&lt;br /&gt;
** Is activated when any team has been formed that has k members, where k is&lt;br /&gt;
greater than 50% of the maximum team capacity&lt;br /&gt;
*** ex: max members = 4, trigger activated when the team size reaches 3&lt;br /&gt;
** Assign a mentor to the team&lt;br /&gt;
*** Mentors should be evenly assigned to teams, so a good strategy is to&lt;br /&gt;
assign the mentor who has the fewest teams to mentor so far.&lt;br /&gt;
** Notify the mentor via email that they are now assigned to a specific team, and provide the email addresses of the team members.&lt;br /&gt;
** Possibly notify the team members that they have been assigned the mentor with contact information (further discussion here).&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138438</id>
		<title>CSC/ECE 517 Spring 2021 - E2115. Mentor management for assignments without topics</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics&amp;diff=138438"/>
		<updated>2021-03-28T21:44:44Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: Created page with &amp;quot;__TOC__ == ''' Introduction ''' == === Team Members === * Yi Qiu * Ryan Smith * Jose Molina Melendez * Bahati Wanza === Problem Statement === Currently, Expertiza has no way t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Yi Qiu&lt;br /&gt;
* Ryan Smith&lt;br /&gt;
* Jose Molina Melendez&lt;br /&gt;
* Bahati Wanza&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Currently, Expertiza has no way to associate mentors with teams. For assignments with topics, like the OSS project, mentors are associated with topics, and then whichever team is assigned to the topic inherits the mentor for that topic However, for assignments without topics (like Program 2), there is no good way to “automatically” assign mentors to projects. The instructor needs to watch teams being formed, and every time a new team is formed, a new mentor needs to be assigned, outside of Expertiza. This leads to a lot of work for the instructor, as well as sometimes long delays before a team is assigned a mentor.&lt;br /&gt;
=== The Plan ===&lt;br /&gt;
For assignments without topics, mentors should be assigned to teams. Assume that&lt;br /&gt;
things happen in the following order:&lt;br /&gt;
* An assignment without topics is created that requires teams of size of up to k.&lt;br /&gt;
* Students sign up for teams.&lt;br /&gt;
* When a team reaches a target size of greater than 50% of the maximum teammate capacity, then:&lt;br /&gt;
** A mentor will be assigned to this team and notified via email.&lt;br /&gt;
** Participants in an assignment will be identified as mentors via their participant permissions (see the E1963 documentation). This adds a fourth, “mentor” permission to the existing three permissions (“submit”, “review”, and “take quiz”). Anyone with “mentor” permission for an assignment is eligible to be automatically assigned to mentor a team when a new team is formed.&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021&amp;diff=138437</id>
		<title>CSC/ECE 517 Spring 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021&amp;diff=138437"/>
		<updated>2021-03-28T21:10:40Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2100. Tagging report for students]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2101. Refactor questionnaires controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2106. Fix view in student_task/list page]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2103. Refactor response_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2107. Refactor grades_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2102. Refactor quiz_questionnaires_controller.rb]]&lt;br /&gt;
* [[CSE/ECE 517 Spring 2021 - E2108. Impersonate_controller.rb]]&lt;br /&gt;
* [[CSE/ECE 517 Spring 2021 - E2105. Track the time students look at other submissions]]&lt;br /&gt;
* [[CSE/ECE 517 Spring 2021 - E2104.  Email notification to reviewers and instructors]]&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2110. Regulate changing of rubrics while projects are in progress]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2111. Refactor github metrics integration]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2115. Mentor management for assignments without topics]]&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138127</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138127"/>
		<updated>2021-03-19T23:39:21Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''Remove_negative_scores_and_build_charts'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''charts''.&lt;br /&gt;
&lt;br /&gt;
[[File: remove_negative_scores.PNG | 550px]]&lt;br /&gt;
[[File: remove_negative_scores_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Passed Test.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138125</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138125"/>
		<updated>2021-03-19T23:36:16Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''Remove_negative_scores_and_build_charts'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''charts''.&lt;br /&gt;
&lt;br /&gt;
[[File: remove_negative_scores.PNG | 550px]]&lt;br /&gt;
[[File: remove_negative_scores_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:Passed Test.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138124</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138124"/>
		<updated>2021-03-19T23:35:50Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''Remove_negative_scores_and_build_charts'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''charts''.&lt;br /&gt;
&lt;br /&gt;
[[File: remove_negative_scores.PNG | 550px]]&lt;br /&gt;
[[File: remove_negative_scores_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
[[File:Passed Test.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138122</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138122"/>
		<updated>2021-03-19T23:34:53Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''Remove_negative_scores_and_build_charts'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''charts''.&lt;br /&gt;
&lt;br /&gt;
[[File: remove_negative_scores.PNG | 550px]]&lt;br /&gt;
[[File: remove_negative_scores_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
[[File:Test Passed Test.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Passed_Test.PNG&amp;diff=138121</id>
		<title>File:Passed Test.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Passed_Test.PNG&amp;diff=138121"/>
		<updated>2021-03-19T23:34:02Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138120</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138120"/>
		<updated>2021-03-19T23:33:37Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''Remove_negative_scores_and_build_charts'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''charts''.&lt;br /&gt;
&lt;br /&gt;
[[File: remove_negative_scores.PNG | 550px]]&lt;br /&gt;
[[File: remove_negative_scores_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138119</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138119"/>
		<updated>2021-03-19T23:29:22Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''Remove_negative_scores_and_build_charts'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''charts''.&lt;br /&gt;
&lt;br /&gt;
[[File: remove_negative_scores.PNG | 550px]]&lt;br /&gt;
[[File: remove_negative_scores_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138118</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138118"/>
		<updated>2021-03-19T23:25:38Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''build_score_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''score_vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: build_score_vector.PNG | 550px]]&lt;br /&gt;
[[File: build_score_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138116</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138116"/>
		<updated>2021-03-19T23:11:40Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_average_vector'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''vector''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_average_vector.PNG | 550px]]&lt;br /&gt;
[[File: calculate_average_vector_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Remove_negative_scores_a.PNG&amp;diff=138115</id>
		<title>File:Remove negative scores a.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Remove_negative_scores_a.PNG&amp;diff=138115"/>
		<updated>2021-03-19T23:03:52Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Build_score_vector_a.PNG&amp;diff=138114</id>
		<title>File:Build score vector a.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Build_score_vector_a.PNG&amp;diff=138114"/>
		<updated>2021-03-19T23:02:12Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_average_vector_a.PNG&amp;diff=138112</id>
		<title>File:Calculate average vector a.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_average_vector_a.PNG&amp;diff=138112"/>
		<updated>2021-03-19T23:01:43Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138107</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138107"/>
		<updated>2021-03-19T22:53:31Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
[[File: mean_a.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mean_a.PNG&amp;diff=138106</id>
		<title>File:Mean a.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mean_a.PNG&amp;diff=138106"/>
		<updated>2021-03-19T22:52:37Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138104</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138104"/>
		<updated>2021-03-19T22:50:27Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside.&lt;br /&gt;
&lt;br /&gt;
[[File: mean.PNG | 550px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138103</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138103"/>
		<updated>2021-03-19T22:49:08Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''mean'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and refactored the code inside the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138045</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138045"/>
		<updated>2021-03-19T03:15:36Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|550px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|550px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138044</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138044"/>
		<updated>2021-03-19T03:14:57Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
[[File: calcuate_penalties_attributes_b.PNG|500px]]&lt;br /&gt;
[[File: calcuate_penalties_attributes_c.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calcuate_penalties_attributes_c.PNG&amp;diff=138042</id>
		<title>File:Calcuate penalties attributes c.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calcuate_penalties_attributes_c.PNG&amp;diff=138042"/>
		<updated>2021-03-19T03:13:26Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calcuate_penalties_attributes_b.PNG&amp;diff=138041</id>
		<title>File:Calcuate penalties attributes b.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calcuate_penalties_attributes_b.PNG&amp;diff=138041"/>
		<updated>2021-03-19T03:13:12Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138038</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138038"/>
		<updated>2021-03-19T03:11:27Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_penalty_attributes'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''attributes''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138034</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138034"/>
		<updated>2021-03-19T03:06:42Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_b.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalties_b.PNG&amp;diff=138033</id>
		<title>File:Calculate all penalties b.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalties_b.PNG&amp;diff=138033"/>
		<updated>2021-03-19T03:05:50Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalties_a.PNG&amp;diff=138031</id>
		<title>File:Calculate all penalties a.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalties_a.PNG&amp;diff=138031"/>
		<updated>2021-03-19T03:02:26Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: Bwanza uploaded a new version of File:Calculate all penalties a.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138030</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138030"/>
		<updated>2021-03-19T02:58:36Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG|500px]]&lt;br /&gt;
[[File: calculate_all_penalties_a.PNG|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalties_a.PNG&amp;diff=138027</id>
		<title>File:Calculate all penalties a.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalties_a.PNG&amp;diff=138027"/>
		<updated>2021-03-19T02:54:38Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138026</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=138026"/>
		<updated>2021-03-19T02:54:22Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;br /&gt;
* The previous programmer used update_attribute, which is concerning, as validations are ignored (Line 153 and 219). &lt;br /&gt;
=== Refactoring Grades Controller ===&lt;br /&gt;
*Comment changed that was wrong (&amp;quot;head&amp;quot; into &amp;quot;heat&amp;quot;)&lt;br /&gt;
[[File:Comment.PNG]]&lt;br /&gt;
*Line 102-107 (New Private Method made to encapsulate this)&lt;br /&gt;
[[File:102.PNG]] &lt;br /&gt;
&lt;br /&gt;
 The private method is called instead&lt;br /&gt;
&lt;br /&gt;
[[File:New102.PNG]]&lt;br /&gt;
&lt;br /&gt;
 Private method details&lt;br /&gt;
&lt;br /&gt;
[[File:populate view model.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 190-192&lt;br /&gt;
[[File:190.PNG]]&lt;br /&gt;
 Simplify Logic&lt;br /&gt;
[[File:Change190.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Line 300 &lt;br /&gt;
[[File:Line 300.PNG]] &lt;br /&gt;
&lt;br /&gt;
 Boolean expression clean up with variables &lt;br /&gt;
 and white spaces/return statement removed&lt;br /&gt;
&lt;br /&gt;
[[File: NewLine 300.PNG]]&lt;br /&gt;
&lt;br /&gt;
*Lines 153/219&lt;br /&gt;
 153 function removed&lt;br /&gt;
[[File: 153.PNG]]&lt;br /&gt;
[[File: New153.PNG]]&lt;br /&gt;
&lt;br /&gt;
 219 function removed&lt;br /&gt;
[[File: 219.PNG]]&lt;br /&gt;
[[File: New219.PNG]]&lt;br /&gt;
&lt;br /&gt;
  Moved the ''calculate_all_penalties'' function from ''grades_controller.rb'' to ''grades_helper.rb'' and renamed it ''penalties''.&lt;br /&gt;
&lt;br /&gt;
[[File: calculate_all_penaltyies.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Code ===&lt;br /&gt;
To test this controller, run the following command to verify the changes do not break any core functions. &lt;br /&gt;
 rspec spec/controllers/grades_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Test grades controller.PNG]]&lt;br /&gt;
&lt;br /&gt;
When you run the program and get to login page. Use credentials below for instructor.&lt;br /&gt;
 &lt;br /&gt;
 username: Instructor6&lt;br /&gt;
 password: password&lt;br /&gt;
&lt;br /&gt;
A good student to impersonate for testing is&lt;br /&gt;
 student7366&lt;br /&gt;
&lt;br /&gt;
Important views for using refactored functions&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_author_feedbacks.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_scores.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_teammate.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_review_table.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_metareviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_tabbed_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/view_team.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_heat_grid_tab.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/grades/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
 app/views/assignments/list_submissions.html.erb&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penaltyies.PNG&amp;diff=138024</id>
		<title>File:Calculate all penaltyies.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penaltyies.PNG&amp;diff=138024"/>
		<updated>2021-03-19T02:44:32Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Remove_negative_scores.PNG&amp;diff=137991</id>
		<title>File:Remove negative scores.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Remove_negative_scores.PNG&amp;diff=137991"/>
		<updated>2021-03-19T00:30:55Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mean.PNG&amp;diff=137990</id>
		<title>File:Mean.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mean.PNG&amp;diff=137990"/>
		<updated>2021-03-19T00:30:45Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_average_vector.PNG&amp;diff=137989</id>
		<title>File:Calculate average vector.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_average_vector.PNG&amp;diff=137989"/>
		<updated>2021-03-19T00:30:33Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalty_1.PNG&amp;diff=137988</id>
		<title>File:Calculate all penalty 1.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calculate_all_penalty_1.PNG&amp;diff=137988"/>
		<updated>2021-03-19T00:30:04Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calcuate_penalties_attributes.PNG&amp;diff=137987</id>
		<title>File:Calcuate penalties attributes.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calcuate_penalties_attributes.PNG&amp;diff=137987"/>
		<updated>2021-03-19T00:29:15Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Build_score_vector.PNG&amp;diff=137986</id>
		<title>File:Build score vector.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Build_score_vector.PNG&amp;diff=137986"/>
		<updated>2021-03-19T00:28:39Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137850</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137850"/>
		<updated>2021-03-15T12:57:08Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented in the '' grades_controller.rb '' file. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137849</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137849"/>
		<updated>2021-03-15T03:57:44Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented with the '' grades_controller.rb ''. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137848</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137848"/>
		<updated>2021-03-15T03:50:18Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented with the '' grades_controller.rb ''. This controller currently violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137847</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137847"/>
		<updated>2021-03-15T03:16:56Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented with the '' grades_controller.rb ''. This controller violates some essential Rails design principles including having too much calculation and having methods' names that violate Ruby naming convention.&lt;br /&gt;
=== Project Task ===&lt;br /&gt;
Here are the refactoring steps needed to be taken in order to fix the '' grades_controller.rb ''.&lt;br /&gt;
* Create a new private method to encapsulate the population of the view model for all the necessary data (lines 102-107).&lt;br /&gt;
* Simplify the logic surrounding the error flashing. The nested logic seems unnecessary (lines 190-192).&lt;br /&gt;
* In line 300:&lt;br /&gt;
** Increase readability by fixing whitespace according to the common Ruby Programming guidelines.&lt;br /&gt;
** Return is not needed here.&lt;br /&gt;
** Remove space between ‘!’ and its argument.&lt;br /&gt;
** Use meaningful variable names and break up the expression.&lt;br /&gt;
* Move these functions into '' grades_helper.rb '' and change their names to be more Ruby-like:&lt;br /&gt;
** '' calculate_all_penalties ''&lt;br /&gt;
** '' calculate_penalty_attributes ''&lt;br /&gt;
** '' mean '' (also cease the usage of the assignment)&lt;br /&gt;
** '' calculate_average_vector ''&lt;br /&gt;
** '' build_score_vector ''&lt;br /&gt;
** '' Remove_negative_scores_and_build_charts ''&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137846</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137846"/>
		<updated>2021-03-15T02:38:57Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: /* = */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented with the ''grades_controller.rb''. This controller&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137845</id>
		<title>CSC/ECE 517 Spring 2021 - E2107. Refactor grades controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2107._Refactor_grades_controller.rb&amp;diff=137845"/>
		<updated>2021-03-15T02:38:00Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: Created page with &amp;quot;== ''' Introduction ''' == === Problem Statement === Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This function...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
=== Problem Statement ===&lt;br /&gt;
Expertiza has a functionality that allows students and instructors to receive and give grades, respectively. This functionality is implemented with the ''grades_controller.rb''. This controller &lt;br /&gt;
===&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021&amp;diff=137844</id>
		<title>CSC/ECE 517 Spring 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021&amp;diff=137844"/>
		<updated>2021-03-15T02:15:58Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: /* OSS Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2106. Fix view in student_task/list page]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2021 - E2107. Refactor grades_controller.rb]]&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2001._Implement_charset_prescanning_for_the_HTML_parser&amp;diff=133662</id>
		<title>CSC/ECE 517 Spring 2020 - M2001. Implement charset prescanning for the HTML parser</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2001._Implement_charset_prescanning_for_the_HTML_parser&amp;diff=133662"/>
		<updated>2020-04-17T23:34:55Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://servo.org/ Servo] is a modern, high-performance browser engine designed for both application and embedded use. Servo is written in the Rust language. It is currently developed on 64-bit macOS, 64-bit Linux, 64-bit Windows, and Android. As of February 17, 2020, Servo is not yet capable of charset parsing, a feature that all other browsers have. The goal of this project is to implement HTML charset parsing in the current version of Servo.&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(software) Servo] is an experimental browser engine developed to take advantage of the memory safety properties and concurrency features of the Rust programming language. The project was initiated by Mozilla Research with the effort from Samsung to port it to Android and ARM processors. The prototype seeks to create a highly parallel environment, in which many components (such as rendering, layout, HTML parsing, image decoding, etc.) are handled by fine-grained, isolated tasks.&lt;br /&gt;
===Rust===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm programming language focused on performance and safety, especially safe concurrency. Rust is syntactically similar to C++ but provides memory safety without using garbage collection.&lt;br /&gt;
===DOM===&lt;br /&gt;
*The [https://www.w3schools.com/whatis/whatis_htmldom.asp HTML DOM] is an Object Model for HTML. It defines HTML elements as objects, properties for all HTML elements, methods for all HTML elements, events for all HTML elements.&lt;br /&gt;
*The [https://www.w3schools.com/whatis/whatis_htmldom.asp HTML DOM] is an API (Programming Interface) for JavaScript. JavaScript can add/change/remove HTML elements, add/change/remove HTML attributes, add/change/remove CSS styles etc.&lt;br /&gt;
[[File: Img_htmltree.gif | The HTML DOM Tree of Objects]]&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Setting up the local environment on our machines requires &amp;quot;rustup&amp;quot;, an installer for the systems programming language Rust. The guide to set up the local environment for each operating system can be found [https://github.com/servo/servo/blob/master/README.md here].&lt;br /&gt;
== '''Final Project''' ==&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
*Our main focus is to complete the initial steps listed on the [https://github.com/servo/servo/wiki/Implement-HTML-charset-parsing-project project page]. The goal here is to create a new Rust module in the html5ever repository and implement the byte stream prescanning algorithm.&lt;br /&gt;
*After completing the initial steps, we integrate the new prescan algorithm into Servo's HTML parser implementation following the encoding sniffing algorithm. Here, Rust package manager &amp;quot;Cargo&amp;quot; will be used.&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
Design pattern will not be applied here since our main goal is to create a method that implements a byte stream prescanning algorithm.&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
*Step 1: create a new prescan.rs module in the html5ever repository and implement the byte stream prescanning algorithm.&lt;br /&gt;
&lt;br /&gt;
*Step 1a: add a new public function which accepts a &amp;amp;[u8] argument and returns Result&amp;lt;&amp;amp;'static Encoding, AbortReason&amp;gt; where AbortReason is an enum representing not enough bytes or no encoding detected within the first 1024 bytes.&lt;br /&gt;
&lt;br /&gt;
*Step 1b: use Encoding::for_label to convert a named charset into an Encoding value&lt;br /&gt;
&lt;br /&gt;
*Step 2: add unit tests that cover success and failure cases for the algorithm (use cargo test prescan to run tests defined in the new prescan.rs module)&lt;br /&gt;
&lt;br /&gt;
*Step 3: Integrate the new prescan algorithm into Servo's HTML parser implementation following the encoding sniffing algorithm:&lt;br /&gt;
&lt;br /&gt;
*Step 3a: add a Cargo override that uses the locally-modified version of html5ever in Servo's Cargo.toml&lt;br /&gt;
&lt;br /&gt;
*Step 3b: modify components/script/dom/servoparser/mod.rs to create an enum with two states - Prescanning(Vec&amp;lt;u8&amp;gt;) and Detected(NetworkDecoder), and replace the network_decoder field with this enum&lt;br /&gt;
&lt;br /&gt;
*Step 3c: in push_bytes_input_chunk, if the prescanning case is active then perform prescanning on any existing buffer along with the newest chunk, transitioning into the Detected phase if prescanning completes (and updating the associated Document's encoding with the detected encoding) (step 4)&lt;br /&gt;
&lt;br /&gt;
*Step 3d: if prescanning does not complete, no parsing should occur in parse_bytes_chunk&lt;br /&gt;
&lt;br /&gt;
*Step 3e: modify new_inherited to accept an Option&amp;lt;&amp;amp;'static Encoding&amp;gt; argument, which is used as an override that avoids prescanning any input (step 3)&lt;br /&gt;
&lt;br /&gt;
*Step 3f: when prescanning completes with no detected encoding, check document's browsing context's parent's document's encoding (step 5)&lt;br /&gt;
&lt;br /&gt;
*Step 3g: Verify the failing automated tests pass with the new parser changes&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2001._Implement_charset_prescanning_for_the_HTML_parser&amp;diff=133661</id>
		<title>CSC/ECE 517 Spring 2020 - M2001. Implement charset prescanning for the HTML parser</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2001._Implement_charset_prescanning_for_the_HTML_parser&amp;diff=133661"/>
		<updated>2020-04-17T23:34:37Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://servo.org/ Servo] is a modern, high-performance browser engine designed for both application and embedded use. Servo is written in the Rust language. It is currently developed on 64-bit macOS, 64-bit Linux, 64-bit Windows, and Android. As of February 17, 2020, Servo is not yet capable of charset parsing, a feature that all other browsers have. The goal of this project is to implement HTML charset parsing in the current version of Servo.&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(software) Servo] is an experimental browser engine developed to take advantage of the memory safety properties and concurrency features of the Rust programming language. The project was initiated by Mozilla Research with the effort from Samsung to port it to Android and ARM processors. The prototype seeks to create a highly parallel environment, in which many components (such as rendering, layout, HTML parsing, image decoding, etc.) are handled by fine-grained, isolated tasks.&lt;br /&gt;
===Rust===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm programming language focused on performance and safety, especially safe concurrency. Rust is syntactically similar to C++ but provides memory safety without using garbage collection.&lt;br /&gt;
===DOM===&lt;br /&gt;
*The [https://www.w3schools.com/whatis/whatis_htmldom.asp HTML DOM] is an Object Model for HTML. It defines HTML elements as objects, properties for all HTML elements, methods for all HTML elements, events for all HTML elements.&lt;br /&gt;
*The [https://www.w3schools.com/whatis/whatis_htmldom.asp HTML DOM] is an API (Programming Interface) for JavaScript. JavaScript can add/change/remove HTML elements, add/change/remove HTML attributes, add/change/remove CSS styles etc.&lt;br /&gt;
[[File: Img_htmltree.gif | The HTML DOM Tree of Objects]]&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Setting up the local environment on our machines requires &amp;quot;rustup&amp;quot;, an installer for the systems programming language Rust. The guide to set up the local environment for each operating system can be found [https://github.com/servo/servo/blob/master/README.md here].&lt;br /&gt;
== '''Final Project''' ==&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
*Our main focus is to complete the initial steps listed on the [https://github.com/servo/servo/wiki/Implement-HTML-charset-parsing-project project page]. The goal here is to create a new Rust module in the html5ever repository and implement the byte stream prescanning algorithm.&lt;br /&gt;
*After completing the initial steps, we integrate the new prescan algorithm into Servo's HTML parser implementation following the encoding sniffing algorithm. Here, Rust package manager &amp;quot;Cargo&amp;quot; will be used.&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
Design pattern will not be applied here since our main goal is to create a method that implements a byte stream prescanning algorithm.&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
*Step 1: create a new prescan.rs module in the html5ever repository and implement the byte stream prescanning algorithm.&lt;br /&gt;
&lt;br /&gt;
*Step 1a: add a new public function which accepts a &amp;amp;[u8] argument and returns Result&amp;lt;&amp;amp;'static Encoding, AbortReason&amp;gt; where AbortReason is an enum representing not enough bytes or no encoding detected within the first 1024 bytes.&lt;br /&gt;
&lt;br /&gt;
*Step 1b: use Encoding::for_label to convert a named charset into an Encoding value&lt;br /&gt;
&lt;br /&gt;
*Step 2: add unit tests that cover success and failure cases for the algorithm (use cargo test prescan to run tests defined in the new prescan.rs module)&lt;br /&gt;
&lt;br /&gt;
*Step 3: Integrate the new prescan algorithm into Servo's HTML parser implementation following the encoding sniffing algorithm:&lt;br /&gt;
&lt;br /&gt;
*Step 3a: add a Cargo override that uses the locally-modified version of html5ever in Servo's Cargo.toml&lt;br /&gt;
&lt;br /&gt;
*Step 3b: modify components/script/dom/servoparser/mod.rs to create an enum with two states - Prescanning(Vec&amp;lt;u8&amp;gt;) and Detected(NetworkDecoder), and replace the network_decoder field with this enum&lt;br /&gt;
&lt;br /&gt;
*Step 3c: in push_bytes_input_chunk, if the prescanning case is active then perform prescanning on any existing buffer along with the newest chunk, transitioning into the Detected phase if prescanning completes (and updating the associated Document's encoding with the detected encoding) (step 4)&lt;br /&gt;
&lt;br /&gt;
*Step 3d: if prescanning does not complete, no parsing should occur in parse_bytes_chunk&lt;br /&gt;
&lt;br /&gt;
*Step 3e: modify new_inherited to accept an Option&amp;lt;&amp;amp;'static Encoding&amp;gt; argument, which is used as an override that avoids prescanning any input (step 3)&lt;br /&gt;
&lt;br /&gt;
Step 3f: when prescanning completes with no detected encoding, check document's browsing context's parent's document's encoding (step 5)&lt;br /&gt;
&lt;br /&gt;
Step 3g: Verify the failing automated tests pass with the new parser changes&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2001._Implement_charset_prescanning_for_the_HTML_parser&amp;diff=133328</id>
		<title>CSC/ECE 517 Spring 2020 - M2001. Implement charset prescanning for the HTML parser</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2001._Implement_charset_prescanning_for_the_HTML_parser&amp;diff=133328"/>
		<updated>2020-04-13T23:20:21Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://servo.org/ Servo] is a modern, high-performance browser engine designed for both application and embedded use. Servo is written in the Rust language. It is currently developed on 64-bit macOS, 64-bit Linux, 64-bit Windows, and Android. As of February 17, 2020, Servo is not yet capable of charset parsing, a feature that all other browsers have. The goal of this project is to implement HTML charset parsing in the current version of Servo.&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
===Servo===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Servo_(software) Servo] is an experimental browser engine developed to take advantage of the memory safety properties and concurrency features of the Rust programming language. The project was initiated by Mozilla Research with the effort from Samsung to port it to Android and ARM processors. The prototype seeks to create a highly parallel environment, in which many components (such as rendering, layout, HTML parsing, image decoding, etc.) are handled by fine-grained, isolated tasks.&lt;br /&gt;
===Rust===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm programming language focused on performance and safety, especially safe concurrency. Rust is syntactically similar to C++ but provides memory safety without using garbage collection.&lt;br /&gt;
===DOM===&lt;br /&gt;
*The [https://www.w3schools.com/whatis/whatis_htmldom.asp HTML DOM] is an Object Model for HTML. It defines HTML elements as objects, properties for all HTML elements, methods for all HTML elements, events for all HTML elements.&lt;br /&gt;
*The [https://www.w3schools.com/whatis/whatis_htmldom.asp HTML DOM] is an API (Programming Interface) for JavaScript. JavaScript can add/change/remove HTML elements, add/change/remove HTML attributes, add/change/remove CSS styles etc.&lt;br /&gt;
[[File: Img_htmltree.gif | The HTML DOM Tree of Objects]]&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Setting up the local environment on our machines requires &amp;quot;rustup&amp;quot;, an installer for the systems programming language Rust. The guide to set up the local environment for each operating system can be found [https://github.com/servo/servo/blob/master/README.md here].&lt;br /&gt;
== '''Final Project''' ==&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
*Our main focus is to complete the initial steps listed on the [https://github.com/servo/servo/wiki/Implement-HTML-charset-parsing-project project page]. The goal here is to create a new Rust module in the html5ever repository and implement the byte stream prescanning algorithm.&lt;br /&gt;
*After completing the initial steps, we integrate the new prescan algorithm into Servo's HTML parser implementation following the encoding sniffing algorithm. Here, Rust package manager &amp;quot;Cargo&amp;quot; will be used.&lt;br /&gt;
===Design Pattern===&lt;br /&gt;
Design pattern will not be applied here since our main goal is to create a method that implements a byte stream prescanning algorithm.&lt;br /&gt;
===Implementation===&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Img_htmltree.gif&amp;diff=133324</id>
		<title>File:Img htmltree.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Img_htmltree.gif&amp;diff=133324"/>
		<updated>2020-04-13T23:17:42Z</updated>

		<summary type="html">&lt;p&gt;Bwanza: Bwanza uploaded a new version of File:Img htmltree.gif&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bwanza</name></author>
	</entry>
</feed>