<?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=Cpsmith6</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=Cpsmith6"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Cpsmith6"/>
	<updated>2026-05-13T11:45:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141368</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141368"/>
		<updated>2021-11-09T01:42:14Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* email */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
====get_all_versions====&lt;br /&gt;
This returns a sorted array of all the different versions of what is being reviewed in this response map. This means for a test, we will need to create a reviewer, a reviewee, several types of reviews of different versions to be sorted correctly.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-get all versions.PNG]]&lt;br /&gt;
&lt;br /&gt;
====contributor====&lt;br /&gt;
Returns the team associated with the ReviewResponseMap that is to be metareviewed. We will need to create a ReviewResponseMap that has a team associated with it. Then we must create MetareviewResponseMap that points to a created ReviewResponseMap via the reviewed_object_id attribute. We will test if it indeed returns the team associated with ReviewResponseMap.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-contributor.PNG]]&lt;br /&gt;
&lt;br /&gt;
====questionnaire====&lt;br /&gt;
Returns all questionnaires associated to the assignment of this MetareviewResponseMap that is of type 'MetareviewQuestionnaire'. We will need to create a valid MetareviewResponseMap including at least one MetareviewQuestionnaire that can be returned.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
====get_title====&lt;br /&gt;
Returns string &amp;quot;Metareview&amp;quot;. We will test if this string is the same as typed out.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-get title.PNG]]&lt;br /&gt;
&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.export(csv, parent_id, _options)&lt;br /&gt;
    mappings = Assignment.find(parent_id).metareview_mappings&lt;br /&gt;
    mappings = mappings.sort_by {|a| [a.review_mapping.reviewee.name, a.reviewee.name, a.reviewer.name] }&lt;br /&gt;
    mappings.each do |map|&lt;br /&gt;
      csv &amp;lt;&amp;lt; [&lt;br /&gt;
        map.review_mapping.reviewee.name,&lt;br /&gt;
        map.reviewee.name,&lt;br /&gt;
        map.reviewer.name&lt;br /&gt;
      ]&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.export_fields(_options)&lt;br /&gt;
    fields = [&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;, &amp;quot;metareviewed by&amp;quot;]&lt;br /&gt;
    fields&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-import.jpg]]&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview). The function sends an email to the participant when they have a new metareview to complete. We will test to make sure the email is sent to the correct participant.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def email(defn, _participant, assignment)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
    reviewee_user = Participant.find(reviewee_id)&lt;br /&gt;
    defn[:body][:obj_name] = assignment.name&lt;br /&gt;
    defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
    defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
==== self.assessments_for(team) ====&lt;br /&gt;
Gets all submitted Review Responses or all regular Responses for a team, sorts the responses by version, and returns the latest Responses.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-assessments_for.png]]&lt;br /&gt;
&lt;br /&gt;
==== comparator ====&lt;br /&gt;
Compares two Responses version numbers and returns a -1,0, or 1 depending on which version number is greater. If there is no version number for the first response, -1 is returned, otherwise 1 is returned.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-comparator.png]]&lt;br /&gt;
&lt;br /&gt;
==== self.reviewer_assessments_for(team, reviewer) ====&lt;br /&gt;
Gets the Responses for a team reviewed by a specific reviewer and returns the latest response.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-reviewer_assessments_for.png]]&lt;br /&gt;
&lt;br /&gt;
==== metareviewed_by? ====&lt;br /&gt;
Returns whether the Response Map has been metareviewed&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-metareviewed_by.png]]&lt;br /&gt;
&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141367</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141367"/>
		<updated>2021-11-09T01:41:24Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* export_fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
====get_all_versions====&lt;br /&gt;
This returns a sorted array of all the different versions of what is being reviewed in this response map. This means for a test, we will need to create a reviewer, a reviewee, several types of reviews of different versions to be sorted correctly.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-get all versions.PNG]]&lt;br /&gt;
&lt;br /&gt;
====contributor====&lt;br /&gt;
Returns the team associated with the ReviewResponseMap that is to be metareviewed. We will need to create a ReviewResponseMap that has a team associated with it. Then we must create MetareviewResponseMap that points to a created ReviewResponseMap via the reviewed_object_id attribute. We will test if it indeed returns the team associated with ReviewResponseMap.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-contributor.PNG]]&lt;br /&gt;
&lt;br /&gt;
====questionnaire====&lt;br /&gt;
Returns all questionnaires associated to the assignment of this MetareviewResponseMap that is of type 'MetareviewQuestionnaire'. We will need to create a valid MetareviewResponseMap including at least one MetareviewQuestionnaire that can be returned.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
====get_title====&lt;br /&gt;
Returns string &amp;quot;Metareview&amp;quot;. We will test if this string is the same as typed out.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-get title.PNG]]&lt;br /&gt;
&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.export(csv, parent_id, _options)&lt;br /&gt;
    mappings = Assignment.find(parent_id).metareview_mappings&lt;br /&gt;
    mappings = mappings.sort_by {|a| [a.review_mapping.reviewee.name, a.reviewee.name, a.reviewer.name] }&lt;br /&gt;
    mappings.each do |map|&lt;br /&gt;
      csv &amp;lt;&amp;lt; [&lt;br /&gt;
        map.review_mapping.reviewee.name,&lt;br /&gt;
        map.reviewee.name,&lt;br /&gt;
        map.reviewer.name&lt;br /&gt;
      ]&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.export_fields(_options)&lt;br /&gt;
    fields = [&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;, &amp;quot;metareviewed by&amp;quot;]&lt;br /&gt;
    fields&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-import.jpg]]&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview). The function sends an email to the participant when they have a new metareview to complete. We will test to make sure the email is sent to the correct participant.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-email.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
==== self.assessments_for(team) ====&lt;br /&gt;
Gets all submitted Review Responses or all regular Responses for a team, sorts the responses by version, and returns the latest Responses.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-assessments_for.png]]&lt;br /&gt;
&lt;br /&gt;
==== comparator ====&lt;br /&gt;
Compares two Responses version numbers and returns a -1,0, or 1 depending on which version number is greater. If there is no version number for the first response, -1 is returned, otherwise 1 is returned.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-comparator.png]]&lt;br /&gt;
&lt;br /&gt;
==== self.reviewer_assessments_for(team, reviewer) ====&lt;br /&gt;
Gets the Responses for a team reviewed by a specific reviewer and returns the latest response.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-reviewer_assessments_for.png]]&lt;br /&gt;
&lt;br /&gt;
==== metareviewed_by? ====&lt;br /&gt;
Returns whether the Response Map has been metareviewed&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-metareviewed_by.png]]&lt;br /&gt;
&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141366</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141366"/>
		<updated>2021-11-09T01:41:04Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* exports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
====get_all_versions====&lt;br /&gt;
This returns a sorted array of all the different versions of what is being reviewed in this response map. This means for a test, we will need to create a reviewer, a reviewee, several types of reviews of different versions to be sorted correctly.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-get all versions.PNG]]&lt;br /&gt;
&lt;br /&gt;
====contributor====&lt;br /&gt;
Returns the team associated with the ReviewResponseMap that is to be metareviewed. We will need to create a ReviewResponseMap that has a team associated with it. Then we must create MetareviewResponseMap that points to a created ReviewResponseMap via the reviewed_object_id attribute. We will test if it indeed returns the team associated with ReviewResponseMap.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-contributor.PNG]]&lt;br /&gt;
&lt;br /&gt;
====questionnaire====&lt;br /&gt;
Returns all questionnaires associated to the assignment of this MetareviewResponseMap that is of type 'MetareviewQuestionnaire'. We will need to create a valid MetareviewResponseMap including at least one MetareviewQuestionnaire that can be returned.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
====get_title====&lt;br /&gt;
Returns string &amp;quot;Metareview&amp;quot;. We will test if this string is the same as typed out.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-get title.PNG]]&lt;br /&gt;
&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.export(csv, parent_id, _options)&lt;br /&gt;
    mappings = Assignment.find(parent_id).metareview_mappings&lt;br /&gt;
    mappings = mappings.sort_by {|a| [a.review_mapping.reviewee.name, a.reviewee.name, a.reviewer.name] }&lt;br /&gt;
    mappings.each do |map|&lt;br /&gt;
      csv &amp;lt;&amp;lt; [&lt;br /&gt;
        map.review_mapping.reviewee.name,&lt;br /&gt;
        map.reviewee.name,&lt;br /&gt;
        map.reviewer.name&lt;br /&gt;
      ]&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-export_fields.jpg]]&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-import.jpg]]&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview). The function sends an email to the participant when they have a new metareview to complete. We will test to make sure the email is sent to the correct participant.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-email.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
==== self.assessments_for(team) ====&lt;br /&gt;
Gets all submitted Review Responses or all regular Responses for a team, sorts the responses by version, and returns the latest Responses.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-assessments_for.png]]&lt;br /&gt;
&lt;br /&gt;
==== comparator ====&lt;br /&gt;
Compares two Responses version numbers and returns a -1,0, or 1 depending on which version number is greater. If there is no version number for the first response, -1 is returned, otherwise 1 is returned.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-comparator.png]]&lt;br /&gt;
&lt;br /&gt;
==== self.reviewer_assessments_for(team, reviewer) ====&lt;br /&gt;
Gets the Responses for a team reviewed by a specific reviewer and returns the latest response.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-reviewer_assessments_for.png]]&lt;br /&gt;
&lt;br /&gt;
==== metareviewed_by? ====&lt;br /&gt;
Returns whether the Response Map has been metareviewed&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-metareviewed_by.png]]&lt;br /&gt;
&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141254</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141254"/>
		<updated>2021-11-08T20:07:05Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* exports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
* get_all_versions&lt;br /&gt;
* contributor&lt;br /&gt;
* questionnaire&lt;br /&gt;
* get_title&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-export.jpg]]&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-export_fields.jpg]]&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-import.jpg]]&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview). The function sends an email to the participant when they have a new metareview to complete. We will test to make sure the email is sent to the correct participant.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-email.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
* self.assessments_for(team)&lt;br /&gt;
* comparator&lt;br /&gt;
* self.reviewer_assessments_for(team, reviewer)&lt;br /&gt;
* metareviewed_by?&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141253</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141253"/>
		<updated>2021-11-08T20:06:31Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* metareview_response_map_spec.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
* get_all_versions&lt;br /&gt;
* contributor&lt;br /&gt;
* questionnaire&lt;br /&gt;
* get_title&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-export.jpg]]&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-export_fields.jpg]]&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-import.jpg]]&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview). The function sends an email to the participant when they have a new metareview to complete. We will test to make sure the email is sent to the correct participant.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2170-email.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
* self.assessments_for(team)&lt;br /&gt;
* comparator&lt;br /&gt;
* self.reviewer_assessments_for(team, reviewer)&lt;br /&gt;
* metareviewed_by?&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-import.jpg&amp;diff=141250</id>
		<title>File:E2170-import.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-import.jpg&amp;diff=141250"/>
		<updated>2021-11-08T20:01:17Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: import function flowchart for metareview_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;import function flowchart for metareview_response_map.rb&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-export_fields.jpg&amp;diff=141249</id>
		<title>File:E2170-export fields.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-export_fields.jpg&amp;diff=141249"/>
		<updated>2021-11-08T20:00:45Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: export_fields function for metareview_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;export_fields function for metareview_response_map.rb&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-export.jpg&amp;diff=141248</id>
		<title>File:E2170-export.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-export.jpg&amp;diff=141248"/>
		<updated>2021-11-08T20:00:13Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: export function for metareview_response_map.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;export function for metareview_response_map.rb&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-email.jpg&amp;diff=141247</id>
		<title>File:E2170-email.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2170-email.jpg&amp;diff=141247"/>
		<updated>2021-11-08T19:59:36Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: email function in metareview_response_map&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;email function in metareview_response_map&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141245</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141245"/>
		<updated>2021-11-08T19:46:15Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* email */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
* get_all_versions&lt;br /&gt;
* contributor&lt;br /&gt;
* questionnaire&lt;br /&gt;
* get_title&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview). The function sends an email to the participant when they have a new metareview to complete. We will test to make sure the email is sent to the correct participant.&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
* self.assessments_for(team)&lt;br /&gt;
* comparator&lt;br /&gt;
* self.reviewer_assessments_for(team, reviewer)&lt;br /&gt;
* metareviewed_by?&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141243</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141243"/>
		<updated>2021-11-08T19:24:57Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* export_fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
* get_all_versions&lt;br /&gt;
* contributor&lt;br /&gt;
* questionnaire&lt;br /&gt;
* get_title&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly returned.&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview)&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
* self.assessments_for(team)&lt;br /&gt;
* comparator&lt;br /&gt;
* self.reviewer_assessments_for(team, reviewer)&lt;br /&gt;
* metareviewed_by?&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141242</id>
		<title>CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps&amp;diff=141242"/>
		<updated>2021-11-08T19:23:31Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* metareview_response_map_spec.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2170 which aims to adequately test several files regarding the ResponseMap model. Here is a description of what response maps do:&lt;br /&gt;
*In Expertiza, response maps establish a relationship between a reviewer, a reviewee, and an object to be reviewed.  The reviewer is an assignment_participant, the reviewee is an assignment_team, and the reviewed object is either an assignment or another response_map. Each (reviewer, reviewee) pair will have a separate response map. Every time a new review is performed (e.g, every round), a new Response object is created whose map_id is that response map.&lt;br /&gt;
&lt;br /&gt;
The breakdown of the ResponseMap model can be found [https://expertiza.csc.ncsu.edu/index.php/Response_maps here]. There are several types of ResponseMaps that extend functionality of the original ResponseMap. None of which including the superclass are adequately tested. These files include:&lt;br /&gt;
&lt;br /&gt;
* review_response_map.rb  &amp;lt;--------- 92.5% coverage&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map.rb &amp;lt;------ 23.08% coverage&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map.rb &amp;lt;- no coverage&lt;br /&gt;
&lt;br /&gt;
* response_map.rb &amp;lt;----------------- 74.47% coverage&lt;br /&gt;
&lt;br /&gt;
This project aims to get all the response maps to at least a 90% level of coverage for every Response Map file by writing unit tests for each uncovered method listed in the next section.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
* Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
* Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
* Quinn Dibble (qdibble)&lt;br /&gt;
&lt;br /&gt;
* Alex Carruth (agcarrut)&lt;br /&gt;
&lt;br /&gt;
== Test Files Involved ==&lt;br /&gt;
There are 4 test files involved in this project:&lt;br /&gt;
* review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* metareview_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* teammate_review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
* response_map_spec.rb&lt;br /&gt;
of these files, only review_response_map_spec.rb currently exists; the rest will be added.&lt;br /&gt;
&lt;br /&gt;
== Methods Tested Per File ==&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_spec.rb ===&lt;br /&gt;
Currently this file is 92.5% covered and there are no plans to cover it further.&lt;br /&gt;
&lt;br /&gt;
=== metareview_response_map_spec.rb ===&lt;br /&gt;
The functions for metareview_response_map.rb that will be tested are:&lt;br /&gt;
* get_all_versions&lt;br /&gt;
* contributor&lt;br /&gt;
* questionnaire&lt;br /&gt;
* get_title&lt;br /&gt;
====exports====&lt;br /&gt;
This function takes 3 parameters: csv (the csv file that will contain the exported metareview information), parent_id (the assignment ID containing the requested metareviews), and _options. The function sends all the information about the metareviews to a csv file. We will test that the information is properly exported to the csv file&lt;br /&gt;
&lt;br /&gt;
====export_fields====&lt;br /&gt;
Takes a parameter called &amp;quot;_options&amp;quot; that returns the three field columns associated with metareviews to be exported for use by other controllers. We will test to see that these three columns are properly exported.&lt;br /&gt;
&lt;br /&gt;
====import====&lt;br /&gt;
This function takes 3 parameters: row_hash (represents the hash of the metareview data we want to import), session, and id (representing the id of the assignment we want to import metareview data for). The function imports the data from the hash map, and if the information is input correctly, the data is extracted from the hash and creates a metareview for the requested assignment, otherwise it flashes an error saying the data was input incorrectly. We will test to make sure the imported data is properly converted into a metareview.&lt;br /&gt;
&lt;br /&gt;
====email====&lt;br /&gt;
This function takes 3 parameters: defn, _participant (the user who will be receiving the email), and assignment (the assignment associated with the metareview)&lt;br /&gt;
&lt;br /&gt;
=== teammate_review_response_map_spec.rb ===&lt;br /&gt;
The functions for teammate_review_response_map.rb that will be tested are:&lt;br /&gt;
==== questionnaire ====&lt;br /&gt;
This function searches for a TeammateReviewQuestionnaire object and returns it.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate review response map-questionnaire.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== get_title ====&lt;br /&gt;
This function returns the string &amp;quot;Teammate Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-get_title.png]]&lt;br /&gt;
&lt;br /&gt;
==== teammate_response_report ====&lt;br /&gt;
This function returns the teammate response report given the reviewer ID.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-teammate_response_report.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== email ====&lt;br /&gt;
This function sends a notification email to a student who has been reviewed by their teammate.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-teammate_review_response_map-email.png]]&lt;br /&gt;
&lt;br /&gt;
=== response_map_spec.rb ===&lt;br /&gt;
The functions for response_map.rb that will be tested are:&lt;br /&gt;
* self.assessments_for(team)&lt;br /&gt;
* comparator&lt;br /&gt;
* self.reviewer_assessments_for(team, reviewer)&lt;br /&gt;
* metareviewed_by?&lt;br /&gt;
==== assign_metareviewer ====&lt;br /&gt;
This function is in charge of assigning a metareviewer to this review (i.e. a reviewer to review the review).&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-assign_metareviewer.png]]&lt;br /&gt;
&lt;br /&gt;
==== find_team_member ====&lt;br /&gt;
This function returns the team that the reviewer is part of.&lt;br /&gt;
&lt;br /&gt;
[[File:E2170-response_map-find_team_member.png]]&lt;br /&gt;
&lt;br /&gt;
== Running Tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/&amp;lt;test file name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139818</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139818"/>
		<updated>2021-10-21T03:27:03Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method validates if the user is allowed to be redirected to the appropriate page. The task for this project is to add a captcha system before the user requests new. This happens when the user hits the &amp;quot;Request account&amp;quot; button on the login page. This project's repo already has the &amp;quot;recaptcha&amp;quot; gem installed. Future developers need to keep in mind that functionality of the captcha depends on the developer updating the site key and secret key of the Google ReCaptcha API. Installation of the gem and getting the key instructions can be found [https://github.com/ambethia/recaptcha here].&lt;br /&gt;
&lt;br /&gt;
There was one change to the frontend to display the captcha at _login.html.erb.&lt;br /&gt;
&lt;br /&gt;
'''Front end change /app/views/_login.html.erb'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
  &amp;lt;%= link_to &amp;quot;Request account&amp;quot;,{:controller =&amp;gt; 'account_request',:role =&amp;gt; &amp;quot;Instructor&amp;quot;, :action =&amp;gt; 'new'}, :class =&amp;gt; 'btn btn-danger', :style =&amp;gt; 'color:white;width:100%;margin-left:auto;margin-right:auto;' %&amp;gt;&lt;br /&gt;
  &amp;lt;div&amp;gt;&lt;br /&gt;
    &amp;lt;%= recaptcha_tags %&amp;gt;   &amp;lt;&amp;lt;--=-----displays recaptcha widget&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''action_allowed? changes'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def captcha_test&lt;br /&gt;
    valid = true&lt;br /&gt;
    @something&lt;br /&gt;
    if verify_recaptcha(model: @something) == true&lt;br /&gt;
      valid = true&lt;br /&gt;
    end&lt;br /&gt;
    return valid&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'list_pending_requested'&lt;br /&gt;
      current_user_has_admin_privileges?&lt;br /&gt;
    when 'new'&lt;br /&gt;
      captcha_test&lt;br /&gt;
    when 'create_requested_user_record'&lt;br /&gt;
      true&lt;br /&gt;
    when 'keys'&lt;br /&gt;
      current_user_has_student_privileges?&lt;br /&gt;
    else&lt;br /&gt;
      current_user_has_ta_privileges?&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
create_requested_user creates a new account request for a user (if they are not a duplicate user) so that it may be approved by a higher level user.&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_requested_user_record&lt;br /&gt;
  &lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model. &lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
&lt;br /&gt;
    user_existed = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    requested_user_saved = requested_user.save&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
&lt;br /&gt;
    if !user_existed and requested_user_saved&lt;br /&gt;
      super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
      super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_existed&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting has already existed in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
The new create_requested_user_record now only handles the different cases that can happen when a user requests an account (New user and request goes through, duplicate user and request doesn't go through, or some other error in the saving process. The new method save_requested_user creates the request object, validates it has all needed fields and tries to save it to the database. The new method notify_supers_new_request sends an email to the Super-Administrators that new user account request has been successfully created. Some variable names and error messages have been reworded to improve readability as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def create_requested_user_record&lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
    user_exists = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    requested_user_saved = save_requested_user(requested_user, params)&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
    if !user_exists and requested_user_saved&lt;br /&gt;
      notify_supers_new_request(requested_user)&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_exists&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting already exists in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def save_requested_user(requested_user, params)&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model.&lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    return requested_user.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def  notify_supers_new_request(requested_user)&lt;br /&gt;
    super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
    super_users.each do |super_user|&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
      prepared_mail.deliver&lt;br /&gt;
    end&lt;br /&gt;
    #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
    ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
    flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
    #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
12 out of 12 tests in the account_request_controller_spec.rb test file.&lt;br /&gt;
&lt;br /&gt;
Here is a image of our tests passing:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Passing Test.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139227</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139227"/>
		<updated>2021-10-19T23:29:21Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_requested_user_record&lt;br /&gt;
  &lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model. &lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
&lt;br /&gt;
    user_existed = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    requested_user_saved = requested_user.save&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
&lt;br /&gt;
    if !user_existed and requested_user_saved&lt;br /&gt;
      super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
      super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_existed&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting has already existed in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
12 out of 12 tests in the account_request_controller_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
Here is a image of our tests passing:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Passing Test.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139226</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139226"/>
		<updated>2021-10-19T23:29:00Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_requested_user_record&lt;br /&gt;
  &lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model. &lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
&lt;br /&gt;
    user_existed = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    requested_user_saved = requested_user.save&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
&lt;br /&gt;
    if !user_existed and requested_user_saved&lt;br /&gt;
      super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
      super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_existed&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting has already existed in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
12 out of 12 tests in the account_request_controller_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
Here is a image of our tests passing:&lt;br /&gt;
[[File:Passing Test.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139225</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139225"/>
		<updated>2021-10-19T23:28:30Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_requested_user_record&lt;br /&gt;
  &lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model. &lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
&lt;br /&gt;
    user_existed = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    requested_user_saved = requested_user.save&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
&lt;br /&gt;
    if !user_existed and requested_user_saved&lt;br /&gt;
      super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
      super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_existed&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting has already existed in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
12 out of 12 tests in the account_request_controller_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
Here is a image of our tests passing:&lt;br /&gt;
[[File:Passing Tests.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Passing_Test.jpg&amp;diff=139224</id>
		<title>File:Passing Test.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Passing_Test.jpg&amp;diff=139224"/>
		<updated>2021-10-19T23:27:42Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: Passing tests for account_request_controller&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Passing tests for account_request_controller&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139223</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139223"/>
		<updated>2021-10-19T23:26:40Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_requested_user_record&lt;br /&gt;
  &lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model. &lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
&lt;br /&gt;
    user_existed = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    requested_user_saved = requested_user.save&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
&lt;br /&gt;
    if !user_existed and requested_user_saved&lt;br /&gt;
      super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
      super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_existed&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting has already existed in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
12 out of 12 tests in the account_request_controller_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
Here is a image of our tests passing:&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139222</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139222"/>
		<updated>2021-10-19T23:19:22Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_requested_user_record&lt;br /&gt;
  &lt;br /&gt;
    requested_user = AccountRequest.new(requested_user_params)&lt;br /&gt;
    #An object is created with respect to AccountRequest model inorder to populate the users information when account is requested&lt;br /&gt;
&lt;br /&gt;
    if params[:user][:institution_id].empty?&lt;br /&gt;
      institution = Institution.find_or_create_by(name: params[:institution][:name])&lt;br /&gt;
      requested_user.institution_id = institution.id&lt;br /&gt;
    end&lt;br /&gt;
    #If user enters others and adds a new institution, an institution id will be created with respect to the institution model. &lt;br /&gt;
    #This institution_attribute will be added to the AccountRequest model under institution_id attribute!&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    requested_user.status = 'Under Review'&lt;br /&gt;
    #The status is by default 'Under Review' until the super admin approves or rejects&lt;br /&gt;
&lt;br /&gt;
    user_existed = User.find_by(name: requested_user.name) or User.find_by(name: requested_user.email)&lt;br /&gt;
    # default to instructor role&lt;br /&gt;
    if requested_user.role_id == nil&lt;br /&gt;
      requested_user.role_id = Role.where(:name =&amp;gt; &amp;quot;Instructor&amp;quot;)[0].id&lt;br /&gt;
    end&lt;br /&gt;
    requested_user_saved = requested_user.save&lt;br /&gt;
    #Stores a boolean value with respect to whether the user data is saved or not&lt;br /&gt;
&lt;br /&gt;
    if !user_existed and requested_user_saved&lt;br /&gt;
      super_users = User.joins(:role).where('roles.name = ?', 'Super-Administrator')&lt;br /&gt;
      super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user, requested_user, 'New account Request')&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      #Notifying an email to the administrator regarding the new user request!&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, requested_user.name, 'The account you are requesting has been created successfully.', request)&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully requested.&amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
      #Print out the acknowledgement message to the user and redirect to /instructors/home page when successful&lt;br /&gt;
&lt;br /&gt;
      return&lt;br /&gt;
    elsif user_existed&lt;br /&gt;
      flash[:error] = &amp;quot;The account you are requesting has already existed in Expertiza.&amp;quot;&lt;br /&gt;
      #If the user account already exists, log error to the user&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = requested_user.errors.full_messages.to_sentence&lt;br /&gt;
      #If saving in the AccountRequests model has failed&lt;br /&gt;
    end&lt;br /&gt;
    ExpertizaLogger.error LoggerMessage.new(controller_name, requested_user.name, flash[:error], request)&lt;br /&gt;
    redirect_to controller: 'account_request', action: 'new', role: 'Student'&lt;br /&gt;
    #if the first if clause fails, redirect back to the account requests page!&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139221</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139221"/>
		<updated>2021-10-19T23:18:20Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
==== Original Method ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored Method ====&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139220</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139220"/>
		<updated>2021-10-19T23:15:27Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
== Original Method ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Refactored Method ==&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_requested_user_record ===&lt;br /&gt;
&lt;br /&gt;
Method description here&lt;br /&gt;
&lt;br /&gt;
== Original Method ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Refactored Method ==&lt;br /&gt;
&lt;br /&gt;
Refactored method description here&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139219</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139219"/>
		<updated>2021-10-19T23:13:33Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: /* Refactored Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
== Original Method ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Refactored Method ==&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method called '''&amp;quot;user_new&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139218</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139218"/>
		<updated>2021-10-19T23:12:55Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
== Original Method ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        new_user = User.new&lt;br /&gt;
        new_user.name = requested_user.name&lt;br /&gt;
        new_user.role_id = requested_user.role_id&lt;br /&gt;
        new_user.institution_id = requested_user.institution_id&lt;br /&gt;
        new_user.fullname = requested_user.fullname&lt;br /&gt;
        new_user.email = requested_user.email&lt;br /&gt;
        new_user.parent_id = session[:user].id&lt;br /&gt;
        new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
        if new_user.save&lt;br /&gt;
          password = new_user.reset_password&lt;br /&gt;
          # Mail is sent to the user with a new password&lt;br /&gt;
          prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
          prepared_mail.deliver_now&lt;br /&gt;
          flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
          undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
          foreign&lt;br /&gt;
        end&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Refactored Method ==&lt;br /&gt;
&lt;br /&gt;
This method was refactored so the creation of the new user is handled in a separate method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    if params[:selection] == nil&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      redirect_to action: 'list_pending_requested'&lt;br /&gt;
      return &lt;br /&gt;
    end&lt;br /&gt;
    is_approved = (params[:commit] == &amp;quot;Accept&amp;quot;? &amp;quot;Approved&amp;quot; : &amp;quot;Rejected&amp;quot;)&lt;br /&gt;
    users = params[:selection]&lt;br /&gt;
    users.each do |user|&lt;br /&gt;
      requested_user = AccountRequest.find_by(id: user.first)&lt;br /&gt;
      requested_user.status = is_approved&lt;br /&gt;
      puts &amp;quot;Here&amp;quot;&lt;br /&gt;
      if requested_user.status.nil?&lt;br /&gt;
        flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
      elsif requested_user.update_attributes(params[:user])&lt;br /&gt;
        flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      if requested_user.status == &amp;quot;Approved&amp;quot;&lt;br /&gt;
        user_new(requested_user)&lt;br /&gt;
      elsif requested_user.status == &amp;quot;Rejected&amp;quot;&lt;br /&gt;
        # If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if requested_user.update_columns(status: is_approved)&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          # redirect_to action: 'list_pending_requested'&lt;br /&gt;
          # return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list_pending_requested'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def user_new(requested_user)&lt;br /&gt;
    puts requested_user.inspect&lt;br /&gt;
    new_user = User.new&lt;br /&gt;
    new_user.name = requested_user.name&lt;br /&gt;
    new_user.role_id = requested_user.role_id&lt;br /&gt;
    new_user.institution_id = requested_user.institution_id&lt;br /&gt;
    new_user.fullname = requested_user.fullname&lt;br /&gt;
    new_user.email = requested_user.email&lt;br /&gt;
    new_user.parent_id = session[:user].id&lt;br /&gt;
    new_user.timezonepref = User.find_by(id: new_user.parent_id).timezonepref&lt;br /&gt;
    if new_user.save&lt;br /&gt;
      password = new_user.reset_password&lt;br /&gt;
      # Mail is sent to the user with a new password&lt;br /&gt;
      prepared_mail = MailerHelper.send_mail_to_user(new_user, &amp;quot;Your Expertiza account and password have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
      prepared_mail.deliver_now&lt;br /&gt;
      flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
      undo_link(&amp;quot;The user \&amp;quot;#{requested_user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      foreign&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139217</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139217"/>
		<updated>2021-10-19T23:11:05Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create_approved_user ===&lt;br /&gt;
&lt;br /&gt;
This method allows a Super Admin to approve or reject new users, and gives them an error message if the incorrect steps are taken during that process&lt;br /&gt;
&lt;br /&gt;
== Original Method ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return an empty string when comment does not exist' do&lt;br /&gt;
      result = helper.list_hyperlink_submission(@response_map.id, @question.id)&lt;br /&gt;
      expect(result).to eq('')&lt;br /&gt;
    end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139216</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139216"/>
		<updated>2021-10-19T23:08:59Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Insert code here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== list_hyperlink_submission ===&lt;br /&gt;
&lt;br /&gt;
This method returns the hyperlink that the student submits. In this unit test, since the student does not submit a hyperlink, which means the comment does not exist, an empty string is expected to return.&lt;br /&gt;
&lt;br /&gt;
== original ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return an empty string when comment does not exist' do&lt;br /&gt;
      result = helper.list_hyperlink_submission(@response_map.id, @question.id)&lt;br /&gt;
      expect(result).to eq('')&lt;br /&gt;
    end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139215</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139215"/>
		<updated>2021-10-19T23:05:59Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return correct html a tag' do&lt;br /&gt;
      result = helper.list_review_submissions(@participant.id, @team.id, @response_map.id)&lt;br /&gt;
      expect(result).to start_with(&amp;quot;&amp;lt;a href&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    it 'should return an empty string when the file does not exist' do&lt;br /&gt;
      result = helper.list_review_submissions(@participant.id, @team.id, @response_map.id)&lt;br /&gt;
    expect(result).to eq('')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== list_hyperlink_submission ===&lt;br /&gt;
&lt;br /&gt;
This method returns the hyperlink that the student submits. In this unit test, since the student does not submit a hyperlink, which means the comment does not exist, an empty string is expected to return.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return an empty string when comment does not exist' do&lt;br /&gt;
      result = helper.list_hyperlink_submission(@response_map.id, @question.id)&lt;br /&gt;
      expect(result).to eq('')&lt;br /&gt;
    end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/majuabir/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139214</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139214"/>
		<updated>2021-10-19T22:59:43Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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 that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Description about project ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2132 which is adding unit tests for review_mapping_helper.rb. The ReviewMappingHelper works as a class that is responsible for mapping reviews and feedback to assignment teams and reviewers. Also, This helper class reports of the status of project reviews.&lt;br /&gt;
&lt;br /&gt;
=== Team ===&lt;br /&gt;
&lt;br /&gt;
Connor Smith (cpsmith6)&lt;br /&gt;
&lt;br /&gt;
Abir Majumder (aamajumd)&lt;br /&gt;
&lt;br /&gt;
Joshua Myers (jamyers3)&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
account_request_controller.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/account_request_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relevant Methods ==&lt;br /&gt;
&lt;br /&gt;
* action_allowed?&lt;br /&gt;
* create_approved_user&lt;br /&gt;
* create_requested_user_record&lt;br /&gt;
&lt;br /&gt;
=== list_review_submission ===&lt;br /&gt;
&lt;br /&gt;
This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with &amp;quot;&amp;lt;a href&amp;quot;. In the second test, since the file&lt;br /&gt;
does not exist, it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return correct html a tag' do&lt;br /&gt;
      result = helper.list_review_submissions(@participant.id, @team.id, @response_map.id)&lt;br /&gt;
      expect(result).to start_with(&amp;quot;&amp;lt;a href&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    it 'should return an empty string when the file does not exist' do&lt;br /&gt;
      result = helper.list_review_submissions(@participant.id, @team.id, @response_map.id)&lt;br /&gt;
    expect(result).to eq('')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== list_hyperlink_submission ===&lt;br /&gt;
&lt;br /&gt;
This method returns the hyperlink that the student submits. In this unit test, since the student does not submit a hyperlink, which means the comment does not exist, an empty string is expected to return.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return an empty string when comment does not exist' do&lt;br /&gt;
      result = helper.list_hyperlink_submission(@response_map.id, @question.id)&lt;br /&gt;
      expect(result).to eq('')&lt;br /&gt;
    end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== get_css_style_for_calibration_report ===&lt;br /&gt;
&lt;br /&gt;
The method transfers the variable diff, the difference between the student's and the instructor's answer into css style. A dictionary is created as dict = {0 =&amp;gt; 'c5',1 =&amp;gt; 'c4',2 =&amp;gt; 'c3',3 =&amp;gt; 'c2'}. In the first unit test, &amp;quot;0&amp;quot; set as the the diff is expected to return c5. In the second test, &amp;quot;-1&amp;quot; is a negative integer, so the absolute value is used to return c4. In the third test, since &amp;quot;6&amp;quot; is not in the key of dict, according to the function, it should return c1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    it 'should return correct css class' do&lt;br /&gt;
      css_class_0 = helper.get_css_style_for_calibration_report(0)&lt;br /&gt;
      css_class_1 = helper.get_css_style_for_calibration_report(-1)&lt;br /&gt;
      css_class_6 = helper.get_css_style_for_calibration_report(6)&lt;br /&gt;
      expect(css_class_0). to eq('c5')&lt;br /&gt;
      expect(css_class_1). to eq('c4')&lt;br /&gt;
      expect(css_class_6). to eq('c1')&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
34 out of 34 tests in the review_mapping_helper_spec.rb test file. &lt;br /&gt;
&lt;br /&gt;
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/2094/files here].&lt;br /&gt;
&lt;br /&gt;
URL link of video of review_mapping_helper_spec.rb tests running and passing:-  https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view&lt;br /&gt;
&lt;br /&gt;
=== Relevant Links ===&lt;br /&gt;
&lt;br /&gt;
Main Expertiza Repository can be found [https://github.com/expertiza/expertiza here].&lt;br /&gt;
&lt;br /&gt;
Our forked Repository can be found [https://github.com/ctripoll/expertiza/tree/beta here].&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139213</id>
		<title>CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2126._Refactor_account_request_controller.rb&amp;diff=139213"/>
		<updated>2021-10-19T22:54:13Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: Created page with &amp;quot;* CSC/ECE 517 Fall 2021 - E2126. Refactor account_request_controller.rb&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2021 - E2126. Refactor account_request_controller.rb]]&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021&amp;diff=139212</id>
		<title>CSC/ECE 517 Fall 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021&amp;diff=139212"/>
		<updated>2021-10-19T22:53:48Z</updated>

		<summary type="html">&lt;p&gt;Cpsmith6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - {$num}. {$desc.title}]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2128. Refactor student_quizzes_controller.rb &amp;amp; late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2132. Add tests cases for review mapping helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin_controller.rb and institution_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2142. Improve e-mail notifications]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2133. Write tests for popup_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2120. Refactor reputation_web_service_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2139. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2131. Improve assessment360_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2121. Refactor suggestion_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2126. Refactor account_request_controller.rb]]&lt;/div&gt;</summary>
		<author><name>Cpsmith6</name></author>
	</entry>
</feed>