<?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=Lsanche</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=Lsanche"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Lsanche"/>
	<updated>2026-07-14T00:53:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Lsanche&amp;diff=100616</id>
		<title>User:Lsanche</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Lsanche&amp;diff=100616"/>
		<updated>2015-12-18T06:17:19Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: Created page with &amp;quot;Edit Assignment&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Edit Assignment]]&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=98080</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=98080"/>
		<updated>2015-11-01T04:07:33Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Refactor get_content */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
'''About Expertiza'''&lt;br /&gt;
Expertiza is an open source project accomplished by NCState students. It was developed in Ruby on Rails. It has general features like forming teams, registering for topics in a project, uploading the final deliveries. After completing the project there is an option for submitting reviews as well and updating the reviews. There is an option for submitting new quizzes as well.&lt;br /&gt;
&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
'''What it does''':  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:Renamed &amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
==== Solution ====&lt;br /&gt;
Examining &amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; we were able to determine that it did the following two things:&lt;br /&gt;
# Set the &amp;lt;code&amp;gt;@prev&amp;lt;/code&amp;gt; variable to a relation of responses that correspond to the map id of the current response being created or edited.&lt;br /&gt;
# Set the &amp;lt;code&amp;gt;@review_scores&amp;lt;/code&amp;gt; variable to an Array version if the contents of &amp;lt;code&amp;gt;@prev&amp;lt;/code&amp;gt;.&lt;br /&gt;
Since the purpose of the code seemed to be to set variables, we renamed it to &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
We also simplified the method by using ActiveRecord::Relation's &amp;lt;code&amp;gt;to_a&amp;lt;/code&amp;gt; to convert the relation to an array.&lt;br /&gt;
There was some duplicate code in the &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt; function which we replaced with a call the &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
'''Solution summary'''&lt;br /&gt;
: The method &amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; was renamed to &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:The 100+-line method &amp;lt;code&amp;gt;rereview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
;Solution summary&lt;br /&gt;
: The method &amp;lt;code&amp;gt;rereview&amp;lt;/code&amp;gt; was deleted.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:There was not much actual overlap in these two methods. Minimal changes.&lt;br /&gt;
The ResponseController controller has an overall problem in that it knows too much about the subclasses of &amp;lt;code&amp;gt;ResponseMap&amp;lt;/code&amp;gt;. There is some major refactoring that needs to occur to clean up this controller's coupling with &amp;lt;code&amp;gt;ResponseMap&amp;lt;/code&amp;gt;'s subclasses. We made an attempt to do this, but it was just to large a change to accomplish in the time allotted.&lt;br /&gt;
&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:Authorization needs to be checked in the &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt; method instead of in &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; at the bottom of the file. &lt;br /&gt;
;Solution summary&lt;br /&gt;
:So the functionality is moved from &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt;. And also it is made sure  that no one other than the author of a review (or another team member, in the case of author feedback) can edit it and then removed the &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; method.&lt;br /&gt;
:Code before changing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 def action_allowed?&lt;br /&gt;
    current_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
 def redirect_when_disallowed(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
: Code after changing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'view','edit','delete','update'&lt;br /&gt;
      response = Response.find(params[:id])&lt;br /&gt;
       if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
        team = response.map.reviewer.team&lt;br /&gt;
        unless team.has_user session[:user]&lt;br /&gt;
          redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
        else&lt;br /&gt;
          return false&lt;br /&gt;
        end&lt;br /&gt;
        response.map.read_attribute(:type)&lt;br /&gt;
      end&lt;br /&gt;
      current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
    else&lt;br /&gt;
      current_user&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; is a complex method. It should be renamed to &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:The &amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; method was renamed &amp;lt;code&amp;gt;set_content&amp;lt;/code&amp;gt;, simplified, and documented with comments.&lt;br /&gt;
A review of the &amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; method showed that it's purpose was to '''set''' various variables for use by the response views. As such, we renamed this method &amp;lt;code&amp;gt;set_content&amp;lt;/code&amp;gt; to help clarify it's intent.&lt;br /&gt;
We also extracted methods for the more complicated variables into their own methods, making the &amp;lt;code&amp;gt;set_content&amp;lt;/code&amp;gt; method easy to understand at a glance.&lt;br /&gt;
&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:No SQL queries were identified. No changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Comparison of Original and Refactored Code==&lt;br /&gt;
&lt;br /&gt;
Major refactoring revolved around changing method names according to rails convention, using helper methods for avoiding duplication of code in controller methods.&lt;br /&gt;
&lt;br /&gt;
:Duplications in Code &lt;br /&gt;
::Original duplications : 172&lt;br /&gt;
::Post Refactoring : 21&lt;br /&gt;
&lt;br /&gt;
Code Complexity (Compared on Code Climate) &lt;br /&gt;
&lt;br /&gt;
'''Original ResponseController'''&amp;lt;ref name=&amp;quot;originalresponsecontroller&amp;gt;''Original responseController'' https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Code_climate_response.png]]&lt;br /&gt;
&lt;br /&gt;
'''Refactored Responsecontroller''' &amp;lt;ref name=&amp;quot;Refactoredresponsecontroller&amp;gt;''Refactored responseController'' https://github.com/viswaraavi/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Code_climate_expertiza.png]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Some functional tests are written for this class using Rspec and Factorygirls.&lt;br /&gt;
;To check these tests.&lt;br /&gt;
*clone the github repository link provided above &lt;br /&gt;
*run the command rspec spec/controllers/response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=98073</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=98073"/>
		<updated>2015-11-01T04:02:58Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* DRY create and update */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
'''About Expertiza'''&lt;br /&gt;
Expertiza is an open source project accomplished by NCState students. It was developed in Ruby on Rails. It has general features like forming teams, registering for topics in a project, uploading the final deliveries. After completing the project there is an option for submitting reviews as well and updating the reviews. There is an option for submitting new quizzes as well.&lt;br /&gt;
&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
'''What it does''':  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:Renamed &amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
==== Solution ====&lt;br /&gt;
Examining &amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; we were able to determine that it did the following two things:&lt;br /&gt;
# Set the &amp;lt;code&amp;gt;@prev&amp;lt;/code&amp;gt; variable to a relation of responses that correspond to the map id of the current response being created or edited.&lt;br /&gt;
# Set the &amp;lt;code&amp;gt;@review_scores&amp;lt;/code&amp;gt; variable to an Array version if the contents of &amp;lt;code&amp;gt;@prev&amp;lt;/code&amp;gt;.&lt;br /&gt;
Since the purpose of the code seemed to be to set variables, we renamed it to &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
We also simplified the method by using ActiveRecord::Relation's &amp;lt;code&amp;gt;to_a&amp;lt;/code&amp;gt; to convert the relation to an array.&lt;br /&gt;
There was some duplicate code in the &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt; function which we replaced with a call the &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
'''Solution summary'''&lt;br /&gt;
: The method &amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; was renamed to &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:The 100+-line method &amp;lt;code&amp;gt;rereview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
;Solution summary&lt;br /&gt;
: The method &amp;lt;code&amp;gt;rereview&amp;lt;/code&amp;gt; was deleted.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:There was not much actual overlap in these two methods. Minimal changes.&lt;br /&gt;
The ResponseController controller has an overall problem in that it knows too much about the subclasses of &amp;lt;code&amp;gt;ResponseMap&amp;lt;/code&amp;gt;. There is some major refactoring that needs to occur to clean up this controller's coupling with &amp;lt;code&amp;gt;ResponseMap&amp;lt;/code&amp;gt;'s subclasses. We made an attempt to do this, but it was just to large a change to accomplish in the time allotted.&lt;br /&gt;
&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:Authorization needs to be checked in the &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt; method instead of in &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; at the bottom of the file. &lt;br /&gt;
;Solution summary&lt;br /&gt;
:So the functionality is moved from &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt;. And also it is made sure  that no one other than the author of a review (or another team member, in the case of author feedback) can edit it and then removed the &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; method.&lt;br /&gt;
:Code before changing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 def action_allowed?&lt;br /&gt;
    current_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
 def redirect_when_disallowed(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
: Code after changing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'view','edit','delete','update'&lt;br /&gt;
      response = Response.find(params[:id])&lt;br /&gt;
       if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
        team = response.map.reviewer.team&lt;br /&gt;
        unless team.has_user session[:user]&lt;br /&gt;
          redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
        else&lt;br /&gt;
          return false&lt;br /&gt;
        end&lt;br /&gt;
        response.map.read_attribute(:type)&lt;br /&gt;
      end&lt;br /&gt;
      current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
    else&lt;br /&gt;
      current_user&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; is a complex method. It should be renamed to &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:The &amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; method was renamed &amp;lt;code&amp;gt;set_content&amp;lt;/code&amp;gt;, simplified, and documented with comments.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:No SQL queries were identified. No changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Comparison of Original and Refactored Code==&lt;br /&gt;
&lt;br /&gt;
Major refactoring revolved around changing method names according to rails convention, using helper methods for avoiding duplication of code in controller methods.&lt;br /&gt;
&lt;br /&gt;
:Duplications in Code &lt;br /&gt;
::Original duplications : 172&lt;br /&gt;
::Post Refactoring : 21&lt;br /&gt;
&lt;br /&gt;
Code Complexity (Compared on Code Climate) &lt;br /&gt;
&lt;br /&gt;
'''Original ResponseController'''&amp;lt;ref name=&amp;quot;originalresponsecontroller&amp;gt;''Original responseController'' https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Code_climate_response.png]]&lt;br /&gt;
&lt;br /&gt;
'''Refactored Responsecontroller''' &amp;lt;ref name=&amp;quot;Refactoredresponsecontroller&amp;gt;''Refactored responseController'' https://github.com/viswaraavi/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Code_climate_expertiza.png]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Some functional tests are written for this class using Rspec and Factorygirls.&lt;br /&gt;
;To check these tests.&lt;br /&gt;
*clone the github repository link provided above &lt;br /&gt;
*run the command rspec spec/controllers/response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=98067</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=98067"/>
		<updated>2015-11-01T03:59:48Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Refactor latestResponseVersion method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
'''About Expertiza'''&lt;br /&gt;
Expertiza is an open source project accomplished by NCState students. It was developed in Ruby on Rails. It has general features like forming teams, registering for topics in a project, uploading the final deliveries. After completing the project there is an option for submitting reviews as well and updating the reviews. There is an option for submitting new quizzes as well.&lt;br /&gt;
&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
'''What it does''':  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:Renamed &amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
==== Solution ====&lt;br /&gt;
Examining &amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; we were able to determine that it did the following two things:&lt;br /&gt;
# Set the &amp;lt;code&amp;gt;@prev&amp;lt;/code&amp;gt; variable to a relation of responses that correspond to the map id of the current response being created or edited.&lt;br /&gt;
# Set the &amp;lt;code&amp;gt;@review_scores&amp;lt;/code&amp;gt; variable to an Array version if the contents of &amp;lt;code&amp;gt;@prev&amp;lt;/code&amp;gt;.&lt;br /&gt;
Since the purpose of the code seemed to be to set variables, we renamed it to &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
We also simplified the method by using ActiveRecord::Relation's &amp;lt;code&amp;gt;to_a&amp;lt;/code&amp;gt; to convert the relation to an array.&lt;br /&gt;
There was some duplicate code in the &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt; function which we replaced with a call the &amp;lt;code&amp;gt;set_all_responses&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
'''Solution summary'''&lt;br /&gt;
: The method &amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; was renamed to &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:The 100+-line method &amp;lt;code&amp;gt;rereview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
;Solution summary&lt;br /&gt;
: The method &amp;lt;code&amp;gt;rereview&amp;lt;/code&amp;gt; was deleted.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:There was not much actual overlap in these two methods. Minimal changes.&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:Authorization needs to be checked in the &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt; method instead of in &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; at the bottom of the file. &lt;br /&gt;
;Solution summary&lt;br /&gt;
:So the functionality is moved from &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt;. And also it is made sure  that no one other than the author of a review (or another team member, in the case of author feedback) can edit it and then removed the &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; method.&lt;br /&gt;
:Code before changing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 def action_allowed?&lt;br /&gt;
    current_user&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
 def redirect_when_disallowed(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
: Code after changing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'view','edit','delete','update'&lt;br /&gt;
      response = Response.find(params[:id])&lt;br /&gt;
       if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
        team = response.map.reviewer.team&lt;br /&gt;
        unless team.has_user session[:user]&lt;br /&gt;
          redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
        else&lt;br /&gt;
          return false&lt;br /&gt;
        end&lt;br /&gt;
        response.map.read_attribute(:type)&lt;br /&gt;
      end&lt;br /&gt;
      current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
    else&lt;br /&gt;
      current_user&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; is a complex method. It should be renamed to &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:The &amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; method was renamed &amp;lt;code&amp;gt;set_content&amp;lt;/code&amp;gt;, simplified, and documented with comments.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:No SQL queries were identified. No changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Comparison of Original and Refactored Code==&lt;br /&gt;
&lt;br /&gt;
Major refactoring revolved around changing method names according to rails convention, using helper methods for avoiding duplication of code in controller methods.&lt;br /&gt;
&lt;br /&gt;
:Duplications in Code &lt;br /&gt;
::Original duplications : 172&lt;br /&gt;
::Post Refactoring : 21&lt;br /&gt;
&lt;br /&gt;
Code Complexity (Compared on Code Climate) &lt;br /&gt;
&lt;br /&gt;
'''Original ResponseController'''&amp;lt;ref name=&amp;quot;originalresponsecontroller&amp;gt;''Original responseController'' https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Code_climate_response.png]]&lt;br /&gt;
&lt;br /&gt;
'''Refactored Responsecontroller''' &amp;lt;ref name=&amp;quot;Refactoredresponsecontroller&amp;gt;''Refactored responseController'' https://github.com/viswaraavi/expertiza&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Code_climate_expertiza.png]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Some functional tests are written for this class using Rspec and Factorygirls.&lt;br /&gt;
;To check these tests.&lt;br /&gt;
*clone the github repository link provided above &lt;br /&gt;
*run the command rspec spec/controllers/response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97366</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97366"/>
		<updated>2015-10-30T20:11:15Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:The 100+-line method &amp;lt;code&amp;gt;rearview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
;Solution summary&lt;br /&gt;
: The method &amp;lt;code&amp;gt;rearview&amp;lt;/code&amp;gt; was deleted.&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:There was not much actual overlap in these two methods. Minimal changes.&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:Authorization needs to be checked in the &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt; method instead of in &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; method.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; is a complex method. It should be renamed to &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:The &amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; method was renamed &amp;lt;code&amp;gt;set_content&amp;lt;/code&amp;gt;, simplified, and documented with comments.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
;Solution summary&lt;br /&gt;
:No SQL queries were identified. No changes.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97365</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97365"/>
		<updated>2015-10-30T20:07:30Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Refactor get_content */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
The 100+-line method &amp;lt;code&amp;gt;rearview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
Authorization needs to be checked in the &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt; method instead of in &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
&amp;lt;code&amp;gt;get_content&amp;lt;/code&amp;gt; is a complex method. It should be renamed to &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97364</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97364"/>
		<updated>2015-10-30T20:06:05Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Consistent authorization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
The 100+-line method &amp;lt;code&amp;gt;rearview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
Authorization needs to be checked in the &amp;lt;code&amp;gt;action_allowed&amp;lt;/code&amp;gt; method instead of in &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the &amp;lt;code&amp;gt;redirect_when_disallowed&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97363</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97363"/>
		<updated>2015-10-30T20:05:35Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* DRY create and update */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
The 100+-line method &amp;lt;code&amp;gt;rearview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
&amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;update&amp;lt;/code&amp;gt; use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
Authorization needs to be checked in the action_allowed method instead of in redirect_when_disallowed at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the redirect_when_disallowed method.&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97362</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97362"/>
		<updated>2015-10-30T20:05:07Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Delete rereview method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
The 100+-line method &amp;lt;code&amp;gt;rearview&amp;lt;/code&amp;gt; does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
create and update use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
Authorization needs to be checked in the action_allowed method instead of in redirect_when_disallowed at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the redirect_when_disallowed method.&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97361</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97361"/>
		<updated>2015-10-30T20:03:28Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;latestResponseVersion&amp;lt;/code&amp;gt; is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
=== Rename get_scores ===&lt;br /&gt;
;Problem definition&lt;br /&gt;
:&amp;lt;code&amp;gt;get_scores&amp;lt;/code&amp;gt; has a Java-like name.  It should just be &amp;lt;code&amp;gt;scores&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
The 100+-line method rereview does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
create and update use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
Authorization needs to be checked in the action_allowed method instead of in redirect_when_disallowed at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the redirect_when_disallowed method.&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97360</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97360"/>
		<updated>2015-10-30T19:57:14Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
=== Refactor latestResponseVersion method ===&lt;br /&gt;
latestResponseVersion is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
get_scores has a Java-like name.  It should just be scores.&lt;br /&gt;
=== Delete rereview method ===&lt;br /&gt;
The 100+-line method rereview does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
=== DRY create and update ===&lt;br /&gt;
create and update use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
=== Consistent authorization ===&lt;br /&gt;
Authorization needs to be checked in the action_allowed method instead of in redirect_when_disallowed at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the redirect_when_disallowed method.&lt;br /&gt;
=== Refactor get_content ===&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands. &lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97358</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97358"/>
		<updated>2015-10-30T19:54:18Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* ResponseController */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
The ResponseController manages Responses.&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands. &lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
latestResponseVersion is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
get_scores has a Java-like name.  It should just be scores.&lt;br /&gt;
The 100+-line method rereview does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
create and update use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
Authorization needs to be checked in the action_allowed method instead of in redirect_when_disallowed at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the redirect_when_disallowed method.&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97357</id>
		<title>CSC/ECE 517 Fall 2015/oss E1551 RGS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1551_RGS&amp;diff=97357"/>
		<updated>2015-10-30T19:53:10Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: Created page with &amp;quot;= E1551. Refactoring response_controller.rb = == Expertiza == == ResponseController == == Changes ==  === Remove SQL queries === This class contains SQL queries.  Please change t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= E1551. Refactoring response_controller.rb =&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
== ResponseController ==&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Remove SQL queries ===&lt;br /&gt;
This class contains SQL queries.  Please change them to Active Record commands. &lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
Contact: Ed Gehringer, efg@ncsu.edu&lt;br /&gt;
What it does:  response_controller.rb manages Responses.  A Response is what is generated any time a user fills out a rubric--any rubric.  This includes review rubrics, author-feedback rubrics, teammate-review rubrics, quizzes, and surveys.&lt;br /&gt;
Responses come in versions.  Any time an author revises work, and the reviewer comes back to review it, a new Response object is generated.  This Response object points to a particular ReponseMap, which tells who the reviewer is, which team is the reviewee, and what the reviewed entity is.&lt;br /&gt;
What needs to be done:&lt;br /&gt;
latestResponseVersion is misnamed.  It returns all versions of a response, and anyway, the method name should use underscores, not camelcase.&lt;br /&gt;
get_scores has a Java-like name.  It should just be scores.&lt;br /&gt;
The 100+-line method rereview does not seem to be used anymore.  The second-round review can be invoked in the same way as the first-round review.  Remove it.&lt;br /&gt;
create and update use completely different code.  Factor the common parts out into a partial, thereby simplifying the methods.&lt;br /&gt;
Authorization needs to be checked in the action_allowed method instead of in redirect_when_disallowed at the bottom of the file.  After you move the functionality, check to make sure that no one other than the author of a review (or another team member, in the case of author feedback) can edit it, then remove the redirect_when_disallowed method.&lt;br /&gt;
get_content is a complex method. It should be renamed to content and simplified.  Comments should be added explaining what it does.&lt;br /&gt;
Please write some functional tests for this class.&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97352</id>
		<title>CSC/ECE 517 Fall 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015&amp;diff=97352"/>
		<updated>2015-10-30T19:20:30Z</updated>

		<summary type="html">&lt;p&gt;Lsanche: /* Writing Assignment 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1558BGJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1502/AAAASS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss/M1503/IntegrateXMLParser]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1568BZHXJS]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/ossE1572VGA]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2015/oss_E1573_sap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1559 rrz]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1570 avr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1556 CHM]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1504 JJD]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1562 APS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss M1501 GSN]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1551 RGS]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1555 GMR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1552 NRR]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1565 AAJ]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2015/oss E1561 WZL]]&lt;/div&gt;</summary>
		<author><name>Lsanche</name></author>
	</entry>
</feed>