<?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=Rsshives</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=Rsshives"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Rsshives"/>
	<updated>2026-05-15T18:07:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147404</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147404"/>
		<updated>2023-03-13T07:54:20Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity of users' data while development.&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;code&amp;gt;config/locales&amp;lt;/code&amp;gt;, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, fullname, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''*Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
'''*Ensure there are no more than 8 duplicate entries of students and none of other roles. Otherwise re-run the script&lt;br /&gt;
'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147403</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147403"/>
		<updated>2023-03-13T07:53:29Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity of users' data while development.&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, fullname, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''*Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
'''*Ensure there are no more than 8 duplicate entries of students and none of other roles. Otherwise re-run the script&lt;br /&gt;
'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147402</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147402"/>
		<updated>2023-03-13T07:52:48Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, fullname, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''*Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
'''*Ensure there are no more than 8 duplicate entries of students and none of other roles. Otherwise re-run the script&lt;br /&gt;
'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147401</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147401"/>
		<updated>2023-03-13T07:51:56Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, fullname, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''*Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
'''*Ensure there are no more than 8 duplicate entries of students and none of other roles.&lt;br /&gt;
'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147400</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147400"/>
		<updated>2023-03-13T07:50:28Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''*Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
'''*Ensure there are no more than 8 duplicate entries of students and none of other roles.&lt;br /&gt;
'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147399</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147399"/>
		<updated>2023-03-13T07:50:13Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''*Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
'''&lt;br /&gt;
'''*Ensure there are no more than 8 duplicate entries of students and none of other roles.&lt;br /&gt;
'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147398</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147398"/>
		<updated>2023-03-13T07:48:37Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
select name, email from users limit 10;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
Ensure there are no more than 8 duplicate entries of students and none of other roles.'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147397</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147397"/>
		<updated>2023-03-13T07:46:32Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
&lt;br /&gt;
select name, email from users limit 10;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&lt;br /&gt;
'''Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
Ensure there are no more than 8 duplicate entries of students and none of other roles.'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147396</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147396"/>
		<updated>2023-03-13T07:46:03Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
In the &amp;lt;code&amp;gt;Gemfile&amp;lt;/code&amp;gt; add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change &amp;lt;code&amp;gt;en-US.yml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en.yml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside the file, replace &amp;lt;code&amp;gt;en-US:&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;en:&amp;lt;/code&amp;gt;&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Have a database &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;lib/tasks/scrub_database.rake&amp;lt;/code&amp;gt; we have defined a namespace &amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt; inside which we have a task &amp;lt;code&amp;gt;scrub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In &amp;lt;code&amp;gt;db/data_migrations/scrub_database.rb&amp;lt;/code&amp;gt; we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Format for anonymizing===&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the &amp;lt;code&amp;gt;expertiza_development&amp;lt;/code&amp;gt; database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command &amp;lt;code&amp;gt;sudo su&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
&lt;br /&gt;
select name, email from users limit 10;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&lt;br /&gt;
'''Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
Ensure there are no more than 8 duplicate entries of students and none of other roles.'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147395</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147395"/>
		<updated>2023-03-13T07:40:49Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;br /&gt;
In the Gemfile add&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'faker', '1.9.3', group: [:test, :development], require: false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In config/locales, change en-US.yml to en.yml&lt;br /&gt;
Inside the file, replace en-US: to en:&lt;br /&gt;
(This is to avoid any translation error thrown by i18n)&lt;br /&gt;
&lt;br /&gt;
Have a database expertiza_development with real-time records of the expertiza database&lt;br /&gt;
&lt;br /&gt;
==Anonymization Script==&lt;br /&gt;
&lt;br /&gt;
===Rake task to run the script===&lt;br /&gt;
In lib/tasks/scrub_database.rake we have defined a namespace db inside which we have a task scrub&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace :db do&lt;br /&gt;
  namespace :data do&lt;br /&gt;
    desc 'Scrubs the database of user information'&lt;br /&gt;
    task scrub: :environment do&lt;br /&gt;
      require './db/data_migrations/scrub_database.rb' # Require the data migration class&lt;br /&gt;
      ScrubDatabase.run! # Run the function which contains the logic&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logic of the script===&lt;br /&gt;
In db/data_migrations/scrub_database.rb we have the main logic to anonymize the script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'i18n'&lt;br /&gt;
require 'faker'&lt;br /&gt;
&lt;br /&gt;
class ScrubDatabase&lt;br /&gt;
  I18n.default_locale = :en # here, we set the default locale to be used&lt;br /&gt;
  I18n.reload!&lt;br /&gt;
  def self.run! # this is the function called in the rake file&lt;br /&gt;
    User.find_each do |user|&lt;br /&gt;
        #logic for anonymizing the records&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Format for anonymizing is as follows&lt;br /&gt;
&lt;br /&gt;
For Students:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;lname&amp;gt;, &amp;lt;fname&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Others:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user.name = &amp;quot;&amp;lt;role&amp;gt;_&amp;lt;fname&amp;gt;_&amp;lt;lname_subS&amp;gt;&amp;lt;num&amp;gt;&amp;quot;&lt;br /&gt;
user.fullname = &amp;quot;&amp;lt;fname&amp;gt;, &amp;lt;role&amp;gt;&lt;br /&gt;
user.email = &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
user.password = &amp;quot;password&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fname&amp;lt;/code&amp;gt; : First name generated by Faker gem&lt;br /&gt;
&amp;lt;code&amp;gt;lname&amp;lt;/code&amp;gt; : Last name generated by Faker gem&lt;br /&gt;
&amp;lt;code&amp;gt;lname_subS&amp;lt;/code&amp;gt; : Substring of Last name of first 4 characters&lt;br /&gt;
&amp;lt;code&amp;gt;role&amp;lt;/code&amp;gt; : Role of actual user (eg. teaching_assistant, instructor)&lt;br /&gt;
&amp;lt;code&amp;gt;num&amp;lt;/code&amp;gt; : A random number generated between 1 to 9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Running the anonymization script==&lt;br /&gt;
This script anonymizes the records present in the expertiza_development database&lt;br /&gt;
&lt;br /&gt;
To run this script, you have to switch to sudo user with the command sudo su&lt;br /&gt;
&lt;br /&gt;
cd lib/tasks&lt;br /&gt;
&lt;br /&gt;
rake db:data:scrub --trace&lt;br /&gt;
&lt;br /&gt;
After the task is completed, login to mysql&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
&lt;br /&gt;
use expertiza_development;&lt;br /&gt;
&lt;br /&gt;
select name, email from users limit 10;&lt;br /&gt;
&lt;br /&gt;
To check for any duplicate entries, run this SQL command&lt;br /&gt;
&lt;br /&gt;
select name, count(name) from users group by name having count(name) &amp;gt;1;&lt;br /&gt;
&lt;br /&gt;
'''Note down the names, and add them to the blacklist, since we would not be able to login to these accounts&lt;br /&gt;
Ensure there are no more than 8 duplicate entries of students and none of other roles.'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147394</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147394"/>
		<updated>2023-03-13T07:05:21Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;br /&gt;
&lt;br /&gt;
==Initial Setup for Anonymization==&lt;br /&gt;
We use the &amp;lt;code&amp;gt;faker&amp;lt;/code&amp;gt; gem to create fake names and replace the actual data with the names generated by this gem.&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147393</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147393"/>
		<updated>2023-03-13T07:01:41Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use Database Anonymization to scrub the database and replace real-time Expertiza records with fake data to use it for development purposes and to avoid hamper the integrity while development!&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147392</id>
		<title>Documentation for Database Anonymization</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Documentation_for_Database_Anonymization&amp;diff=147392"/>
		<updated>2023-03-13T06:58:44Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: Created page with &amp;quot;Hello&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Expertiza_documentation&amp;diff=147391</id>
		<title>Expertiza documentation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Expertiza_documentation&amp;diff=147391"/>
		<updated>2023-03-13T06:58:27Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: /* Database Guides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:715px-EXPERTIZA.png|715px]]&lt;br /&gt;
&lt;br /&gt;
= Welcome to the Expertiza project! =&lt;br /&gt;
&lt;br /&gt;
The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Short Powerpoint introductions ==&lt;br /&gt;
*My [http://research.csc.ncsu.edu/efg/expertiza/presentations/ELI_11_wiki_textbook.ppt presentation] on using Expertiza to support wiki-textbook creation, at the 2011 EDUCAUSE Learning Initiative conference, February 15, 2011&lt;br /&gt;
*My [http://research.csc.ncsu.edu/efg/expertiza/presentations/Purdue_TLT_2009.ppt plenary talk] at the Purdue TLT Conference on April 22, 2009&lt;br /&gt;
*We invite you to view the original [http://research.csc.ncsu.edu/efg/expertiza/presentations/Expertiza-short.htm rationale] for the system.&lt;br /&gt;
*You can walk through a [http://research.csc.ncsu.edu/efg/expertiza/presentations/Expertiza%20in%20Action.ppt virtual demo] of the system.&lt;br /&gt;
&lt;br /&gt;
== Papers ==&lt;br /&gt;
*A [http://innovateonline.info/index.php?view=article&amp;amp;id=365 prose rendition] of the rationale was published in [http://innovateonline.info/ Innovate] in 2007. (To view it, you need to register, and you will receive e-mail each time a new issue of this very interesting and useful journal is published.)&lt;br /&gt;
*Other papers on Expertiza can be found [http://research.csc.ncsu.edu/efg/expertiza/papers/ here].&lt;br /&gt;
&lt;br /&gt;
== Video presentations ==&lt;br /&gt;
&lt;br /&gt;
*An [http://connectpro86502729.na6.acrobat.com/p99048610/ overview] of Expertiza (&amp;quot;Software support for teamwork and authentic assessment [http://research.csc.ncsu.edu/efg/expertiza/presentations/TLT_Live.ppt  (slides)]&amp;quot;) from the TLT Group's Friday Live, September 24, 2010&lt;br /&gt;
*[https://sas.elluminate.com/site/external/recording/playback/link/dropin.jnlp?sid=2008350&amp;amp;suid=D.2D2E269EE524FD263F89DA6872A41E Student-authored wiki textbooks: Composition and review] from the 2011 Global Education Consortium, November 18, 2011&lt;br /&gt;
*This [http://educause.mediasite.com/mediasite/SilverlightPlayer/Default.aspx?peid=cdeebca6d1a34610923bcabd4c2d2fd91d session from EDUCAUSE ELI 2011] describes how Expertiza can be used to review wiki-textbook contributions.  It is an earlier version of the presentation above that includes a live demo. &lt;br /&gt;
*This Innovate [http://breeze.uliveandlearn.com/p10263667/ Webcast] from July 2007 includes the rationale and a demo of the system.&lt;br /&gt;
*A six-minute [http://www.youtube.com/watch?v=hVpS7qvC5Zs interview] from the 2009 Lilly Conference on College Teaching describes the goals and realization of the project.  (&amp;lt;i&amp;gt;Note:&amp;lt;/i&amp;gt; Background noise may be distracting.)&lt;br /&gt;
*This Innovate [http://breeze.uliveandlearn.com/p84785847/ Ideagora] discussion from January 2009 describes the social-networking features planned for Expertiza.&lt;br /&gt;
*[https://sas.elluminate.com/site/external/jwsdetect/playback.jnlp?psid=2009-03-17.1032.M.F13AAE88367AEE982449E713075D42.vcr Forming and managing student teams and peer feedback in Expertiza], a presentation at the UNC TLT conference in March 2009.&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
&lt;br /&gt;
*An [http://research.csc.ncsu.edu/efg/expertiza/reports/Instructor_documentation.doc instructor manual], explaining how to create an deploy an assignment in Expertiza.&lt;br /&gt;
*An [http://research.csc.ncsu.edu/efg/expertiza/presentations/videos/instructor.swf instructor video], slightly dated, showing how to create and deploy an assignment&lt;br /&gt;
*A [http://rajanalwan.com/ui_guidelines/ design document] for the application.&lt;br /&gt;
* A guide for [[Creating_Custom_Rubric]]&lt;br /&gt;
*For students, a [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_documentation.ppt Powerpoint] or [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_documentation.pdf PDF] presentation explaining how to submit and review an assignment with Expertiza.&lt;br /&gt;
*For students, a [http://research.csc.ncsu.edu/efg/expertiza/presentations/videos/student.swf video] showing how to use the system to submit and review an assignment.&lt;br /&gt;
*For students, a [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_wiki_documentation.ppt Powerpoint] or [http://research.csc.ncsu.edu/efg/expertiza/presentations/student_wiki_documentation.pdf PDF] presentation explaining how to submit and review wiki pages with Expertiza.&lt;br /&gt;
*For students, a [http://courses.ncsu.edu/csc517/common/homework/topic-signup-team-formation.ppt Powerpoint] or [http://courses.ncsu.edu/csc517/common/homework/topic-signup-team-formation.pdf PDF] presentation explaining how to form teams and sign up for topics.&lt;br /&gt;
&lt;br /&gt;
== Developers section ==&lt;br /&gt;
''Expertiza now has a Java dependency, so the machine you are using to develop Expertiza on should have the JVM installed.''&lt;br /&gt;
=== Development Environment Setup Guides ===&lt;br /&gt;
* [[Creating a Linux Development Environment for Expertiza - Installation Guide]]&lt;br /&gt;
**[http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:Debian Development setup for Ubuntu/Debian]&lt;br /&gt;
* [[Development:Setup:OSX]]&lt;br /&gt;
*[http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:Linux:RHEL  Development setup for Linux RHEL ]&lt;br /&gt;
*[[Developing Expertiza on the VCL]]&lt;br /&gt;
*Developing Expertiza on Virtual Box&lt;br /&gt;
** [https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uEUmNKVncxRUhUVVE/view?usp=sharing Download the VirtualBox Ubuntu image here]&lt;br /&gt;
** [https://drive.google.com/open?id=1YlqiSsbZl8TfPuQmIFG7TYo2npWzqqu4 or try the Lubuntu image here if the Ubuntu image is too heavy for your PC/Laptop ]&lt;br /&gt;
*Docker image (Only if you are familiar with docker. You will need it if you choose Expertiza to do OSS project.)&lt;br /&gt;
** Please follow the instruction in https://hub.docker.com/r/winbobob/expertiza-fall2016/&lt;br /&gt;
&lt;br /&gt;
=== Database Guides ===&lt;br /&gt;
*[[Deploying and importing production data with capistrano]]&lt;br /&gt;
*[[Documentation on Database Tables]]&lt;br /&gt;
*[[Documentation for Database Anonymization]]&lt;br /&gt;
&lt;br /&gt;
=== Security Guidelines ===&lt;br /&gt;
*[[Security guidelines for Expertiza]]&lt;br /&gt;
=== Git ===&lt;br /&gt;
*[[Version Control with the Git repository]]&lt;br /&gt;
*[http://wiki.expertiza.ncsu.edu/index.php/How_to_Begin_a_Project_from_the_Current_Expertiza_Repository How to Begin a Project from the Current Expertiza Repository]&lt;br /&gt;
&lt;br /&gt;
=== Ruby and Rails ===&lt;br /&gt;
*[[Restart Instructions for Expertiza]]&lt;br /&gt;
*[[Deploying Expertiza to Production]]&lt;br /&gt;
*[[Gem dependencies]]&lt;br /&gt;
*[[http://wiki.expertiza.ncsu.edu/index.php?title=Using_Cucumber_with_Expertiza Using Cucumber with Expertiza]]&lt;br /&gt;
&lt;br /&gt;
=== Misc ===&lt;br /&gt;
*[[Setting up and using TA functionality]]&lt;br /&gt;
*[[Restart instructions for Wiki]]&lt;br /&gt;
*[[Scoring &amp;amp; Grading Methods (Fall '21)]]&lt;br /&gt;
&lt;br /&gt;
=== Final Projects on Expertiza for Fall 2015 ===&lt;br /&gt;
[https://docs.google.com/document/d/1t0keeNQ2kP0NmcgIrtQXGi5K_GhQYcKzEVWJPPRBOHE/edit?pli=1 The Expertiza Final Project Submission] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
[http://expertiza.ncsu.edu The Expertiza application] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://research.csc.ncsu.edu/efg/expertiza/papers Papers on Expertiza] &amp;lt;br&amp;gt;&lt;br /&gt;
[http://research.csc.ncsu.edu/efg/expertiza/presentations/Expertiza-short.htm PowerPoint Presentation - The Expertiza platform]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.csc.ncsu.edu/news/463 Expertiza Platform Takes Honorable Mention in Gertrude Cox Awards]&lt;br /&gt;
&lt;br /&gt;
== Acknowledgments ==&lt;br /&gt;
&lt;br /&gt;
This material is based upon work supported by the National Science Foundation under Grant No. 0536558.  Additional funding from the NCSU Learning in a Technology-Rich Environment (LITRE) program, the NCSU Faculty Center for Teaching and Learning, the NCSU STEM Initiative, and the Center for Advanced Computing and Communication.&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146263</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146263"/>
		<updated>2022-11-06T03:59:51Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the &amp;lt;code&amp;gt;app/helpers/review_mapping_helper.rb&amp;lt;/code&amp;gt; and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt;, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method &amp;lt;code&amp;gt;obtain_team_color&amp;lt;/code&amp;gt; was calling the method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; and passing 'color' array. The method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; was checking multiple parameters and was pushing certain colors into the array. The method &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt; was then returning the last element of the array to the method &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def team_color(response_map)&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        'blue'&lt;br /&gt;
      else&lt;br /&gt;
        obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      'red'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = []&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color[-1]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color.push 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color.push 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color.push link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
Updated Code is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;def team_color(response_map)&lt;br /&gt;
    color = 'red'&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        color = 'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        color = 'blue'&lt;br /&gt;
      else&lt;br /&gt;
        color = obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
      color #returning the value of color&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = 'red' # assigning the color default to red&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color = 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color = 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color = link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;sort_reviewer_by_review_volume_desc()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb'''&lt;br /&gt;
  &amp;lt;pre&amp;gt;def sort_reviewer_by_review_volume_desc&lt;br /&gt;
    @reviewers.each do |r|&lt;br /&gt;
      # get the volume of review comments&lt;br /&gt;
      review_volumes = Response.volume_of_review_comments(@assignment.id, r.id)&lt;br /&gt;
      r.avg_vol_per_round = []&lt;br /&gt;
      review_volumes.each_index do |i|&lt;br /&gt;
        if i.zero?&lt;br /&gt;
          r.overall_avg_vol = review_volumes[0]&lt;br /&gt;
        else&lt;br /&gt;
          r.avg_vol_per_round.push(review_volumes[i])&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    # get the number of review rounds for the assignment&lt;br /&gt;
    @num_rounds = @assignment.num_review_rounds.to_f.to_i&lt;br /&gt;
    @all_reviewers_avg_vol_per_round = []&lt;br /&gt;
    @all_reviewers_overall_avg_vol = @reviewers.inject(0) { |sum, r| sum + r.overall_avg_vol } / (@reviewers.blank? ? 1 : @reviewers.length)&lt;br /&gt;
    @num_rounds.times do |round|&lt;br /&gt;
      @all_reviewers_avg_vol_per_round.push(@reviewers.inject(0) { |sum, r| sum + r.avg_vol_per_round[round] } / (@reviewers.blank? ? 1 : @reviewers.length))&lt;br /&gt;
    end&lt;br /&gt;
    @reviewers.sort! { |r1, r2| r2.overall_avg_vol &amp;lt;=&amp;gt; r1.overall_avg_vol }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''_review_report.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- Set the review data and row span for each reviewer --&amp;gt;&lt;br /&gt;
(Line 61) &amp;lt;% sort_reviewer_by_review_volume_desc.each_with_index do |reviewer, index| %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Created a generalized method &amp;lt;code&amp;gt;sort_reviewer_by_review_metric_desc()&amp;lt;/code&amp;gt; which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;) and edited the function call in &amp;lt;code&amp;gt;_review_report.html.erb&amp;lt;/code&amp;gt; file and in &amp;lt;code&amp;gt;spec/helpers/review_mapping_helper_spec.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
Code is as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Generalized function which takes in string parameter specifying the metric to be sorted&lt;br /&gt;
  def sort_reviewer_by_review_metric_desc(metric) #metric is the string value of the metric to be sorted with&lt;br /&gt;
    if (metric.eql?(&amp;quot;review_volume&amp;quot;))&lt;br /&gt;
      @reviewers.each do |r|&lt;br /&gt;
        # get the volume of review comments&lt;br /&gt;
        review_volumes = Response.volume_of_review_comments(@assignment.id, r.id)&lt;br /&gt;
        r.avg_vol_per_round = []&lt;br /&gt;
        review_volumes.each_index do |i|&lt;br /&gt;
          if i.zero?&lt;br /&gt;
            r.overall_avg_vol = review_volumes[0]&lt;br /&gt;
          else&lt;br /&gt;
            r.avg_vol_per_round.push(review_volumes[i])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    # get the number of review rounds for the assignment&lt;br /&gt;
    @num_rounds = @assignment.num_review_rounds.to_f.to_i&lt;br /&gt;
    @all_reviewers_avg_vol_per_round = []&lt;br /&gt;
    @all_reviewers_overall_avg_vol = @reviewers.inject(0) { |sum, r| sum + r.overall_avg_vol } / (@reviewers.blank? ? 1 : @reviewers.length)&lt;br /&gt;
    @num_rounds.times do |round|&lt;br /&gt;
      @all_reviewers_avg_vol_per_round.push(@reviewers.inject(0) { |sum, r| sum + r.avg_vol_per_round[round] } / (@reviewers.blank? ? 1 : @reviewers.length))&lt;br /&gt;
    end&lt;br /&gt;
    @reviewers.sort! { |r1, r2| r2.overall_avg_vol &amp;lt;=&amp;gt; r1.overall_avg_vol }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''_review_report.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- Set the review data and row span for each reviewer --&amp;gt;&lt;br /&gt;
(Line 61) &amp;lt;% sort_reviewer_by_review_metric_desc(&amp;quot;review_volume&amp;quot;).each_with_index do |reviewer, index| %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;initialize_chart_elements()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_volume_metric_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_tagging_interval_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;calculate_key_chart_information()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file &amp;lt;code&amp;gt;chart_generator_helper.rb&amp;lt;/code&amp;gt; and created a new module &amp;lt;code&amp;gt;ChartGeneratorHelper&amp;lt;/code&amp;gt; and shifted all the functions into that helper, and included it into the module &amp;lt;code&amp;gt;ReviewMappingHelper&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.177.222:8080/&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146262</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146262"/>
		<updated>2022-11-06T03:58:20Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method &amp;lt;code&amp;gt;obtain_team_color&amp;lt;/code&amp;gt; was calling the method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; and passing 'color' array. The method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; was checking multiple parameters and was pushing certain colors into the array. The method &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt; was then returning the last element of the array to the method &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def team_color(response_map)&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        'blue'&lt;br /&gt;
      else&lt;br /&gt;
        obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      'red'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = []&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color[-1]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color.push 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color.push 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color.push link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
Updated Code is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;def team_color(response_map)&lt;br /&gt;
    color = 'red'&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        color = 'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        color = 'blue'&lt;br /&gt;
      else&lt;br /&gt;
        color = obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
      color #returning the value of color&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = 'red' # assigning the color default to red&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color = 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color = 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color = link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;sort_reviewer_by_review_volume_desc()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb'''&lt;br /&gt;
  &amp;lt;pre&amp;gt;def sort_reviewer_by_review_volume_desc&lt;br /&gt;
    @reviewers.each do |r|&lt;br /&gt;
      # get the volume of review comments&lt;br /&gt;
      review_volumes = Response.volume_of_review_comments(@assignment.id, r.id)&lt;br /&gt;
      r.avg_vol_per_round = []&lt;br /&gt;
      review_volumes.each_index do |i|&lt;br /&gt;
        if i.zero?&lt;br /&gt;
          r.overall_avg_vol = review_volumes[0]&lt;br /&gt;
        else&lt;br /&gt;
          r.avg_vol_per_round.push(review_volumes[i])&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    # get the number of review rounds for the assignment&lt;br /&gt;
    @num_rounds = @assignment.num_review_rounds.to_f.to_i&lt;br /&gt;
    @all_reviewers_avg_vol_per_round = []&lt;br /&gt;
    @all_reviewers_overall_avg_vol = @reviewers.inject(0) { |sum, r| sum + r.overall_avg_vol } / (@reviewers.blank? ? 1 : @reviewers.length)&lt;br /&gt;
    @num_rounds.times do |round|&lt;br /&gt;
      @all_reviewers_avg_vol_per_round.push(@reviewers.inject(0) { |sum, r| sum + r.avg_vol_per_round[round] } / (@reviewers.blank? ? 1 : @reviewers.length))&lt;br /&gt;
    end&lt;br /&gt;
    @reviewers.sort! { |r1, r2| r2.overall_avg_vol &amp;lt;=&amp;gt; r1.overall_avg_vol }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''_review_report.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- Set the review data and row span for each reviewer --&amp;gt;&lt;br /&gt;
(Line 61) &amp;lt;% sort_reviewer_by_review_volume_desc.each_with_index do |reviewer, index| %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Created a generalized method &amp;lt;code&amp;gt;sort_reviewer_by_review_metric_desc()&amp;lt;/code&amp;gt; which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;) and edited the function call in &amp;lt;code&amp;gt;_review_report.html.erb&amp;lt;/code&amp;gt; file and in &amp;lt;code&amp;gt;spec/helpers/review_mapping_helper_spec.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
Code is as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Generalized function which takes in string parameter specifying the metric to be sorted&lt;br /&gt;
  def sort_reviewer_by_review_metric_desc(metric) #metric is the string value of the metric to be sorted with&lt;br /&gt;
    if (metric.eql?(&amp;quot;review_volume&amp;quot;))&lt;br /&gt;
      @reviewers.each do |r|&lt;br /&gt;
        # get the volume of review comments&lt;br /&gt;
        review_volumes = Response.volume_of_review_comments(@assignment.id, r.id)&lt;br /&gt;
        r.avg_vol_per_round = []&lt;br /&gt;
        review_volumes.each_index do |i|&lt;br /&gt;
          if i.zero?&lt;br /&gt;
            r.overall_avg_vol = review_volumes[0]&lt;br /&gt;
          else&lt;br /&gt;
            r.avg_vol_per_round.push(review_volumes[i])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    # get the number of review rounds for the assignment&lt;br /&gt;
    @num_rounds = @assignment.num_review_rounds.to_f.to_i&lt;br /&gt;
    @all_reviewers_avg_vol_per_round = []&lt;br /&gt;
    @all_reviewers_overall_avg_vol = @reviewers.inject(0) { |sum, r| sum + r.overall_avg_vol } / (@reviewers.blank? ? 1 : @reviewers.length)&lt;br /&gt;
    @num_rounds.times do |round|&lt;br /&gt;
      @all_reviewers_avg_vol_per_round.push(@reviewers.inject(0) { |sum, r| sum + r.avg_vol_per_round[round] } / (@reviewers.blank? ? 1 : @reviewers.length))&lt;br /&gt;
    end&lt;br /&gt;
    @reviewers.sort! { |r1, r2| r2.overall_avg_vol &amp;lt;=&amp;gt; r1.overall_avg_vol }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''_review_report.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- Set the review data and row span for each reviewer --&amp;gt;&lt;br /&gt;
(Line 61) &amp;lt;% sort_reviewer_by_review_metric_desc(&amp;quot;review_volume&amp;quot;).each_with_index do |reviewer, index| %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;initialize_chart_elements()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_volume_metric_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_tagging_interval_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;calculate_key_chart_information()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file &amp;lt;code&amp;gt;chart_generator_helper.rb&amp;lt;/code&amp;gt; and created a new module &amp;lt;code&amp;gt;ChartGeneratorHelper&amp;lt;/code&amp;gt; and shifted all the functions into that helper, and included it into the module &amp;lt;code&amp;gt;ReviewMappingHelper&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.177.222:8080/&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146261</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146261"/>
		<updated>2022-11-06T03:54:42Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method &amp;lt;code&amp;gt;obtain_team_color&amp;lt;/code&amp;gt; was calling the method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; and passing 'color' array. The method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; was checking multiple parameters and was pushing certain colors into the array. The method &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt; was then returning the last element of the array to the method &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def team_color(response_map)&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        'blue'&lt;br /&gt;
      else&lt;br /&gt;
        obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      'red'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = []&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color[-1]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color.push 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color.push 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color.push link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
Updated Code is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;def team_color(response_map)&lt;br /&gt;
    color = 'red'&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        color = 'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        color = 'blue'&lt;br /&gt;
      else&lt;br /&gt;
        color = obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
      color #returning the value of color&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = 'red' # assigning the color default to red&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color = 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color = 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color = link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;sort_reviewer_by_review_volume_desc()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb'''&lt;br /&gt;
  &amp;lt;pre&amp;gt;def sort_reviewer_by_review_volume_desc&lt;br /&gt;
    @reviewers.each do |r|&lt;br /&gt;
      # get the volume of review comments&lt;br /&gt;
      review_volumes = Response.volume_of_review_comments(@assignment.id, r.id)&lt;br /&gt;
      r.avg_vol_per_round = []&lt;br /&gt;
      review_volumes.each_index do |i|&lt;br /&gt;
        if i.zero?&lt;br /&gt;
          r.overall_avg_vol = review_volumes[0]&lt;br /&gt;
        else&lt;br /&gt;
          r.avg_vol_per_round.push(review_volumes[i])&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    # get the number of review rounds for the assignment&lt;br /&gt;
    @num_rounds = @assignment.num_review_rounds.to_f.to_i&lt;br /&gt;
    @all_reviewers_avg_vol_per_round = []&lt;br /&gt;
    @all_reviewers_overall_avg_vol = @reviewers.inject(0) { |sum, r| sum + r.overall_avg_vol } / (@reviewers.blank? ? 1 : @reviewers.length)&lt;br /&gt;
    @num_rounds.times do |round|&lt;br /&gt;
      @all_reviewers_avg_vol_per_round.push(@reviewers.inject(0) { |sum, r| sum + r.avg_vol_per_round[round] } / (@reviewers.blank? ? 1 : @reviewers.length))&lt;br /&gt;
    end&lt;br /&gt;
    @reviewers.sort! { |r1, r2| r2.overall_avg_vol &amp;lt;=&amp;gt; r1.overall_avg_vol }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''_review_report.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- Set the review data and row span for each reviewer --&amp;gt;&lt;br /&gt;
(Line 61) &amp;lt;% sort_reviewer_by_review_volume_desc.each_with_index do |reviewer, index| %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Created a generalized method &amp;lt;code&amp;gt;sort_reviewer_by_review_metric_desc()&amp;lt;/code&amp;gt; which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;) and edited the function call in &amp;lt;code&amp;gt;_review_report.html.erb&amp;lt;/code&amp;gt; file and in &amp;lt;code&amp;gt;spec/helpers/review_mapping_helper_spec.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
Code is as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Generalized function which takes in string parameter specifying the metric to be sorted&lt;br /&gt;
  def sort_reviewer_by_review_metric_desc(metric) #metric is the string value of the metric to be sorted with&lt;br /&gt;
    if (metric.eql?(&amp;quot;review_volume&amp;quot;))&lt;br /&gt;
      @reviewers.each do |r|&lt;br /&gt;
        # get the volume of review comments&lt;br /&gt;
        review_volumes = Response.volume_of_review_comments(@assignment.id, r.id)&lt;br /&gt;
        r.avg_vol_per_round = []&lt;br /&gt;
        review_volumes.each_index do |i|&lt;br /&gt;
          if i.zero?&lt;br /&gt;
            r.overall_avg_vol = review_volumes[0]&lt;br /&gt;
          else&lt;br /&gt;
            r.avg_vol_per_round.push(review_volumes[i])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    # get the number of review rounds for the assignment&lt;br /&gt;
    @num_rounds = @assignment.num_review_rounds.to_f.to_i&lt;br /&gt;
    @all_reviewers_avg_vol_per_round = []&lt;br /&gt;
    @all_reviewers_overall_avg_vol = @reviewers.inject(0) { |sum, r| sum + r.overall_avg_vol } / (@reviewers.blank? ? 1 : @reviewers.length)&lt;br /&gt;
    @num_rounds.times do |round|&lt;br /&gt;
      @all_reviewers_avg_vol_per_round.push(@reviewers.inject(0) { |sum, r| sum + r.avg_vol_per_round[round] } / (@reviewers.blank? ? 1 : @reviewers.length))&lt;br /&gt;
    end&lt;br /&gt;
    @reviewers.sort! { |r1, r2| r2.overall_avg_vol &amp;lt;=&amp;gt; r1.overall_avg_vol }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''_review_report.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- Set the review data and row span for each reviewer --&amp;gt;&lt;br /&gt;
(Line 61) &amp;lt;% sort_reviewer_by_review_metric_desc(&amp;quot;review_volume&amp;quot;).each_with_index do |reviewer, index| %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;initialize_chart_elements()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_volume_metric_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_tagging_interval_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;calculate_key_chart_information()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file &amp;lt;code&amp;gt;chart_generator_helper.rb&amp;lt;/code&amp;gt; and created a new module &amp;lt;code&amp;gt;ChartGeneratorHelper&amp;lt;/code&amp;gt; and shifted all the functions into that helper, and included it into the module &amp;lt;code&amp;gt;ReviewMappingHelper&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146260</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146260"/>
		<updated>2022-11-06T03:45:10Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method &amp;lt;code&amp;gt;obtain_team_color&amp;lt;/code&amp;gt; was calling the method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; and passing 'color' array. The method &amp;lt;code&amp;gt;check_submission_state()&amp;lt;/code&amp;gt; was checking multiple parameters and was pushing certain colors into the array. The method &amp;lt;code&amp;gt;obtain_team_color()&amp;lt;/code&amp;gt; was then returning the last element of the array to the method &amp;lt;code&amp;gt;team_color()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
Code was as follows&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def team_color(response_map)&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        'blue'&lt;br /&gt;
      else&lt;br /&gt;
        obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      'red'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = []&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color[-1]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color.push 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color.push 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color.push link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
Updated Code is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;def team_color(response_map)&lt;br /&gt;
    color = 'red'&lt;br /&gt;
    # Storing redundantly computed value in a variable &lt;br /&gt;
    assignment_created = @assignment.created_at&lt;br /&gt;
    # Storing redundantly computed value in a variable&lt;br /&gt;
    assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)&lt;br /&gt;
    # Returning color based on conditions&lt;br /&gt;
    if Response.exists?(map_id: response_map.id)&lt;br /&gt;
      if !response_map.try(:reviewer).try(:review_grade).nil?&lt;br /&gt;
        color = 'brown'&lt;br /&gt;
      elsif response_for_each_round?(response_map)&lt;br /&gt;
        color = 'blue'&lt;br /&gt;
      else&lt;br /&gt;
        color = obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      end&lt;br /&gt;
      color #returning the value of color&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # loops through the number of assignment review rounds and obtains the team color&lt;br /&gt;
  def obtain_team_color(response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
    color = 'red' # assigning the color default to red&lt;br /&gt;
    (1..@assignment.num_review_rounds).each do |round|&lt;br /&gt;
      check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    end&lt;br /&gt;
    color&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # checks the submission state within each round and assigns team color&lt;br /&gt;
  def check_submission_state(response_map, assignment_created, assignment_due_dates, round, color)&lt;br /&gt;
    if submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      color = 'purple'&lt;br /&gt;
    else&lt;br /&gt;
      link = submitted_hyperlink(round, response_map, assignment_created, assignment_due_dates)&lt;br /&gt;
      if link.nil? || (link !~ %r{https*:\/\/wiki(.*)}) # can be extended for github links in future&lt;br /&gt;
        color = 'green'&lt;br /&gt;
      else&lt;br /&gt;
        link_updated_at = get_link_updated_at(link)&lt;br /&gt;
        color = link_updated_since_last?(round, assignment_due_dates, link_updated_at) ? 'purple' : 'green'&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;initialize_chart_elements()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_volume_metric_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_tagging_interval_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;calculate_key_chart_information()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file &amp;lt;code&amp;gt;chart_generator_helper.rb&amp;lt;/code&amp;gt; and created a new module &amp;lt;code&amp;gt;ChartGeneratorHelper&amp;lt;/code&amp;gt; and shifted all the functions into that helper, and included it into the module &amp;lt;code&amp;gt;ReviewMappingHelper&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146259</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146259"/>
		<updated>2022-11-06T03:40:26Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;initialize_chart_elements()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_volume_metric_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_tagging_interval_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;calculate_key_chart_information()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file &amp;lt;code&amp;gt;chart_generator_helper.rb&amp;lt;/code&amp;gt; and created a new module &amp;lt;code&amp;gt;ChartGeneratorHelper&amp;lt;/code&amp;gt; and shifted all the functions into that helper, and included it into the module &amp;lt;code&amp;gt;ReviewMappingHelper&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;review_mapping_helper.rb&amp;lt;/code&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146258</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146258"/>
		<updated>2022-11-06T03:38:50Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;code&amp;gt;initialize_chart_elements()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_volume_metric_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;display_tagging_interval_chart()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;calculate_key_chart_information()&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146257</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146257"/>
		<updated>2022-11-06T03:37:38Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''chart_generator_helper.rb''' &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''review_mapping_helper.rb''' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146256</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146256"/>
		<updated>2022-11-06T03:36:28Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146255</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146255"/>
		<updated>2022-11-06T03:35:06Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146254</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146254"/>
		<updated>2022-11-06T03:33:59Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146253</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146253"/>
		<updated>2022-11-06T03:33:03Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146252</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146252"/>
		<updated>2022-11-06T03:32:00Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb&lt;br /&gt;
&amp;lt;block&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146251</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146251"/>
		<updated>2022-11-06T03:31:21Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146250</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146250"/>
		<updated>2022-11-06T03:29:28Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_calibration_report.html.erb&lt;br /&gt;
* app/views/reports/_feedback_report.html.erb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
* app/views/reports/_team_score.html.erb&lt;br /&gt;
* app/views/reports/_team_score_score_awarded.html.erb&lt;br /&gt;
* spec/features/review_mapping_helper_spec.rb&lt;br /&gt;
* spec/helpers/review_mapping_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize_chart_elements(), display_volume_metric_chart(), display_tagging_interval_chart(), calculate_key_chart_information()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The methods above were included in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' They are cohesive enough that they should be in their own separate file, either another helper or a mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a new file chart_generator_helper.rb and created a new module ChartGeneratorHelper and shifted all the functions into that helper, and included it into the module ReviewMappingHelper in the review_mapping_helper.rb file&amp;lt;br&amp;gt;&lt;br /&gt;
The new code is organized as below&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
chart_generator_helper.rb&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
module ChartGeneratorHelper &lt;br /&gt;
    def initialize_chart_elements()&lt;br /&gt;
    def display_volume_metric_chart()&lt;br /&gt;
    def display_tagging_interval_chart()&lt;br /&gt;
    def calculate_key_chart_information()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
module ReviewMappingHelper &lt;br /&gt;
    include ChartGeneratorHelper &lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146096</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146096"/>
		<updated>2022-10-27T03:49:51Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' A method list_review_submissions is not clear that it is needed.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' list_review_submissions&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' def list_review_submissions(participant_id, reviewee_team_id, response_map_id)&lt;br /&gt;
    participant = Participant.find(participant_id)&lt;br /&gt;
    team = AssignmentTeam.find(reviewee_team_id)&lt;br /&gt;
    html = ''&lt;br /&gt;
    unless team.nil? || participant.nil?&lt;br /&gt;
      review_submissions_path = team.path + '_review' + '/' + response_map_id.to_s&lt;br /&gt;
      files = team.submitted_files(review_submissions_path)&lt;br /&gt;
      html += display_review_files_directory_tree(participant, files) if files.present?&lt;br /&gt;
    end&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' I can’t find its usage even though it is used in a view file; app/views/reports/_review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I deleted the method in files; review_mapping_helper.rb and _review_report.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' Three classes which locate in the last part of file have no comments to explain what is being done.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' initialize(), reviews_per_team, reviews_needed, reviews_per_student&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:'''   class ReviewStrategy&lt;br /&gt;
    attr_accessor :participants, :teams&lt;br /&gt;
&lt;br /&gt;
    def initialize(participants, teams, review_num)&lt;br /&gt;
      @participants = participants&lt;br /&gt;
      @teams = teams&lt;br /&gt;
      @review_num = review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class StudentReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      (@participants.size * @review_num * 1.0 / @teams.size).round&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @participants.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class TeamReviewStrategy &amp;lt; ReviewStrategy&lt;br /&gt;
    def reviews_per_team&lt;br /&gt;
      @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_needed&lt;br /&gt;
      @teams.size * @review_num&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    def reviews_per_student&lt;br /&gt;
      (@teams.size * @review_num * 1.0 / @participants.size).round&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' Three classes are unclear.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' They are only used in this file. Also, they have methods that have same names with the other classes even if they are included in other class. At first, I tried to know what these classes meant and whether there was good way to refactor their method names. However, in conclusion, they are useless in the file, so I deleted them.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
http://github.com/expertiza/expertiza/pull/2462&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146084</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146084"/>
		<updated>2022-10-27T03:34:14Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===&lt;br /&gt;
https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===&lt;br /&gt;
https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146083</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146083"/>
		<updated>2022-10-27T03:33:38Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' I got rid of get_ on every method name which begins with get_. I also searched same methods which were used in other files, and also changed their names.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
===Link to Expertiza Repository===: https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Forked Repository===: https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
===Link to Pull Request===: &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146081</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146081"/>
		<updated>2022-10-27T03:31:28Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' According to Ruby Style Guide, we should avoid prefixing method names with get_.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Gunju Im&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
'''Link to Expertiza Repository:''' https://github.com/expertiza/expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
'''Link to Forked Repository:''' https://github.com/RoninS28/expertiza-E2262 &amp;lt;br&amp;gt;&lt;br /&gt;
'''Link to Pull Request:''' &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146078</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146078"/>
		<updated>2022-10-27T03:30:35Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' Various method names are not Ruby-like.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' get_data_for_review_report(), get_team_color(), get_link_updated_at(), get_team_reviewed_link_name(), get_awarded_review_score(), get_each_review_and_feedback_response_map(), get_certain_review_and_feedback_response_map(), get_css_style_for_calibration_report()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' Same as methods involved above&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Refactor charts generating methods into another file as a helper/mixin&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Github Links==&lt;br /&gt;
'''Link to Expertiza Repository:''' https://github.com/expertiza/expertiza&lt;br /&gt;
'''Link to Forked Repository:''' https://github.com/RoninS28/expertiza-E2262&lt;br /&gt;
'''Link to Pull Request:'''&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146067</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146067"/>
		<updated>2022-10-27T03:22:28Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed: &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Testpassedproof.png]]&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Testpassedproof.png&amp;diff=146066</id>
		<title>File:Testpassedproof.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Testpassedproof.png&amp;diff=146066"/>
		<updated>2022-10-27T03:21:52Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146065</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146065"/>
		<updated>2022-10-27T03:19:31Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; http://152.7.99.156:8080&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146064</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146064"/>
		<updated>2022-10-27T03:18:13Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [[http://152.7.99.156:8080]]&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username = instructor6 | Password = password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146063</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146063"/>
		<updated>2022-10-27T03:16:55Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [http://152.7.99.156:8080]&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username -&amp;gt; instructor6 | Password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146062</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146062"/>
		<updated>2022-10-27T03:15:45Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method &amp;lt;pre&amp;gt;check_submission_state()&amp;lt;/pre&amp;gt; and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
* '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [http://152.7.99.156:8080]&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username -&amp;gt; instructor6 | Password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146061</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146061"/>
		<updated>2022-10-27T03:14:52Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
* method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
* The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
* Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
* get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
* The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
* The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
* Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
* There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
* The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
* '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
* '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [http://152.7.99.156:8080]&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username -&amp;gt; instructor6 | Password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146060</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146060"/>
		<updated>2022-10-27T03:08:34Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
● method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&amp;lt;br&amp;gt;&lt;br /&gt;
● The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&amp;lt;br&amp;gt;&lt;br /&gt;
● Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate.&amp;lt;br&amp;gt; &lt;br /&gt;
● get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&amp;lt;br&amp;gt;&lt;br /&gt;
● The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&amp;lt;br&amp;gt;&lt;br /&gt;
● The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&amp;lt;br&amp;gt;&lt;br /&gt;
● Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &amp;lt;br&amp;gt;&lt;br /&gt;
● There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&amp;lt;br&amp;gt;&lt;br /&gt;
● The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #1:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #2:''' The code was not clear to the reader&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #3:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #4:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #5:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #6:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #7:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #8:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;gt; '''Issue #9:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [http://152.7.99.156:8080]&amp;lt;br&amp;gt;&lt;br /&gt;
And use the following credentials: Username -&amp;gt; instructor6 | Password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146059</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146059"/>
		<updated>2022-10-27T03:05:22Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu) &amp;lt;br&amp;gt;&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
● method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&lt;br /&gt;
● The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&lt;br /&gt;
● Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate. &lt;br /&gt;
● get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&lt;br /&gt;
● The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&lt;br /&gt;
● The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&lt;br /&gt;
● Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &lt;br /&gt;
● There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&lt;br /&gt;
● The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #1:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #2:''' The code was not clear to the reader&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #3:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #4:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #5:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #6:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #7:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #8:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #9:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [http://152.7.99.156:8080]&lt;br /&gt;
And use the following credentials: Username -&amp;gt; instructor6 | Password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146058</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146058"/>
		<updated>2022-10-27T03:04:32Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor===&lt;br /&gt;
Jialin Cui (jcui9 ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
Gun Ju Im (gim@ncsu.edu)&lt;br /&gt;
Rithik Jain (rjain25@ncsu.edu)&lt;br /&gt;
Rohan Shiveshwarkar (rsshives@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description of Project==&lt;br /&gt;
&lt;br /&gt;
This wiki describes the work done in refactoring the review_mapping_helper.rb and associated files calling the methods contained in it. The main goal of the tasks was to make the code clearer and more understandable to the reader while retaining the functionality. The goal included inserting comments wherever necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Description==&lt;br /&gt;
&lt;br /&gt;
The review_mapping_helper has methods that help return charts and other graphical data to the frontend&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What is Needed==&lt;br /&gt;
&lt;br /&gt;
This project builds on E2225, and should begin with the refactoring done by that project.  That project focused on simplifying the methods in review_mapping_helper, while this project looks at making the code more understandable and transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files Modified==&lt;br /&gt;
&lt;br /&gt;
* app/helpers/review_mapping_helper.rb&lt;br /&gt;
* app/views/reports/_review_report.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Issues to be Addressed==&lt;br /&gt;
&lt;br /&gt;
● method get_data_for_review_report marshals a lot of data together and passes back a data structure.  It is used in views/reports/_review_report.html.erb, but it is quite difficult to see how the data is displayed.  It violates the Expert pattern because the view needs to know how to break apart the structure that is passed to it.  Doing the same thing with partials in views/reports would make the code easier to follow&lt;br /&gt;
● The next three methods involve team “color”.  Color coding is explained on this page and this page for the E1789 project and this page for E1815.  The code for these methods is not at all clear and should be refactored.  And please use the American spelling “color”.&lt;br /&gt;
● Various method names begin with get.  This is not Ruby-like.  Change the names to something more appropriate. &lt;br /&gt;
● get_awarded_review_score computes an overall score based on scores awarded in individual rounds. This is one of many places in Expertiza where scores are being calculated.  Score-calculation code for multiple rounds is being standardized now, in response_map.rb.  Contact Nicholas Himes (nnhimes@ncsu.edu) for particulars.  Change this method to use the new code.&lt;br /&gt;
● The method sort_reviewer_by_review_volume_desc should be generalized so that it can sort by any metric, not just review volume.  Other metrics might include number of suggestions or number of suggestions + number of problems detected.  This method should not be counting the number of review rounds!  Since other places in the code will need to know the number of review rounds, it should be calculated somewhere else in the system.&lt;br /&gt;
● The next several methods generate charts.  They are cohesive enough that they should be in their own separate file, either another helper or a mixin.&lt;br /&gt;
● Then there is a method list_review_submissions. It’s not at all clear that this method is needed, though it is used in one view.  Look on the Expertiza wiki and see if there is a better way. &lt;br /&gt;
● There are several methods for feedback_response_maps.  It is not at all clear why they are here.  Look on the Expertiza wiki for the documentation, and see if you can replace them by calls to other methods, or at least make it clearer what they are doing.&lt;br /&gt;
● The file ends with three small classes being defined.  There are no comments at all to explain what is being done.  Look them up on the Expertiza wiki and refactor or comment them, whichever seems more appropriate. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problems Tackled==&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #1:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #2:''' The code was not clear to the reader&lt;br /&gt;
'''Methods involved:''' team_color(), obtain_team_color(), check_submission_state()&lt;br /&gt;
'''Initial Code:''' The method obtain_team_color was calling the method check_submission_state() and passing 'color' array. The method check_submission_state() was checking multiple parameters and was pushing certain colors into the array. The method obtain_team_color() was then returning the last element of the array to the method team_color()&lt;br /&gt;
'''Problem:''' The color array being passed around was unclear and was an unrequired data structure.&lt;br /&gt;
'''Solution:''' The color was changed to a variable, and on each check in the method check_submission_state(), the color variable is updated.&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #3:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #4:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #5:''' Generalizing the method sort_reviewer_by_review_volume_desc()&lt;br /&gt;
'''Methods involved:''' sort_reviewer_by_review_volume_desc()&lt;br /&gt;
'''Initial Code:''' The method was only taking into account the metric: review volume&lt;br /&gt;
'''Problem:''' The Response has several other metrics to be considered including number of suggestions, or number of suggestions + number of problems detected&lt;br /&gt;
'''Solution:''' Created a generalized method sort_reviewer_by_review_metric_desc() which takes in a string parameter specifying the metric to be considered (eg. &amp;quot;review_volume&amp;quot;)&lt;br /&gt;
'''Contributor:''' Rohan Shiveshwarkar&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #5:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #6:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #7:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #8:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;gt; '''Issue #9:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Methods involved:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Initial Code:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Problem:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Solution:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
'''Contributor:''' &amp;lt;Insert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Peer Review Information==&lt;br /&gt;
For viewing the deployed project (on VCL) please click on this link -&amp;gt; [http://152.7.99.156:8080]&lt;br /&gt;
And use the following credentials: Username -&amp;gt; instructor6 | Password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
===Rspec===&lt;br /&gt;
This is a refactoring project, so it is expected that the original functionality should be retained. All the test cases passed which implies that the refactored code did not break the existing functionality.&lt;br /&gt;
&lt;br /&gt;
Proof of test cases being passed:&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146053</id>
		<title>CSC/ECE 517 Fall 2022 - E2262: Refactor review mapping helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2262:_Refactor_review_mapping_helper.rb&amp;diff=146053"/>
		<updated>2022-10-27T02:05:43Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: Created page with &amp;quot;==E2262. Further refactoring and improvement of review_mapping_helper==  This page provides a description of the Expertiza based OSS project.    __TOC__   ===About Expertiza==...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2262. Further refactoring and improvement of review_mapping_helper==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is an all inclusive web service that allows instructors to create, edit and manage assignments. This includes the functionality for topic selection and team formation across various projects and assignments. Expertiza allows for a variety of submission types including URL and PDF. Expertiza also allows the instructor to assign peer reviews and team assessments.&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146051</id>
		<title>CSC/ECE 517 Fall 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146051"/>
		<updated>2022-10-27T02:04:04Z</updated>

		<summary type="html">&lt;p&gt;Rsshives: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2253.Refactor delayed mailer.rb and scheduled task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2256: Refactor late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2258. Refactor submitted_content_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2260. Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2254: Refactor teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2257: Refactor questionnaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2262: Refactor review_mapping_helper.rb]]&lt;/div&gt;</summary>
		<author><name>Rsshives</name></author>
	</entry>
</feed>