<?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=Dyang23</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=Dyang23"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dyang23"/>
	<updated>2026-05-12T00:46:31Z</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_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=137786</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=137786"/>
		<updated>2020-11-24T15:14:16Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Files Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza. In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementations===&lt;br /&gt;
Revision planning has been implemented twice before, once in [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875] and once in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016]. While the functionality worked and effectively minimized changes to the code, they also had the following problems:&lt;br /&gt;
*Hardcoded “round” numbers in many places of the code.&lt;br /&gt;
*Documentation does not reflect the new changes they made.&lt;br /&gt;
*Revision planning responses and responses to the other items are not distinguished in heatgrid view.&lt;br /&gt;
*The idea of adding a &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; field to each question is intuitive. However, they failed to come up with a clean implementation of this idea. Specifically, they had passed some trailing parameters several methods down before reaching the place that needs them.&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
To implement revision planning, [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016] added &amp;lt;code&amp;gt;is_revision_planning_enabled&amp;lt;/code&amp;gt; (Boolean) to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Question&amp;lt;/code&amp;gt;. Adding a Boolean to enable revision planning for an assignment makes sense, but having certain questions belong to a team is not a clean implementation. Instead, we will create a new questionnaire that will belong to each team and keep track of the set of questions. We will use this new questionnaire to separate the revision plan responses and responses to other items in heat-grid view by creating a different table for each.&lt;br /&gt;
&lt;br /&gt;
===Files Modified===&lt;br /&gt;
This is a list of files modified and added. The list will be updated as the implementation progresses.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Changed'':&amp;lt;br&amp;gt;&lt;br /&gt;
*app/controllers/advice_controller.rb&lt;br /&gt;
*app/controllers/grades_controller.rb&lt;br /&gt;
*app/controllers/questionnaires_controller.rb&lt;br /&gt;
*app/controllers/questions_controller.rb&lt;br /&gt;
*app/controllers/response_controller.rb &lt;br /&gt;
*app/controllers/student_task_controller.rb&lt;br /&gt;
*app/helpers/summary_helper.rb &lt;br /&gt;
*app/helpers/grades_helper.rb&lt;br /&gt;
*app/models/questionnaire.rb &lt;br /&gt;
*app/models/response.rb&lt;br /&gt;
*app/models/student_task.rb&lt;br /&gt;
*app/models/vm_question_response.rb&lt;br /&gt;
*app/models/on_the_fly_calc.rb&lt;br /&gt;
*app/views/advice/edit_advice.html.erb&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb&lt;br /&gt;
*app/views/grades/view_team.html.erb&lt;br /&gt;
*app/views/questionnaires/_questionnaire.html.erb &lt;br /&gt;
*app/views/response/response.html.erb&lt;br /&gt;
*app/views/student_task/view.html.erb &lt;br /&gt;
*config/routes.rb &lt;br /&gt;
*db/schema.rb&lt;br /&gt;
*spec/controllers/response_controller_spec.rb&lt;br /&gt;
*spec/models/response_spec.rb&lt;br /&gt;
*spec/models/review_response_map_spec.rb&lt;br /&gt;
*spec/features/assignment_creation_general_tab_spec.rb &lt;br /&gt;
&lt;br /&gt;
''Added'':&amp;lt;br&amp;gt;&lt;br /&gt;
*app/controllers/revision_plan_questionnaires_controller.rb &lt;br /&gt;
*app/models/revision_plan_questionnaire.rb&lt;br /&gt;
*app/models/revision_plan_team_map.rb&lt;br /&gt;
*app/views/questionnaires/_questions.html.erb&lt;br /&gt;
*app/views/revision_plan_questionnaires/edit.html.erb &lt;br /&gt;
*db/migrate/20201106020642_create_revision_plan_team_maps.rb /&lt;br /&gt;
*db/migrate/20201105023711_add_is_revison_planning_enabled_to_assignments.rb&lt;br /&gt;
*spec/controllers/revision_plan_questionnaires_controller_spec.rb&lt;br /&gt;
*spec/factories/revision_plan_factory.rb&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
Items in green are additions.&lt;br /&gt;
[[File:E2083_Proposed_Design.png|1000px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Changes:&lt;br /&gt;
*In the assignment table we have added &amp;lt;code&amp;gt;is_revision_planning_enabled?&amp;lt;/code&amp;gt; column to indicate whether the assignment accepts a revision plan along with review rubric.&lt;br /&gt;
*&amp;lt;code&amp;gt;RevisionPlanTeamMap&amp;lt;/code&amp;gt; maps a questionnaire to an assignment team and round. This will map to a questionnaire of type revision plan that will be created by the revewee.&lt;br /&gt;
*&amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; extends &amp;lt;code&amp;gt;Questionnaire&amp;lt;/code&amp;gt; using single table inheritance.&lt;br /&gt;
&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Enable Revision Planning====&lt;br /&gt;
In order to enable '''Revision Planning''', the setting must be enabled when creating or editing an assignment under the '''General''' tab.  The wireframe below demonstrates creating an assignment, and editing the assignment functions similarly.  '''Revision plan?''' should be checked to enable this option. &lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Enable_Revision_Planning_Wireframe.png|700px|thumb|center|Wireframe of Enabling Assignment's Revision Planning]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Create_New_Assignment.png|700px|thumb|center|Create New Assignment page in the UI, with added Revision Planning checkbox]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
* Added a Boolean field &amp;lt;code&amp;gt;is_revision_planning_enabled&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; that saves whether revision planning is enabled.&lt;br /&gt;
''db/migrate/20201105023711_add_is_revison_planning_enabled_to_assignments.rb'' &lt;br /&gt;
&lt;br /&gt;
    class AddIsRevisonPlanningEnabledToAssignments &amp;lt; ActiveRecord::Migration&lt;br /&gt;
      def change&lt;br /&gt;
        add_column :assignments, :is_revision_planning_enabled, :boolean, default: false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
* Add checkbox to enable revision planning in edit assignment view.&lt;br /&gt;
''app/views/assignments/edit/_general.html.erb''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td style='padding:5px' id='assignment_revison_planning_field'&amp;gt;&lt;br /&gt;
      &amp;lt;input name=&amp;quot;assignment_form[assignment][is_revision_planning_enabled]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;%= check_box_tag('assignment_form[assignment][is_revision_planning_enabled]', 'true', @assignment_form.assignment.is_revision_planning_enabled) %&amp;gt;&lt;br /&gt;
      &amp;lt;%= label_tag('assignment_form[assignment][is_revision_planning_enabled]', 'Revision Planning?') %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to the ‘Revision planning page’.&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Link_to_the_revision_planning.jpeg|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Revision_Planning_Link.png|600px|thumb|center|Submit or Review Work page demonstrating added Revision Planning link]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
* Show link to revision planning page when revision planning is enabled for an assignment, round 1 has passed and current stage is submission. &lt;br /&gt;
&lt;br /&gt;
In order to check if a team is allowed to submit a revision plan &amp;lt;code&amp;gt;@can_submit_revision_plan&amp;lt;/code&amp;gt; field is added to &amp;lt;code&amp;gt;StudentTaskController&amp;lt;/code&amp;gt;'s view action. If a revision plan questionnaire (&amp;lt;code&amp;gt;@revision_plan_questionnaire_id&amp;lt;/code&amp;gt;) exists for the current round then clicking the link performs &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;'s edit action else new action is performed.&lt;br /&gt;
&lt;br /&gt;
''app/views/student_task/view.html.erb'' &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @team &amp;amp;&amp;amp; @assignment.is_revision_planning_enabled %&amp;gt;&lt;br /&gt;
    &amp;amp;lt;li&amp;amp;gt;&lt;br /&gt;
      &amp;lt;% if @can_submit_revision_plan %&amp;gt;&lt;br /&gt;
        &amp;lt;% if @revision_plan_questionnaire_id %&amp;gt;&lt;br /&gt;
          &amp;lt;%= link_to &amp;quot;Revision Planning&amp;quot;, controller: 'revision_plan_questionnaires', action: 'edit', id: @revision_plan_questionnaire_id %&amp;gt; &lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;%= link_to &amp;quot;Revision Planning&amp;quot;, controller: 'revision_plan_questionnaires', action: 'new', team_id: @team %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        (Add new questions to next-round rubric)&lt;br /&gt;
      &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;amp;lt;font color=&amp;quot;gray&amp;quot;&amp;amp;gt;Revision Planning&amp;amp;lt;/font&amp;amp;gt; (You are not allowed to submit your revison plan right now)&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
  &amp;lt;%end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''app/controllers/student_task_controller.rb'' &lt;br /&gt;
 &lt;br /&gt;
  def view&lt;br /&gt;
    student_task = StudentTask.from_participant_id params[:id]&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    # Revision plan feature&lt;br /&gt;
    @can_submit_revision_plan = student_task.can_submit_revision_plan?&lt;br /&gt;
    @revision_plan_questionnaire_id = student_task.revision_plan_questionnaire_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/student_task.rb''&lt;br /&gt;
&lt;br /&gt;
  def current_round&lt;br /&gt;
    assignment.number_of_current_round(@topic.try(:id))&lt;br /&gt;
  end&lt;br /&gt;
  def can_submit_revision_plan?&lt;br /&gt;
    current_stage == 'submission' &amp;amp;&amp;amp; current_round &amp;gt; 1&lt;br /&gt;
  end&lt;br /&gt;
  def revision_plan_questionnaire_id&lt;br /&gt;
    RevisionPlanTeamMap.find_by(team: @participant.team, used_in_round: current_round).try(:questionnaire_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking '''Remove''' in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods. &lt;br /&gt;
 &lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|500px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Edit_Revision_Plan.png|700px|thumb|center|Edit Revision Plan page demonstrating added view]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
* Create a model RevisionPlanTeamMap that maps a revision plan to a team and stores information of the round it is used in.&lt;br /&gt;
&lt;br /&gt;
''/app/models/revision_plan_team_map.rb''&lt;br /&gt;
&lt;br /&gt;
  class RevisionPlanTeamMap &amp;lt; ActiveRecord::Base&lt;br /&gt;
    belongs_to :team&lt;br /&gt;
    belongs_to :questionnaire&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''/db/migrate/20201106020642_create_revision_plan_team_maps.rb'' &lt;br /&gt;
&lt;br /&gt;
  class CreateRevisionPlanTeamMaps &amp;lt; ActiveRecord::Migration&lt;br /&gt;
    def change&lt;br /&gt;
      create_table :revision_plan_team_maps do |t|&lt;br /&gt;
        t.references :team, index: true, foreign_key: true&lt;br /&gt;
        t.references :questionnaire, index: true, foreign_key: true&lt;br /&gt;
        t.integer :used_in_round&lt;br /&gt;
        t.timestamps null: false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Create a Revision Plan Questionnaire Model and Controller&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SidharthMehta/expertiza/blob/1b54cf6c7aa2b1195c5259a4ee616f21fc2f37a3/app/models/revision_plan_questionnaire.rb ''app/models/revision_plan_questionnaire.rb'']&lt;br /&gt;
&lt;br /&gt;
Added a model for revision plan questionnaire. The code provides method to get questionnaire for a current round based on team.&lt;br /&gt;
&lt;br /&gt;
  def self.get_questionnaire_for_current_round(team_id)&lt;br /&gt;
    assignment_team = Team.find(team_id)&lt;br /&gt;
    assignment = assignment_team.assignment&lt;br /&gt;
    current_round = assignment.number_of_current_round(assignment_team.topic)&lt;br /&gt;
    questionnaire = RevisionPlanTeamMap.find_by(team: assignment_team, used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
    unless questionnaire&lt;br /&gt;
      questionnaire = RevisionPlanQuestionnaire.new&lt;br /&gt;
      questionnaire.name = 'Revision Plan Questionnaire'&lt;br /&gt;
      questionnaire.instructor_id = assignment.instructor_id&lt;br /&gt;
      questionnaire.max_question_score = 5&lt;br /&gt;
      questionnaire.save&lt;br /&gt;
      questionnaire_team_map = RevisionPlanTeamMap.create(team_id: assignment_team.id, used_in_round: current_round, questionnaire_id: questionnaire.id)&lt;br /&gt;
    end&lt;br /&gt;
    return questionnaire&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method returns the team associated to a revision plan questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def team&lt;br /&gt;
    revision_plan_team_map.team&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Added a new type of questionnaire &amp;lt;code&amp;gt;'RevisionPlanQuestionnaire'&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;QUESTIONNAIRE_TYPES&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  QUESTIONNAIRE_TYPES = ['ReviewQuestionnaire',&lt;br /&gt;
                        ...&lt;br /&gt;
                        ...&lt;br /&gt;
                         'RevisionPlanQuestionnaire'].freeze&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SidharthMehta/expertiza/blob/1b54cf6c7aa2b1195c5259a4ee616f21fc2f37a3/app/controllers/revision_plan_questionnaires_controller.rb ''app/controllers/revision_plan_questionnaires_controller.rb'']&lt;br /&gt;
&lt;br /&gt;
Added a controller &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;. The controller derives from &amp;lt;code&amp;gt;QuestionnairesController&amp;lt;/code&amp;gt;, it overrides the &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; action to allow creation of a &amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; for a &amp;lt;code&amp;gt;team&amp;lt;/code&amp;gt;. It also updates permissions for controller.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'edit'&lt;br /&gt;
      questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
      questionnaire.team.users.collect { |u| u.id }.include? session[:user].id || super&lt;br /&gt;
      (user_logged_in? &amp;amp;&amp;amp; questionnaire.team.users.collect { |u| u.id }.include?(session[:user].id)) || super&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    begin&lt;br /&gt;
      questionnaire = RevisionPlanQuestionnaire.get_questionnaire_for_current_round(params[:team_id])&lt;br /&gt;
      redirect_to action: 'edit', id: questionnaire.id&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      flash[:error] = $ERROR_INFO&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''config/routes.rb'' &lt;br /&gt;
&lt;br /&gt;
Add routes for &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  resources :revision_plan_questionnaires, controller: :revision_plan_questionnaires, only: %i[new edit update] do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :add_new_questions&lt;br /&gt;
      post :save_all_questions&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Add a view to edit Revision Plan&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/blob/d97eb1c1fc8d578b18f51401dc713b0d04815fe4/app/views/revision_plan_questionnaires/edit.html.erb ''app/views/revision_plan_questionnaires/edit.html.erb'']&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= render :partial =&amp;gt; 'question_weight' %&amp;gt;&lt;br /&gt;
  &amp;amp;lt;h1&amp;amp;gt;Edit &amp;lt;%= @questionnaire.display_type %&amp;gt;&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
  &amp;lt;%= render :partial =&amp;gt; 'questions' %&amp;gt;&lt;br /&gt;
  &amp;amp;lt;br /&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;a href=&amp;quot;javascript:window.history.back()&amp;quot;&amp;amp;gt;Back&amp;amp;lt;/a&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactor code to display questions into a partial. Allows for code reuse.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/questionnaires_controller.rb''&lt;br /&gt;
&lt;br /&gt;
Updated &amp;lt;code&amp;gt;redirect_to&amp;lt;/code&amp;gt; links for &amp;lt;code&amp;gt;add_new_questions&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;save_all_questions&amp;lt;/code&amp;gt; methods.&lt;br /&gt;
&lt;br /&gt;
  redirect_to action: 'edit', id: questionnaire_id.to_sym&lt;br /&gt;
&lt;br /&gt;
''app/views/questionnaires/_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
This file generates a view to edit/create a new questionnaire. It has functionality to display questions and some functions that are not needed for revision plan questionnaire. To enable code reuse the functionality to add/edit/remove/save questions was moved to a new partial ''app/views/questionnaires/_questions.html.erb''.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/blob/d97eb1c1fc8d578b18f51401dc713b0d04815fe4/app/views/questionnaires/_questions.html.erb ''app/views/questionnaires/_questions.html.erb'']&lt;br /&gt;
&lt;br /&gt;
*Add code to allow users to delete questions from revision plan questionnaire.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/questions_controller.rb ''&lt;br /&gt;
&lt;br /&gt;
Update authorization code to allow a user to remove questions from his teams revision plan.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    if ['destroy'].include?(params[:action])&lt;br /&gt;
      question = Question.find(params[:id])&lt;br /&gt;
      if(user_logged_in? &amp;amp;&amp;amp; question.questionnaire.owner?(session[:user].id))&lt;br /&gt;
        return true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    current_user_has_ta_privileges?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def destroy&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    if(question.questionnaire.type == 'RevisionPlanQuestionnaire')&lt;br /&gt;
      redirect_to edit_revision_plan_questionnaire_path(questionnaire_id.to_s.to_sym)&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to edit_questionnaire_path(questionnaire_id.to_s.to_sym)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Method returns true if user owns questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def owner?(user_id)&lt;br /&gt;
    instructor_id == user_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/revision_plan_questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Overrides implementation for &amp;lt;code&amp;gt;owner?&amp;lt;/code&amp;gt; defined in &amp;lt;code&amp;gt;Questionnaire&amp;lt;/code&amp;gt; to return true if a team owns the questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def owner?(user_id)&lt;br /&gt;
    team.users.map{ |u| u.id }.include?(user_id) || super&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Add code to allow users to access show/edit advice functionality for revision plan questions.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/advice_controller.rb''&lt;br /&gt;
&lt;br /&gt;
Update authorization code to allow a user to update advice his teams revision plan.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if(user_logged_in? &amp;amp;&amp;amp; questionnaire.owner?(session[:user].id))&lt;br /&gt;
      return true&lt;br /&gt;
    end&lt;br /&gt;
    current_user_has_ta_privileges?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/views/advice/edit_advice.html.erb''&lt;br /&gt;
&lt;br /&gt;
Update 'Back to questionnaire' link.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @questionnaire.type == 'RevisionPlanQuestionnaire'%&amp;gt;&lt;br /&gt;
    &amp;lt;%= link_to 'Back to questionnaire', :controller =&amp;gt; 'revision_plan_questionnaires', :action =&amp;gt; 'edit', :id =&amp;gt; @questionnaire.id %&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= link_to 'Back to questionnaire', :controller =&amp;gt; 'questionnaires', :action =&amp;gt; 'edit', :id =&amp;gt; @questionnaire.id %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Reviewing an Assignment====&lt;br /&gt;
Once the Revision Plan Questionnaire and its resubmission round have been finished, the Revision Plan Questionnaire is appended to the Assignment Questionnaire for that round.&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Review_Wireframe.png|400px|thumb|center|Wireframe of Completing a Review for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Revision_Plan_Questionnaire.png|400px|thumb|center|Review page demonstrating added Revision Plan questions]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
*Add Revision Plan questions to Response&lt;br /&gt;
&lt;br /&gt;
''app/controllers/response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
This methods gets questions sorted by sequence from review and revision questionnaire and merges them in a single list.&lt;br /&gt;
&lt;br /&gt;
  def set_questions_for_new_response&lt;br /&gt;
    @questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    if(@assignment &amp;amp;&amp;amp; @assignment.is_revision_planning_enabled)&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @revision_plan_questionnaire = RevisionPlanTeamMap.find_by(team_id: @map.reviewee_id, used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
      if(@revision_plan_questionnaire)&lt;br /&gt;
        @questions += sort_questions(@revision_plan_questionnaire.questions)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    return @questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method gets questions from a response instead of questionnaire. We use this when response has already been created.&lt;br /&gt;
&lt;br /&gt;
  def set_questions&lt;br /&gt;
    @questions = @response.get_questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
 &lt;br /&gt;
Added a method to get all the questionnaires for a response, response is a collection of answers. Answers contain reference to their question, and question have a reference to questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def questionnaires_by_answers(answers)&lt;br /&gt;
    answers_with_questionnaires = answers.select{ |ans|  ans &amp;amp;&amp;amp; ans.question &amp;amp;&amp;amp; ans.question.questionnaire }&lt;br /&gt;
    questionnaires = answers_with_questionnaires.collect{ |ans| ans.question.questionnaire }.uniq&lt;br /&gt;
    unless(questionnaires.any?)&lt;br /&gt;
      questionnaires = []&lt;br /&gt;
      questionnaires &amp;lt;&amp;lt; questionnaire_by_answer(answers.first)&lt;br /&gt;
    end&lt;br /&gt;
    questionnaires&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method gets all the questions for a response.&lt;br /&gt;
&lt;br /&gt;
  def get_questions&lt;br /&gt;
    @questions = []&lt;br /&gt;
    questionnaires = questionnaires_by_answers(scores)&lt;br /&gt;
    questionnaires.each {|questionnaire| @questions += questionnaire.questions }&lt;br /&gt;
    return @questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Separating questions by their questionnaire type&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;construct_review_response&amp;lt;/code&amp;gt; method has been updated to create separate tables for review questions, revision questions and additional comment.&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Add a method to check if heading is to be displayed for the questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def display_heading?&lt;br /&gt;
    return false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/revision_plan_questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Overriding the method defined in questionnaire.rb to display heading for revision plan questionnaire.&lt;br /&gt;
 &lt;br /&gt;
  def display_heading?&lt;br /&gt;
    return true&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/views/response/response.html.erb''&lt;br /&gt;
&lt;br /&gt;
View groups questions by questionnaire type and then adds a heading for questionnaires that return true for &amp;lt;code&amp;gt;display_heading?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Bug fix:''' The existing implementation has a bug where the first question in a questionnaire is displayed last in response. This was fixed as well.&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant is able to view their team's score.  The UI below shows what this looks like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor are shown under '''Assignment Questionnaire.'''  The results of the questions created by the team are shown under '''Improvement Plan.'''&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Summary_Report.png|600px|thumb|center|Summary Report page demonstrating added Revision Plan heatgrid]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
*Show revision plan questions in heat grid.&lt;br /&gt;
&lt;br /&gt;
Heat grids for review responses are currently implemented in a view model defined in ''vm_question_response.rb''.  All functionality of this view model has remained in place, and additional responses are passed to it to create the additional heat grids for revision plan responses.&lt;br /&gt;
&lt;br /&gt;
''app/helpers/grades_helper.rb''&lt;br /&gt;
&lt;br /&gt;
The method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; was created from the original code shared by both &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; in ''app/controllers/grades_controller'', but with the additional functionality of checking for Revision Plans in responses.  When &amp;lt;code&amp;gt;assignment.vary_by_round&amp;lt;/code&amp;gt;, an additional heatgrid is added for each round of Revision Planning.  When &amp;lt;code&amp;gt;!assignment.vary_by_round&amp;lt;/code&amp;gt;, only one heatgrid is added for the Revision Plan used in the most recent round of review.&lt;br /&gt;
&lt;br /&gt;
  def generate_heatgrid(participant, assignment, team, team_id, questionnaires, vmlist)&lt;br /&gt;
    counter_for_revisions = -1&lt;br /&gt;
    counter_for_same_rubric = 0&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      if assignment.vary_by_round? &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      add_response_to_vmlist(participant, assignment, team, questionnaire, vmlist, @round)&lt;br /&gt;
      if assignment.vary_by_round? &amp;amp;&amp;amp; assignment.is_revision_planning_enabled?&lt;br /&gt;
        rp_questionnaire = RevisionPlanTeamMap.find_by(team: Team.find(team_id), used_in_round: counter_for_revisions).try(:questionnaire)&lt;br /&gt;
        if rp_questionnaire&lt;br /&gt;
          add_response_to_vmlist(participant, assignment, team, rp_questionnaire, vmlist, @round)&lt;br /&gt;
        end&lt;br /&gt;
        counter_for_revisions += 1&lt;br /&gt;
      elsif assignment.is_revision_planning_enabled? &amp;amp;&amp;amp; questionnaire == questionnaires.last&lt;br /&gt;
        if assignment.get_current_stage == &amp;quot;Finished&amp;quot;&lt;br /&gt;
          current_round = assignment.rounds_of_reviews&lt;br /&gt;
        else&lt;br /&gt;
          reviewees_topic = SignedUpTeam.topic_id_by_team_id(participant.id)&lt;br /&gt;
          current_round = assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
        end&lt;br /&gt;
        rp_questionnaire = RevisionPlanTeamMap.find_by(team: Team.find(team_id), used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
        if rp_questionnaire&lt;br /&gt;
          add_response_to_vmlist(participant, assignment, team, rp_questionnaire, vmlist, @round)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The method &amp;lt;code&amp;gt;add_response_to_vmlist&amp;lt;/code&amp;gt; was added to refactor the code that is used multiple times to add another review to the view model.&lt;br /&gt;
&lt;br /&gt;
  def add_response_to_vmlist(participant, assignment, team, questionnaire, vmlist, round)&lt;br /&gt;
    vm = VmQuestionResponse.new(questionnaire, assignment, round)&lt;br /&gt;
    vmquestions = questionnaire.questions&lt;br /&gt;
    vm.add_questions(vmquestions)&lt;br /&gt;
    vm.add_team_members(team)&lt;br /&gt;
    vm.add_reviews(participant, team, assignment.vary_by_round)&lt;br /&gt;
    vm.number_of_comments_greater_than_10_words&lt;br /&gt;
    vmlist &amp;lt;&amp;lt; vm&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/helpers/summary_helper.rb''&lt;br /&gt;
&lt;br /&gt;
'''Bug Fix:''' Reverted &amp;lt;code&amp;gt;get_sentences&amp;lt;/code&amp;gt; back to version in master branch to prevent Active Record Error caused by beta version of code.&lt;br /&gt;
&lt;br /&gt;
  def get_sentences(ans)&lt;br /&gt;
    unless ans.comments.nil?&lt;br /&gt;
      ans.comments.gsub!(/[.?!]/, '\1|')&lt;br /&gt;
      sentences = ans.comments.split('|')&lt;br /&gt;
      sentences.map!(&amp;amp;:strip)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/vm_question_response.rb''&lt;br /&gt;
&lt;br /&gt;
Allow &amp;lt;code&amp;gt;RevisionPlanQuestionnaires&amp;lt;/code&amp;gt; to be added to the view model in the same way as &amp;lt;code&amp;gt;ReviewQuestionnaires&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  if (@questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; or @questionnaire_type == &amp;quot;RevisionPlanQuestionnaire&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
''app/views/grades/view_team.html.erb''&lt;br /&gt;
&lt;br /&gt;
Print round number headings for Revision Plan heat grids.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; or vm.questionnaire_type == &amp;quot;RevisionPlanQuestionnaire&amp;quot;%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Separated Review and Revision Plan questions in response&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
&lt;br /&gt;
Created separate arrays for ReviewQuestionnaire questions and RevsionPlanQuestionnaire questions.  Added headings for Review Responses and Revision Plan Responses. &lt;br /&gt;
&lt;br /&gt;
  review_questions = []&lt;br /&gt;
  revision_plan_questions = []&lt;br /&gt;
  #begin table for Review Responses&lt;br /&gt;
  ...&lt;br /&gt;
  map = ResponseMap.find(self.map_id)&lt;br /&gt;
  unless map.is_a? ReviewResponseMap&lt;br /&gt;
    code = add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
  else&lt;br /&gt;
    assignment = map.assignment&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      if(question.questionnaire.type == 'ReviewQuestionnaire')&lt;br /&gt;
        review_questions.append(question)&lt;br /&gt;
      elsif(question.questionnaire.type == 'RevisionPlanQuestionnaire')&lt;br /&gt;
        revision_plan_questions.append(question)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    code = add_table_rows questionnaire_max, review_questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
    if assignment.is_revision_planning_enabled&lt;br /&gt;
    #end table for Review Responses and begin table for Revision Plan Responses&lt;br /&gt;
      code = add_table_rows questionnaire_max, revision_plan_questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
*Refactored &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''app/controllers/grades_controller.rb''&lt;br /&gt;
&lt;br /&gt;
The code in the &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; method was almost identical to the code in the &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; method in ''app/helpers/grades_helper.rb''.  It was refactored into a new method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; in ''app/helpers/grades_helper.rb'' and used in &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  def view_team&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    @questions = retrieve_questions questionnaires, @assignment.id&lt;br /&gt;
    @pscore = @participant.scores(@questions)&lt;br /&gt;
    @vmlist = []&lt;br /&gt;
    generate_heatgrid(@participant, @assignment, @team, @team_id, questionnaires, @vmlist)&lt;br /&gt;
    @current_role_name = current_role_name&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/helpers/grades_helper.rb''&lt;br /&gt;
&lt;br /&gt;
The code in the &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; method was almost identical to the code in the &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; method in ''app/controllers/grades_controller.rb''.  It was refactored into a new method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; and used in &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  def view_heatgrid(participant_id, type)&lt;br /&gt;
    # get participant, team, questionnaires for assignment.&lt;br /&gt;
    @participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
    @type = type&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    @vmlist = []&lt;br /&gt;
    generate_heatgrid(@participant, @assignment, @team, @team_id, questionnaires, @vmlist)&lt;br /&gt;
    render &amp;quot;grades/view_heatgrid.html.erb&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
[[File:Revision Planning Control Flow Diagram.jpeg|400px|thumb|center|Control Flow of the Revision Planning Function]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan - Under progress===&lt;br /&gt;
&lt;br /&gt;
====RSpec Testing====&lt;br /&gt;
The RSpec tests are written to test both controller and models.&lt;br /&gt;
&lt;br /&gt;
Controllers&lt;br /&gt;
&lt;br /&gt;
*spec/controllers/response_controller_spec.rb: Updated spec to pass build by stubbing &amp;lt;code&amp;gt;get_questions&amp;lt;/code&amp;gt; method.&lt;br /&gt;
*spec/factories/revision_plan_factory.rb: Factories can be used to create objects unique to revision plans, including: &amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;RevisionPlanTeamMap&amp;lt;/code&amp;gt;&lt;br /&gt;
*spec/controllers/revision_plan_questionnaires_controller_spec.rb: Add four examples to test revision plan questionnaires controller&lt;br /&gt;
   describe '#action_allowed?' do&lt;br /&gt;
  &lt;br /&gt;
      context 'when params action is edit or update' do&lt;br /&gt;
  &lt;br /&gt;
        before(:each) do&lt;br /&gt;
          controller.params = {id: '1', action: 'edit',team_id: 1}&lt;br /&gt;
          controller.request.session[:user] = student&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
        context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        ...&lt;br /&gt;
        context 'when current user is the student of current questionnaires' do&lt;br /&gt;
        ...&lt;br /&gt;
        context 'when current user is a student but not of the team' do&lt;br /&gt;
        ...&lt;br /&gt;
      context 'when params action is not edit and update' do&lt;br /&gt;
      ...&lt;br /&gt;
      ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Models&lt;br /&gt;
&lt;br /&gt;
*spec/models/response_spec.rb: Updated spec to pass build by updating expected html output.&lt;br /&gt;
&lt;br /&gt;
*spec/models/review_response_map_spec.rb: Updated spec to pass build by updating expected html output.&lt;br /&gt;
&lt;br /&gt;
Features&lt;br /&gt;
&lt;br /&gt;
* spec/features/assignment_creation_general_tab_spec.rb&lt;br /&gt;
&lt;br /&gt;
Test if checking box tag &amp;lt;code&amp;gt;Revision Planning?&amp;lt;/code&amp;gt; enables revision planning.&lt;br /&gt;
&lt;br /&gt;
  it &amp;quot;should enable revision planning&amp;quot; do&lt;br /&gt;
      fill_assignment_form&lt;br /&gt;
      check(&amp;quot;assignment_form_assignment_is_revision_planning_enabled&amp;quot;)&lt;br /&gt;
      click_button 'Save'&lt;br /&gt;
      assignment = Assignment.where(name: 'edit assignment for test').first&lt;br /&gt;
      expect(assignment).to have_attributes(&lt;br /&gt;
          name: 'edit assignment for test',&lt;br /&gt;
          course_id: Course.find_by(name: 'Course 2').id,&lt;br /&gt;
          directory_path: 'testDirectory1',&lt;br /&gt;
          spec_location: 'testLocation1',&lt;br /&gt;
          is_revision_planning_enabled: true,&lt;br /&gt;
      )&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
Manual testing aims to verify the following:&lt;br /&gt;
* Create an assignment with revision planning enabled.&lt;br /&gt;
* Are participants allowed to create/edit revision plan when round 1+ (1 or greater than 1) reviews have finished.&lt;br /&gt;
* Is revision plan editing disabled when assignment is in review stage.&lt;br /&gt;
* Are reviewers shown questions created by reviewees.&lt;br /&gt;
* Are participants shown summary of score for revision plan after review deadline has expired.&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# Previous Implementation: [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875 wiki], [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016 wiki] &lt;br /&gt;
# Forked Repository: [https://github.com/SidharthMehta/expertiza/tree/beta E2083 github]&lt;br /&gt;
# Pull Request: [https://github.com/expertiza/expertiza/pull/1832 E2083 pull request]&lt;br /&gt;
# Demo: [https://youtu.be/7pdz_A8vDkk E2083 demo video]&lt;br /&gt;
# Deployment: [http://152.7.98.99:8080/ temporary deployment link]&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=137785</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=137785"/>
		<updated>2020-11-24T15:08:36Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* RSpec Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza. In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementations===&lt;br /&gt;
Revision planning has been implemented twice before, once in [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875] and once in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016]. While the functionality worked and effectively minimized changes to the code, they also had the following problems:&lt;br /&gt;
*Hardcoded “round” numbers in many places of the code.&lt;br /&gt;
*Documentation does not reflect the new changes they made.&lt;br /&gt;
*Revision planning responses and responses to the other items are not distinguished in heatgrid view.&lt;br /&gt;
*The idea of adding a &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; field to each question is intuitive. However, they failed to come up with a clean implementation of this idea. Specifically, they had passed some trailing parameters several methods down before reaching the place that needs them.&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
To implement revision planning, [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016] added &amp;lt;code&amp;gt;is_revision_planning_enabled&amp;lt;/code&amp;gt; (Boolean) to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Question&amp;lt;/code&amp;gt;. Adding a Boolean to enable revision planning for an assignment makes sense, but having certain questions belong to a team is not a clean implementation. Instead, we will create a new questionnaire that will belong to each team and keep track of the set of questions. We will use this new questionnaire to separate the revision plan responses and responses to other items in heat-grid view by creating a different table for each.&lt;br /&gt;
&lt;br /&gt;
===Files Modified===&lt;br /&gt;
This is a list of files modified and added. The list will be updated as the implementation progresses.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Changed'':&amp;lt;br&amp;gt;&lt;br /&gt;
*app/controllers/advice_controller.rb&lt;br /&gt;
*app/controllers/grades_controller.rb&lt;br /&gt;
*app/controllers/questionnaires_controller.rb&lt;br /&gt;
*app/controllers/questions_controller.rb&lt;br /&gt;
*app/controllers/response_controller.rb &lt;br /&gt;
*app/controllers/student_task_controller.rb&lt;br /&gt;
*app/helpers/summary_helper.rb &lt;br /&gt;
*app/helpers/grades_helper.rb&lt;br /&gt;
*app/models/questionnaire.rb &lt;br /&gt;
*app/models/response.rb&lt;br /&gt;
*app/models/student_task.rb&lt;br /&gt;
*app/models/vm_question_response.rb&lt;br /&gt;
*app/models/on_the_fly_calc.rb&lt;br /&gt;
*app/views/advice/edit_advice.html.erb&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb&lt;br /&gt;
*app/views/grades/view_team.html.erb&lt;br /&gt;
*app/views/questionnaires/_questionnaire.html.erb &lt;br /&gt;
*app/views/response/response.html.erb&lt;br /&gt;
*app/views/student_task/view.html.erb &lt;br /&gt;
*config/routes.rb &lt;br /&gt;
*db/schema.rb&lt;br /&gt;
*spec/controllers/response_controller_spec.rb&lt;br /&gt;
*spec/models/response_spec.rb&lt;br /&gt;
*spec/models/review_response_map_spec.rb&lt;br /&gt;
*spec/features/assignment_creation_general_tab_spec.rb &lt;br /&gt;
&lt;br /&gt;
''Added'':&amp;lt;br&amp;gt;&lt;br /&gt;
*app/controllers/revision_plan_questionnaires_controller.rb &lt;br /&gt;
*app/models/revision_plan_questionnaire.rb&lt;br /&gt;
*app/models/revision_plan_team_map.rb&lt;br /&gt;
*app/views/questionnaires/_questions.html.erb&lt;br /&gt;
*app/views/revision_plan_questionnaires/edit.html.erb &lt;br /&gt;
*db/migrate/20201106020642_create_revision_plan_team_maps.rb /&lt;br /&gt;
*db/migrate/20201105023711_add_is_revison_planning_enabled_to_assignments.rb&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
Items in green are additions.&lt;br /&gt;
[[File:E2083_Proposed_Design.png|1000px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Changes:&lt;br /&gt;
*In the assignment table we have added &amp;lt;code&amp;gt;is_revision_planning_enabled?&amp;lt;/code&amp;gt; column to indicate whether the assignment accepts a revision plan along with review rubric.&lt;br /&gt;
*&amp;lt;code&amp;gt;RevisionPlanTeamMap&amp;lt;/code&amp;gt; maps a questionnaire to an assignment team and round. This will map to a questionnaire of type revision plan that will be created by the revewee.&lt;br /&gt;
*&amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; extends &amp;lt;code&amp;gt;Questionnaire&amp;lt;/code&amp;gt; using single table inheritance.&lt;br /&gt;
&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Enable Revision Planning====&lt;br /&gt;
In order to enable '''Revision Planning''', the setting must be enabled when creating or editing an assignment under the '''General''' tab.  The wireframe below demonstrates creating an assignment, and editing the assignment functions similarly.  '''Revision plan?''' should be checked to enable this option. &lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Enable_Revision_Planning_Wireframe.png|700px|thumb|center|Wireframe of Enabling Assignment's Revision Planning]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Create_New_Assignment.png|700px|thumb|center|Create New Assignment page in the UI, with added Revision Planning checkbox]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
* Added a Boolean field &amp;lt;code&amp;gt;is_revision_planning_enabled&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; that saves whether revision planning is enabled.&lt;br /&gt;
''db/migrate/20201105023711_add_is_revison_planning_enabled_to_assignments.rb'' &lt;br /&gt;
&lt;br /&gt;
    class AddIsRevisonPlanningEnabledToAssignments &amp;lt; ActiveRecord::Migration&lt;br /&gt;
      def change&lt;br /&gt;
        add_column :assignments, :is_revision_planning_enabled, :boolean, default: false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
* Add checkbox to enable revision planning in edit assignment view.&lt;br /&gt;
''app/views/assignments/edit/_general.html.erb''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td style='padding:5px' id='assignment_revison_planning_field'&amp;gt;&lt;br /&gt;
      &amp;lt;input name=&amp;quot;assignment_form[assignment][is_revision_planning_enabled]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;%= check_box_tag('assignment_form[assignment][is_revision_planning_enabled]', 'true', @assignment_form.assignment.is_revision_planning_enabled) %&amp;gt;&lt;br /&gt;
      &amp;lt;%= label_tag('assignment_form[assignment][is_revision_planning_enabled]', 'Revision Planning?') %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to the ‘Revision planning page’.&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Link_to_the_revision_planning.jpeg|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Revision_Planning_Link.png|600px|thumb|center|Submit or Review Work page demonstrating added Revision Planning link]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
* Show link to revision planning page when revision planning is enabled for an assignment, round 1 has passed and current stage is submission. &lt;br /&gt;
&lt;br /&gt;
In order to check if a team is allowed to submit a revision plan &amp;lt;code&amp;gt;@can_submit_revision_plan&amp;lt;/code&amp;gt; field is added to &amp;lt;code&amp;gt;StudentTaskController&amp;lt;/code&amp;gt;'s view action. If a revision plan questionnaire (&amp;lt;code&amp;gt;@revision_plan_questionnaire_id&amp;lt;/code&amp;gt;) exists for the current round then clicking the link performs &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;'s edit action else new action is performed.&lt;br /&gt;
&lt;br /&gt;
''app/views/student_task/view.html.erb'' &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @team &amp;amp;&amp;amp; @assignment.is_revision_planning_enabled %&amp;gt;&lt;br /&gt;
    &amp;amp;lt;li&amp;amp;gt;&lt;br /&gt;
      &amp;lt;% if @can_submit_revision_plan %&amp;gt;&lt;br /&gt;
        &amp;lt;% if @revision_plan_questionnaire_id %&amp;gt;&lt;br /&gt;
          &amp;lt;%= link_to &amp;quot;Revision Planning&amp;quot;, controller: 'revision_plan_questionnaires', action: 'edit', id: @revision_plan_questionnaire_id %&amp;gt; &lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;%= link_to &amp;quot;Revision Planning&amp;quot;, controller: 'revision_plan_questionnaires', action: 'new', team_id: @team %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        (Add new questions to next-round rubric)&lt;br /&gt;
      &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;amp;lt;font color=&amp;quot;gray&amp;quot;&amp;amp;gt;Revision Planning&amp;amp;lt;/font&amp;amp;gt; (You are not allowed to submit your revison plan right now)&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
  &amp;lt;%end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''app/controllers/student_task_controller.rb'' &lt;br /&gt;
 &lt;br /&gt;
  def view&lt;br /&gt;
    student_task = StudentTask.from_participant_id params[:id]&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    # Revision plan feature&lt;br /&gt;
    @can_submit_revision_plan = student_task.can_submit_revision_plan?&lt;br /&gt;
    @revision_plan_questionnaire_id = student_task.revision_plan_questionnaire_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/student_task.rb''&lt;br /&gt;
&lt;br /&gt;
  def current_round&lt;br /&gt;
    assignment.number_of_current_round(@topic.try(:id))&lt;br /&gt;
  end&lt;br /&gt;
  def can_submit_revision_plan?&lt;br /&gt;
    current_stage == 'submission' &amp;amp;&amp;amp; current_round &amp;gt; 1&lt;br /&gt;
  end&lt;br /&gt;
  def revision_plan_questionnaire_id&lt;br /&gt;
    RevisionPlanTeamMap.find_by(team: @participant.team, used_in_round: current_round).try(:questionnaire_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking '''Remove''' in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods. &lt;br /&gt;
 &lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|500px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Edit_Revision_Plan.png|700px|thumb|center|Edit Revision Plan page demonstrating added view]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
* Create a model RevisionPlanTeamMap that maps a revision plan to a team and stores information of the round it is used in.&lt;br /&gt;
&lt;br /&gt;
''/app/models/revision_plan_team_map.rb''&lt;br /&gt;
&lt;br /&gt;
  class RevisionPlanTeamMap &amp;lt; ActiveRecord::Base&lt;br /&gt;
    belongs_to :team&lt;br /&gt;
    belongs_to :questionnaire&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''/db/migrate/20201106020642_create_revision_plan_team_maps.rb'' &lt;br /&gt;
&lt;br /&gt;
  class CreateRevisionPlanTeamMaps &amp;lt; ActiveRecord::Migration&lt;br /&gt;
    def change&lt;br /&gt;
      create_table :revision_plan_team_maps do |t|&lt;br /&gt;
        t.references :team, index: true, foreign_key: true&lt;br /&gt;
        t.references :questionnaire, index: true, foreign_key: true&lt;br /&gt;
        t.integer :used_in_round&lt;br /&gt;
        t.timestamps null: false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Create a Revision Plan Questionnaire Model and Controller&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SidharthMehta/expertiza/blob/1b54cf6c7aa2b1195c5259a4ee616f21fc2f37a3/app/models/revision_plan_questionnaire.rb ''app/models/revision_plan_questionnaire.rb'']&lt;br /&gt;
&lt;br /&gt;
Added a model for revision plan questionnaire. The code provides method to get questionnaire for a current round based on team.&lt;br /&gt;
&lt;br /&gt;
  def self.get_questionnaire_for_current_round(team_id)&lt;br /&gt;
    assignment_team = Team.find(team_id)&lt;br /&gt;
    assignment = assignment_team.assignment&lt;br /&gt;
    current_round = assignment.number_of_current_round(assignment_team.topic)&lt;br /&gt;
    questionnaire = RevisionPlanTeamMap.find_by(team: assignment_team, used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
    unless questionnaire&lt;br /&gt;
      questionnaire = RevisionPlanQuestionnaire.new&lt;br /&gt;
      questionnaire.name = 'Revision Plan Questionnaire'&lt;br /&gt;
      questionnaire.instructor_id = assignment.instructor_id&lt;br /&gt;
      questionnaire.max_question_score = 5&lt;br /&gt;
      questionnaire.save&lt;br /&gt;
      questionnaire_team_map = RevisionPlanTeamMap.create(team_id: assignment_team.id, used_in_round: current_round, questionnaire_id: questionnaire.id)&lt;br /&gt;
    end&lt;br /&gt;
    return questionnaire&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method returns the team associated to a revision plan questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def team&lt;br /&gt;
    revision_plan_team_map.team&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Added a new type of questionnaire &amp;lt;code&amp;gt;'RevisionPlanQuestionnaire'&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;QUESTIONNAIRE_TYPES&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  QUESTIONNAIRE_TYPES = ['ReviewQuestionnaire',&lt;br /&gt;
                        ...&lt;br /&gt;
                        ...&lt;br /&gt;
                         'RevisionPlanQuestionnaire'].freeze&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SidharthMehta/expertiza/blob/1b54cf6c7aa2b1195c5259a4ee616f21fc2f37a3/app/controllers/revision_plan_questionnaires_controller.rb ''app/controllers/revision_plan_questionnaires_controller.rb'']&lt;br /&gt;
&lt;br /&gt;
Added a controller &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;. The controller derives from &amp;lt;code&amp;gt;QuestionnairesController&amp;lt;/code&amp;gt;, it overrides the &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; action to allow creation of a &amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; for a &amp;lt;code&amp;gt;team&amp;lt;/code&amp;gt;. It also updates permissions for controller.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'edit'&lt;br /&gt;
      questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
      questionnaire.team.users.collect { |u| u.id }.include? session[:user].id || super&lt;br /&gt;
      (user_logged_in? &amp;amp;&amp;amp; questionnaire.team.users.collect { |u| u.id }.include?(session[:user].id)) || super&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    begin&lt;br /&gt;
      questionnaire = RevisionPlanQuestionnaire.get_questionnaire_for_current_round(params[:team_id])&lt;br /&gt;
      redirect_to action: 'edit', id: questionnaire.id&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      flash[:error] = $ERROR_INFO&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''config/routes.rb'' &lt;br /&gt;
&lt;br /&gt;
Add routes for &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  resources :revision_plan_questionnaires, controller: :revision_plan_questionnaires, only: %i[new edit update] do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :add_new_questions&lt;br /&gt;
      post :save_all_questions&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Add a view to edit Revision Plan&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/blob/d97eb1c1fc8d578b18f51401dc713b0d04815fe4/app/views/revision_plan_questionnaires/edit.html.erb ''app/views/revision_plan_questionnaires/edit.html.erb'']&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= render :partial =&amp;gt; 'question_weight' %&amp;gt;&lt;br /&gt;
  &amp;amp;lt;h1&amp;amp;gt;Edit &amp;lt;%= @questionnaire.display_type %&amp;gt;&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
  &amp;lt;%= render :partial =&amp;gt; 'questions' %&amp;gt;&lt;br /&gt;
  &amp;amp;lt;br /&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;a href=&amp;quot;javascript:window.history.back()&amp;quot;&amp;amp;gt;Back&amp;amp;lt;/a&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactor code to display questions into a partial. Allows for code reuse.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/questionnaires_controller.rb''&lt;br /&gt;
&lt;br /&gt;
Updated &amp;lt;code&amp;gt;redirect_to&amp;lt;/code&amp;gt; links for &amp;lt;code&amp;gt;add_new_questions&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;save_all_questions&amp;lt;/code&amp;gt; methods.&lt;br /&gt;
&lt;br /&gt;
  redirect_to action: 'edit', id: questionnaire_id.to_sym&lt;br /&gt;
&lt;br /&gt;
''app/views/questionnaires/_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
This file generates a view to edit/create a new questionnaire. It has functionality to display questions and some functions that are not needed for revision plan questionnaire. To enable code reuse the functionality to add/edit/remove/save questions was moved to a new partial ''app/views/questionnaires/_questions.html.erb''.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/blob/d97eb1c1fc8d578b18f51401dc713b0d04815fe4/app/views/questionnaires/_questions.html.erb ''app/views/questionnaires/_questions.html.erb'']&lt;br /&gt;
&lt;br /&gt;
*Add code to allow users to delete questions from revision plan questionnaire.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/questions_controller.rb ''&lt;br /&gt;
&lt;br /&gt;
Update authorization code to allow a user to remove questions from his teams revision plan.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    if ['destroy'].include?(params[:action])&lt;br /&gt;
      question = Question.find(params[:id])&lt;br /&gt;
      if(user_logged_in? &amp;amp;&amp;amp; question.questionnaire.owner?(session[:user].id))&lt;br /&gt;
        return true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    current_user_has_ta_privileges?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def destroy&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    if(question.questionnaire.type == 'RevisionPlanQuestionnaire')&lt;br /&gt;
      redirect_to edit_revision_plan_questionnaire_path(questionnaire_id.to_s.to_sym)&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to edit_questionnaire_path(questionnaire_id.to_s.to_sym)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Method returns true if user owns questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def owner?(user_id)&lt;br /&gt;
    instructor_id == user_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/revision_plan_questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Overrides implementation for &amp;lt;code&amp;gt;owner?&amp;lt;/code&amp;gt; defined in &amp;lt;code&amp;gt;Questionnaire&amp;lt;/code&amp;gt; to return true if a team owns the questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def owner?(user_id)&lt;br /&gt;
    team.users.map{ |u| u.id }.include?(user_id) || super&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Add code to allow users to access show/edit advice functionality for revision plan questions.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/advice_controller.rb''&lt;br /&gt;
&lt;br /&gt;
Update authorization code to allow a user to update advice his teams revision plan.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if(user_logged_in? &amp;amp;&amp;amp; questionnaire.owner?(session[:user].id))&lt;br /&gt;
      return true&lt;br /&gt;
    end&lt;br /&gt;
    current_user_has_ta_privileges?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/views/advice/edit_advice.html.erb''&lt;br /&gt;
&lt;br /&gt;
Update 'Back to questionnaire' link.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @questionnaire.type == 'RevisionPlanQuestionnaire'%&amp;gt;&lt;br /&gt;
    &amp;lt;%= link_to 'Back to questionnaire', :controller =&amp;gt; 'revision_plan_questionnaires', :action =&amp;gt; 'edit', :id =&amp;gt; @questionnaire.id %&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= link_to 'Back to questionnaire', :controller =&amp;gt; 'questionnaires', :action =&amp;gt; 'edit', :id =&amp;gt; @questionnaire.id %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Reviewing an Assignment====&lt;br /&gt;
Once the Revision Plan Questionnaire and its resubmission round have been finished, the Revision Plan Questionnaire is appended to the Assignment Questionnaire for that round.&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Review_Wireframe.png|400px|thumb|center|Wireframe of Completing a Review for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Revision_Plan_Questionnaire.png|400px|thumb|center|Review page demonstrating added Revision Plan questions]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
*Add Revision Plan questions to Response&lt;br /&gt;
&lt;br /&gt;
''app/controllers/response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
This methods gets questions sorted by sequence from review and revision questionnaire and merges them in a single list.&lt;br /&gt;
&lt;br /&gt;
  def set_questions_for_new_response&lt;br /&gt;
    @questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    if(@assignment &amp;amp;&amp;amp; @assignment.is_revision_planning_enabled)&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @revision_plan_questionnaire = RevisionPlanTeamMap.find_by(team_id: @map.reviewee_id, used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
      if(@revision_plan_questionnaire)&lt;br /&gt;
        @questions += sort_questions(@revision_plan_questionnaire.questions)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    return @questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method gets questions from a response instead of questionnaire. We use this when response has already been created.&lt;br /&gt;
&lt;br /&gt;
  def set_questions&lt;br /&gt;
    @questions = @response.get_questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
 &lt;br /&gt;
Added a method to get all the questionnaires for a response, response is a collection of answers. Answers contain reference to their question, and question have a reference to questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def questionnaires_by_answers(answers)&lt;br /&gt;
    answers_with_questionnaires = answers.select{ |ans|  ans &amp;amp;&amp;amp; ans.question &amp;amp;&amp;amp; ans.question.questionnaire }&lt;br /&gt;
    questionnaires = answers_with_questionnaires.collect{ |ans| ans.question.questionnaire }.uniq&lt;br /&gt;
    unless(questionnaires.any?)&lt;br /&gt;
      questionnaires = []&lt;br /&gt;
      questionnaires &amp;lt;&amp;lt; questionnaire_by_answer(answers.first)&lt;br /&gt;
    end&lt;br /&gt;
    questionnaires&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method gets all the questions for a response.&lt;br /&gt;
&lt;br /&gt;
  def get_questions&lt;br /&gt;
    @questions = []&lt;br /&gt;
    questionnaires = questionnaires_by_answers(scores)&lt;br /&gt;
    questionnaires.each {|questionnaire| @questions += questionnaire.questions }&lt;br /&gt;
    return @questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Separating questions by their questionnaire type&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;construct_review_response&amp;lt;/code&amp;gt; method has been updated to create separate tables for review questions, revision questions and additional comment.&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Add a method to check if heading is to be displayed for the questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def display_heading?&lt;br /&gt;
    return false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/revision_plan_questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Overriding the method defined in questionnaire.rb to display heading for revision plan questionnaire.&lt;br /&gt;
 &lt;br /&gt;
  def display_heading?&lt;br /&gt;
    return true&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/views/response/response.html.erb''&lt;br /&gt;
&lt;br /&gt;
View groups questions by questionnaire type and then adds a heading for questionnaires that return true for &amp;lt;code&amp;gt;display_heading?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Bug fix:''' The existing implementation has a bug where the first question in a questionnaire is displayed last in response. This was fixed as well.&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant is able to view their team's score.  The UI below shows what this looks like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor are shown under '''Assignment Questionnaire.'''  The results of the questions created by the team are shown under '''Improvement Plan.'''&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Summary_Report.png|600px|thumb|center|Summary Report page demonstrating added Revision Plan heatgrid]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
*Show revision plan questions in heat grid.&lt;br /&gt;
&lt;br /&gt;
Heat grids for review responses are currently implemented in a view model defined in ''vm_question_response.rb''.  All functionality of this view model has remained in place, and additional responses are passed to it to create the additional heat grids for revision plan responses.&lt;br /&gt;
&lt;br /&gt;
''app/helpers/grades_helper.rb''&lt;br /&gt;
&lt;br /&gt;
The method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; was created from the original code shared by both &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; in ''app/controllers/grades_controller'', but with the additional functionality of checking for Revision Plans in responses.  When &amp;lt;code&amp;gt;assignment.vary_by_round&amp;lt;/code&amp;gt;, an additional heatgrid is added for each round of Revision Planning.  When &amp;lt;code&amp;gt;!assignment.vary_by_round&amp;lt;/code&amp;gt;, only one heatgrid is added for the Revision Plan used in the most recent round of review.&lt;br /&gt;
&lt;br /&gt;
  def generate_heatgrid(participant, assignment, team, team_id, questionnaires, vmlist)&lt;br /&gt;
    counter_for_revisions = -1&lt;br /&gt;
    counter_for_same_rubric = 0&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      if assignment.vary_by_round? &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      add_response_to_vmlist(participant, assignment, team, questionnaire, vmlist, @round)&lt;br /&gt;
      if assignment.vary_by_round? &amp;amp;&amp;amp; assignment.is_revision_planning_enabled?&lt;br /&gt;
        rp_questionnaire = RevisionPlanTeamMap.find_by(team: Team.find(team_id), used_in_round: counter_for_revisions).try(:questionnaire)&lt;br /&gt;
        if rp_questionnaire&lt;br /&gt;
          add_response_to_vmlist(participant, assignment, team, rp_questionnaire, vmlist, @round)&lt;br /&gt;
        end&lt;br /&gt;
        counter_for_revisions += 1&lt;br /&gt;
      elsif assignment.is_revision_planning_enabled? &amp;amp;&amp;amp; questionnaire == questionnaires.last&lt;br /&gt;
        if assignment.get_current_stage == &amp;quot;Finished&amp;quot;&lt;br /&gt;
          current_round = assignment.rounds_of_reviews&lt;br /&gt;
        else&lt;br /&gt;
          reviewees_topic = SignedUpTeam.topic_id_by_team_id(participant.id)&lt;br /&gt;
          current_round = assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
        end&lt;br /&gt;
        rp_questionnaire = RevisionPlanTeamMap.find_by(team: Team.find(team_id), used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
        if rp_questionnaire&lt;br /&gt;
          add_response_to_vmlist(participant, assignment, team, rp_questionnaire, vmlist, @round)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The method &amp;lt;code&amp;gt;add_response_to_vmlist&amp;lt;/code&amp;gt; was added to refactor the code that is used multiple times to add another review to the view model.&lt;br /&gt;
&lt;br /&gt;
  def add_response_to_vmlist(participant, assignment, team, questionnaire, vmlist, round)&lt;br /&gt;
    vm = VmQuestionResponse.new(questionnaire, assignment, round)&lt;br /&gt;
    vmquestions = questionnaire.questions&lt;br /&gt;
    vm.add_questions(vmquestions)&lt;br /&gt;
    vm.add_team_members(team)&lt;br /&gt;
    vm.add_reviews(participant, team, assignment.vary_by_round)&lt;br /&gt;
    vm.number_of_comments_greater_than_10_words&lt;br /&gt;
    vmlist &amp;lt;&amp;lt; vm&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/helpers/summary_helper.rb''&lt;br /&gt;
&lt;br /&gt;
'''Bug Fix:''' Reverted &amp;lt;code&amp;gt;get_sentences&amp;lt;/code&amp;gt; back to version in master branch to prevent Active Record Error caused by beta version of code.&lt;br /&gt;
&lt;br /&gt;
  def get_sentences(ans)&lt;br /&gt;
    unless ans.comments.nil?&lt;br /&gt;
      ans.comments.gsub!(/[.?!]/, '\1|')&lt;br /&gt;
      sentences = ans.comments.split('|')&lt;br /&gt;
      sentences.map!(&amp;amp;:strip)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/vm_question_response.rb''&lt;br /&gt;
&lt;br /&gt;
Allow &amp;lt;code&amp;gt;RevisionPlanQuestionnaires&amp;lt;/code&amp;gt; to be added to the view model in the same way as &amp;lt;code&amp;gt;ReviewQuestionnaires&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  if (@questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; or @questionnaire_type == &amp;quot;RevisionPlanQuestionnaire&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
''app/views/grades/view_team.html.erb''&lt;br /&gt;
&lt;br /&gt;
Print round number headings for Revision Plan heat grids.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; or vm.questionnaire_type == &amp;quot;RevisionPlanQuestionnaire&amp;quot;%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Separated Review and Revision Plan questions in response&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
&lt;br /&gt;
Created separate arrays for ReviewQuestionnaire questions and RevsionPlanQuestionnaire questions.  Added headings for Review Responses and Revision Plan Responses. &lt;br /&gt;
&lt;br /&gt;
  review_questions = []&lt;br /&gt;
  revision_plan_questions = []&lt;br /&gt;
  #begin table for Review Responses&lt;br /&gt;
  ...&lt;br /&gt;
  map = ResponseMap.find(self.map_id)&lt;br /&gt;
  unless map.is_a? ReviewResponseMap&lt;br /&gt;
    code = add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
  else&lt;br /&gt;
    assignment = map.assignment&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      if(question.questionnaire.type == 'ReviewQuestionnaire')&lt;br /&gt;
        review_questions.append(question)&lt;br /&gt;
      elsif(question.questionnaire.type == 'RevisionPlanQuestionnaire')&lt;br /&gt;
        revision_plan_questions.append(question)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    code = add_table_rows questionnaire_max, review_questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
    if assignment.is_revision_planning_enabled&lt;br /&gt;
    #end table for Review Responses and begin table for Revision Plan Responses&lt;br /&gt;
      code = add_table_rows questionnaire_max, revision_plan_questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
*Refactored &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''app/controllers/grades_controller.rb''&lt;br /&gt;
&lt;br /&gt;
The code in the &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; method was almost identical to the code in the &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; method in ''app/helpers/grades_helper.rb''.  It was refactored into a new method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; in ''app/helpers/grades_helper.rb'' and used in &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  def view_team&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    @questions = retrieve_questions questionnaires, @assignment.id&lt;br /&gt;
    @pscore = @participant.scores(@questions)&lt;br /&gt;
    @vmlist = []&lt;br /&gt;
    generate_heatgrid(@participant, @assignment, @team, @team_id, questionnaires, @vmlist)&lt;br /&gt;
    @current_role_name = current_role_name&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/helpers/grades_helper.rb''&lt;br /&gt;
&lt;br /&gt;
The code in the &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; method was almost identical to the code in the &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; method in ''app/controllers/grades_controller.rb''.  It was refactored into a new method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; and used in &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  def view_heatgrid(participant_id, type)&lt;br /&gt;
    # get participant, team, questionnaires for assignment.&lt;br /&gt;
    @participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
    @type = type&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    @vmlist = []&lt;br /&gt;
    generate_heatgrid(@participant, @assignment, @team, @team_id, questionnaires, @vmlist)&lt;br /&gt;
    render &amp;quot;grades/view_heatgrid.html.erb&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
[[File:Revision Planning Control Flow Diagram.jpeg|400px|thumb|center|Control Flow of the Revision Planning Function]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan - Under progress===&lt;br /&gt;
&lt;br /&gt;
====RSpec Testing====&lt;br /&gt;
The RSpec tests are written to test both controller and models.&lt;br /&gt;
&lt;br /&gt;
Controllers&lt;br /&gt;
&lt;br /&gt;
*spec/controllers/response_controller_spec.rb: Updated spec to pass build by stubbing &amp;lt;code&amp;gt;get_questions&amp;lt;/code&amp;gt; method.&lt;br /&gt;
*spec/factories/revision_plan_factory.rb: Factories can be used to create objects unique to revision plans, including: &amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;RevisionPlanTeamMap&amp;lt;/code&amp;gt;&lt;br /&gt;
*spec/controllers/revision_plan_questionnaires_controller_spec.rb: Add four examples to test revision plan questionnaires controller&lt;br /&gt;
   describe '#action_allowed?' do&lt;br /&gt;
  &lt;br /&gt;
      context 'when params action is edit or update' do&lt;br /&gt;
  &lt;br /&gt;
        before(:each) do&lt;br /&gt;
          controller.params = {id: '1', action: 'edit',team_id: 1}&lt;br /&gt;
          controller.request.session[:user] = student&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
        context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        ...&lt;br /&gt;
        context 'when current user is the student of current questionnaires' do&lt;br /&gt;
        ...&lt;br /&gt;
        context 'when current user is a student but not of the team' do&lt;br /&gt;
        ...&lt;br /&gt;
      context 'when params action is not edit and update' do&lt;br /&gt;
      ...&lt;br /&gt;
      ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Models&lt;br /&gt;
&lt;br /&gt;
*spec/models/response_spec.rb: Updated spec to pass build by updating expected html output.&lt;br /&gt;
&lt;br /&gt;
*spec/models/review_response_map_spec.rb: Updated spec to pass build by updating expected html output.&lt;br /&gt;
&lt;br /&gt;
Features&lt;br /&gt;
&lt;br /&gt;
* spec/features/assignment_creation_general_tab_spec.rb&lt;br /&gt;
&lt;br /&gt;
Test if checking box tag &amp;lt;code&amp;gt;Revision Planning?&amp;lt;/code&amp;gt; enables revision planning.&lt;br /&gt;
&lt;br /&gt;
  it &amp;quot;should enable revision planning&amp;quot; do&lt;br /&gt;
      fill_assignment_form&lt;br /&gt;
      check(&amp;quot;assignment_form_assignment_is_revision_planning_enabled&amp;quot;)&lt;br /&gt;
      click_button 'Save'&lt;br /&gt;
      assignment = Assignment.where(name: 'edit assignment for test').first&lt;br /&gt;
      expect(assignment).to have_attributes(&lt;br /&gt;
          name: 'edit assignment for test',&lt;br /&gt;
          course_id: Course.find_by(name: 'Course 2').id,&lt;br /&gt;
          directory_path: 'testDirectory1',&lt;br /&gt;
          spec_location: 'testLocation1',&lt;br /&gt;
          is_revision_planning_enabled: true,&lt;br /&gt;
      )&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
Manual testing aims to verify the following:&lt;br /&gt;
* Create an assignment with revision planning enabled.&lt;br /&gt;
* Are participants allowed to create/edit revision plan when round 1+ (1 or greater than 1) reviews have finished.&lt;br /&gt;
* Is revision plan editing disabled when assignment is in review stage.&lt;br /&gt;
* Are reviewers shown questions created by reviewees.&lt;br /&gt;
* Are participants shown summary of score for revision plan after review deadline has expired.&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# Previous Implementation: [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875 wiki], [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016 wiki] &lt;br /&gt;
# Forked Repository: [https://github.com/SidharthMehta/expertiza/tree/beta E2083 github]&lt;br /&gt;
# Pull Request: [https://github.com/expertiza/expertiza/pull/1832 E2083 pull request]&lt;br /&gt;
# Demo: [https://youtu.be/7pdz_A8vDkk E2083 demo video]&lt;br /&gt;
# Deployment: [http://152.7.98.99:8080/ temporary deployment link]&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=137661</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=137661"/>
		<updated>2020-11-18T19:57:17Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* RSpec Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza. In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementations===&lt;br /&gt;
Revision planning has been implemented twice before, once in [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875] and once in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016]. While the functionality worked and effectively minimized changes to the code, they also had the following problems:&lt;br /&gt;
*Hardcoded “round” numbers in many places of the code.&lt;br /&gt;
*Documentation does not reflect the new changes they made.&lt;br /&gt;
*Revision planning responses and responses to the other items are not distinguished in heatgrid view.&lt;br /&gt;
*The idea of adding a &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; field to each question is intuitive. However, they failed to come up with a clean implementation of this idea. Specifically, they had passed some trailing parameters several methods down before reaching the place that needs them.&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
To implement revision planning, [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016] added &amp;lt;code&amp;gt;is_revision_planning_enabled&amp;lt;/code&amp;gt; (Boolean) to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Question&amp;lt;/code&amp;gt;. Adding a Boolean to enable revision planning for an assignment makes sense, but having certain questions belong to a team is not a clean implementation. Instead, we will create a new questionnaire that will belong to each team and keep track of the set of questions. We will use this new questionnaire to separate the revision plan responses and responses to other items in heat-grid view by creating a different table for each.&lt;br /&gt;
&lt;br /&gt;
===Files Modified - Under progress===&lt;br /&gt;
This is a list of files modified and added. The list will be updated as the implementation progresses.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Changed'':&amp;lt;br&amp;gt;&lt;br /&gt;
*app/controllers/advice_controller.rb&lt;br /&gt;
*app/controllers/grades_controller.rb&lt;br /&gt;
*app/controllers/questionnaires_controller.rb&lt;br /&gt;
*app/controllers/questions_controller.rb&lt;br /&gt;
*app/controllers/response_controller.rb &lt;br /&gt;
*app/controllers/student_task_controller.rb&lt;br /&gt;
*app/helpers/summary_helper.rb &lt;br /&gt;
*app/helpers/grades_helper.rb&lt;br /&gt;
*app/models/questionnaire.rb &lt;br /&gt;
*app/models/response.rb&lt;br /&gt;
*app/models/student_task.rb&lt;br /&gt;
*app/models/vm_question_response.rb&lt;br /&gt;
*app/models/on_the_fly_calc.rb&lt;br /&gt;
*app/views/advice/edit_advice.html.erb&lt;br /&gt;
*app/views/assignments/edit/_general.html.erb&lt;br /&gt;
*app/views/grades/view_team.html.erb&lt;br /&gt;
*app/views/questionnaires/_questionnaire.html.erb &lt;br /&gt;
*app/views/response/response.html.erb&lt;br /&gt;
*app/views/student_task/view.html.erb &lt;br /&gt;
*config/routes.rb &lt;br /&gt;
*db/schema.rb&lt;br /&gt;
*spec/controllers/response_controller_spec.rb&lt;br /&gt;
*spec/models/response_spec.rb&lt;br /&gt;
*spec/models/review_response_map_spec.rb&lt;br /&gt;
&lt;br /&gt;
''Added'':&amp;lt;br&amp;gt;&lt;br /&gt;
*app/controllers/revision_plan_questionnaires_controller.rb &lt;br /&gt;
*app/models/revision_plan_questionnaire.rb&lt;br /&gt;
*app/models/revision_plan_team_map.rb&lt;br /&gt;
*app/views/questionnaires/_questions.html.erb&lt;br /&gt;
*app/views/revision_plan_questionnaires/edit.html.erb &lt;br /&gt;
*db/migrate/20201106020642_create_revision_plan_team_maps.rb /&lt;br /&gt;
*db/migrate/20201105023711_add_is_revison_planning_enabled_to_assignments.rb&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
Items in green are additions.&lt;br /&gt;
[[File:E2083_Proposed_Design.png|1000px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Changes:&lt;br /&gt;
*In the assignment table we have added &amp;lt;code&amp;gt;is_revision_planning_enabled?&amp;lt;/code&amp;gt; column to indicate whether the assignment accepts a revision plan along with review rubric.&lt;br /&gt;
*&amp;lt;code&amp;gt;RevisionPlanTeamMap&amp;lt;/code&amp;gt; maps a questionnaire to an assignment team and round. This will map to a questionnaire of type revision plan that will be created by the revewee.&lt;br /&gt;
*&amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; extends &amp;lt;code&amp;gt;Questionnaire&amp;lt;/code&amp;gt; using single table inheritance.&lt;br /&gt;
&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Enable Revision Planning====&lt;br /&gt;
In order to enable '''Revision Planning''', the setting must be enabled when creating or editing an assignment under the '''General''' tab.  The wireframe below demonstrates creating an assignment, and editing the assignment functions similarly.  '''Revision plan?''' should be checked to enable this option. &lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Enable_Revision_Planning_Wireframe.png|700px|thumb|center|Wireframe of Enabling Assignment's Revision Planning]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Create_New_Assignment.png|700px|thumb|center|Create New Assignment page in the UI, with added Revision Planning checkbox]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
* Added a Boolean field &amp;lt;code&amp;gt;is_revision_planning_enabled&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; that saves whether revision planning is enabled.&lt;br /&gt;
''db/migrate/20201105023711_add_is_revison_planning_enabled_to_assignments.rb'' &lt;br /&gt;
&lt;br /&gt;
    class AddIsRevisonPlanningEnabledToAssignments &amp;lt; ActiveRecord::Migration&lt;br /&gt;
      def change&lt;br /&gt;
        add_column :assignments, :is_revision_planning_enabled, :boolean, default: false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
* Add checkbox to enable revision planning in edit assignment view.&lt;br /&gt;
''app/views/assignments/edit/_general.html.erb''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;td style='padding:5px' id='assignment_revison_planning_field'&amp;gt;&lt;br /&gt;
      &amp;lt;input name=&amp;quot;assignment_form[assignment][is_revision_planning_enabled]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;%= check_box_tag('assignment_form[assignment][is_revision_planning_enabled]', 'true', @assignment_form.assignment.is_revision_planning_enabled) %&amp;gt;&lt;br /&gt;
      &amp;lt;%= label_tag('assignment_form[assignment][is_revision_planning_enabled]', 'Revision Planning?') %&amp;gt;&lt;br /&gt;
    &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to the ‘Revision planning page’.&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Link_to_the_revision_planning.jpeg|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Revision_Planning_Link.png|600px|thumb|center|Submit or Review Work page demonstrating added Revision Planning link]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
* Show link to revision planning page when revision planning is enabled for an assignment, round 1 has passed and current stage is submission. &lt;br /&gt;
&lt;br /&gt;
In order to check if a team is allowed to submit a revision plan &amp;lt;code&amp;gt;@can_submit_revision_plan&amp;lt;/code&amp;gt; field is added to &amp;lt;code&amp;gt;StudentTaskController&amp;lt;/code&amp;gt;'s view action. If a revision plan questionnaire (&amp;lt;code&amp;gt;@revision_plan_questionnaire_id&amp;lt;/code&amp;gt;) exists for the current round then clicking the link performs &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;'s edit action else new action is performed.&lt;br /&gt;
&lt;br /&gt;
''app/views/student_task/view.html.erb'' &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @team &amp;amp;&amp;amp; @assignment.is_revision_planning_enabled %&amp;gt;&lt;br /&gt;
    &amp;amp;lt;li&amp;amp;gt;&lt;br /&gt;
      &amp;lt;% if @can_submit_revision_plan %&amp;gt;&lt;br /&gt;
        &amp;lt;% if @revision_plan_questionnaire_id %&amp;gt;&lt;br /&gt;
          &amp;lt;%= link_to &amp;quot;Revision Planning&amp;quot;, controller: 'revision_plan_questionnaires', action: 'edit', id: @revision_plan_questionnaire_id %&amp;gt; &lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
          &amp;lt;%= link_to &amp;quot;Revision Planning&amp;quot;, controller: 'revision_plan_questionnaires', action: 'new', team_id: @team %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        (Add new questions to next-round rubric)&lt;br /&gt;
      &amp;lt;% else %&amp;gt;&lt;br /&gt;
        &amp;amp;lt;font color=&amp;quot;gray&amp;quot;&amp;amp;gt;Revision Planning&amp;amp;lt;/font&amp;amp;gt; (You are not allowed to submit your revison plan right now)&lt;br /&gt;
      &amp;lt;% end %&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
  &amp;lt;%end%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''app/controllers/student_task_controller.rb'' &lt;br /&gt;
 &lt;br /&gt;
  def view&lt;br /&gt;
    student_task = StudentTask.from_participant_id params[:id]&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    # Revision plan feature&lt;br /&gt;
    @can_submit_revision_plan = student_task.can_submit_revision_plan?&lt;br /&gt;
    @revision_plan_questionnaire_id = student_task.revision_plan_questionnaire_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/student_task.rb''&lt;br /&gt;
&lt;br /&gt;
  def current_round&lt;br /&gt;
    assignment.number_of_current_round(@topic.try(:id))&lt;br /&gt;
  end&lt;br /&gt;
  def can_submit_revision_plan?&lt;br /&gt;
    current_stage == 'submission' &amp;amp;&amp;amp; current_round &amp;gt; 1&lt;br /&gt;
  end&lt;br /&gt;
  def revision_plan_questionnaire_id&lt;br /&gt;
    RevisionPlanTeamMap.find_by(team: @participant.team, used_in_round: current_round).try(:questionnaire_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking '''Remove''' in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods. &lt;br /&gt;
 &lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|500px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Edit_Revision_Plan.png|700px|thumb|center|Edit Revision Plan page demonstrating added view]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
* Create a model RevisionPlanTeamMap that maps a revision plan to a team and stores information of the round it is used in.&lt;br /&gt;
&lt;br /&gt;
''/app/models/revision_plan_team_map.rb''&lt;br /&gt;
&lt;br /&gt;
  class RevisionPlanTeamMap &amp;lt; ActiveRecord::Base&lt;br /&gt;
    belongs_to :team&lt;br /&gt;
    belongs_to :questionnaire&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''/db/migrate/20201106020642_create_revision_plan_team_maps.rb'' &lt;br /&gt;
&lt;br /&gt;
  class CreateRevisionPlanTeamMaps &amp;lt; ActiveRecord::Migration&lt;br /&gt;
    def change&lt;br /&gt;
      create_table :revision_plan_team_maps do |t|&lt;br /&gt;
        t.references :team, index: true, foreign_key: true&lt;br /&gt;
        t.references :questionnaire, index: true, foreign_key: true&lt;br /&gt;
        t.integer :used_in_round&lt;br /&gt;
        t.timestamps null: false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Create a Revision Plan Questionnaire Model and Controller&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SidharthMehta/expertiza/blob/1b54cf6c7aa2b1195c5259a4ee616f21fc2f37a3/app/models/revision_plan_questionnaire.rb ''app/models/revision_plan_questionnaire.rb'']&lt;br /&gt;
&lt;br /&gt;
Added a model for revision plan questionnaire. The code provides method to get questionnaire for a current round based on team.&lt;br /&gt;
&lt;br /&gt;
  def self.get_questionnaire_for_current_round(team_id)&lt;br /&gt;
    assignment_team = Team.find(team_id)&lt;br /&gt;
    assignment = assignment_team.assignment&lt;br /&gt;
    current_round = assignment.number_of_current_round(assignment_team.topic)&lt;br /&gt;
    questionnaire = RevisionPlanTeamMap.find_by(team: assignment_team, used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
    unless questionnaire&lt;br /&gt;
      questionnaire = RevisionPlanQuestionnaire.new&lt;br /&gt;
      questionnaire.name = 'Revision Plan Questionnaire'&lt;br /&gt;
      questionnaire.instructor_id = assignment.instructor_id&lt;br /&gt;
      questionnaire.max_question_score = 5&lt;br /&gt;
      questionnaire.save&lt;br /&gt;
      questionnaire_team_map = RevisionPlanTeamMap.create(team_id: assignment_team.id, used_in_round: current_round, questionnaire_id: questionnaire.id)&lt;br /&gt;
    end&lt;br /&gt;
    return questionnaire&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method returns the team associated to a revision plan questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def team&lt;br /&gt;
    revision_plan_team_map.team&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Added a new type of questionnaire &amp;lt;code&amp;gt;'RevisionPlanQuestionnaire'&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;QUESTIONNAIRE_TYPES&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  QUESTIONNAIRE_TYPES = ['ReviewQuestionnaire',&lt;br /&gt;
                        ...&lt;br /&gt;
                        ...&lt;br /&gt;
                         'RevisionPlanQuestionnaire'].freeze&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SidharthMehta/expertiza/blob/1b54cf6c7aa2b1195c5259a4ee616f21fc2f37a3/app/controllers/revision_plan_questionnaires_controller.rb ''app/controllers/revision_plan_questionnaires_controller.rb'']&lt;br /&gt;
&lt;br /&gt;
Added a controller &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;. The controller derives from &amp;lt;code&amp;gt;QuestionnairesController&amp;lt;/code&amp;gt;, it overrides the &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; action to allow creation of a &amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; for a &amp;lt;code&amp;gt;team&amp;lt;/code&amp;gt;. It also updates permissions for controller.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    case params[:action]&lt;br /&gt;
    when 'edit'&lt;br /&gt;
      questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
      questionnaire.team.users.collect { |u| u.id }.include? session[:user].id || super&lt;br /&gt;
      (user_logged_in? &amp;amp;&amp;amp; questionnaire.team.users.collect { |u| u.id }.include?(session[:user].id)) || super&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    begin&lt;br /&gt;
      questionnaire = RevisionPlanQuestionnaire.get_questionnaire_for_current_round(params[:team_id])&lt;br /&gt;
      redirect_to action: 'edit', id: questionnaire.id&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      flash[:error] = $ERROR_INFO&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''config/routes.rb'' &lt;br /&gt;
&lt;br /&gt;
Add routes for &amp;lt;code&amp;gt;RevisionPlanQuestionnairesController&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  resources :revision_plan_questionnaires, controller: :revision_plan_questionnaires, only: %i[new edit update] do&lt;br /&gt;
    collection do&lt;br /&gt;
      post :add_new_questions&lt;br /&gt;
      post :save_all_questions&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Add a view to edit Revision Plan&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/blob/d97eb1c1fc8d578b18f51401dc713b0d04815fe4/app/views/revision_plan_questionnaires/edit.html.erb ''app/views/revision_plan_questionnaires/edit.html.erb'']&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= render :partial =&amp;gt; 'question_weight' %&amp;gt;&lt;br /&gt;
  &amp;amp;lt;h1&amp;amp;gt;Edit &amp;lt;%= @questionnaire.display_type %&amp;gt;&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
  &amp;lt;%= render :partial =&amp;gt; 'questions' %&amp;gt;&lt;br /&gt;
  &amp;amp;lt;br /&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;a href=&amp;quot;javascript:window.history.back()&amp;quot;&amp;amp;gt;Back&amp;amp;lt;/a&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Refactor code to display questions into a partial. Allows for code reuse.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/questionnaires_controller.rb''&lt;br /&gt;
&lt;br /&gt;
Updated &amp;lt;code&amp;gt;redirect_to&amp;lt;/code&amp;gt; links for &amp;lt;code&amp;gt;add_new_questions&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;save_all_questions&amp;lt;/code&amp;gt; methods.&lt;br /&gt;
&lt;br /&gt;
  redirect_to action: 'edit', id: questionnaire_id.to_sym&lt;br /&gt;
&lt;br /&gt;
''app/views/questionnaires/_questionnaire.html.erb''&lt;br /&gt;
&lt;br /&gt;
This file generates a view to edit/create a new questionnaire. It has functionality to display questions and some functions that are not needed for revision plan questionnaire. To enable code reuse the functionality to add/edit/remove/save questions was moved to a new partial ''app/views/questionnaires/_questions.html.erb''.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/blob/d97eb1c1fc8d578b18f51401dc713b0d04815fe4/app/views/questionnaires/_questions.html.erb ''app/views/questionnaires/_questions.html.erb'']&lt;br /&gt;
&lt;br /&gt;
*Add code to allow users to delete questions from revision plan questionnaire.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/questions_controller.rb ''&lt;br /&gt;
&lt;br /&gt;
Update authorization code to allow a user to remove questions from his teams revision plan.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    if ['destroy'].include?(params[:action])&lt;br /&gt;
      question = Question.find(params[:id])&lt;br /&gt;
      if(user_logged_in? &amp;amp;&amp;amp; question.questionnaire.owner?(session[:user].id))&lt;br /&gt;
        return true&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    current_user_has_ta_privileges?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def destroy&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    if(question.questionnaire.type == 'RevisionPlanQuestionnaire')&lt;br /&gt;
      redirect_to edit_revision_plan_questionnaire_path(questionnaire_id.to_s.to_sym)&lt;br /&gt;
    else&lt;br /&gt;
      redirect_to edit_questionnaire_path(questionnaire_id.to_s.to_sym)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Method returns true if user owns questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def owner?(user_id)&lt;br /&gt;
    instructor_id == user_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/revision_plan_questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Overrides implementation for &amp;lt;code&amp;gt;owner?&amp;lt;/code&amp;gt; defined in &amp;lt;code&amp;gt;Questionnaire&amp;lt;/code&amp;gt; to return true if a team owns the questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def owner?(user_id)&lt;br /&gt;
    team.users.map{ |u| u.id }.include?(user_id) || super&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Add code to allow users to access show/edit advice functionality for revision plan questions.&lt;br /&gt;
&lt;br /&gt;
''app/controllers/advice_controller.rb''&lt;br /&gt;
&lt;br /&gt;
Update authorization code to allow a user to update advice his teams revision plan.&lt;br /&gt;
&lt;br /&gt;
  def action_allowed?&lt;br /&gt;
    questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if(user_logged_in? &amp;amp;&amp;amp; questionnaire.owner?(session[:user].id))&lt;br /&gt;
      return true&lt;br /&gt;
    end&lt;br /&gt;
    current_user_has_ta_privileges?&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/views/advice/edit_advice.html.erb''&lt;br /&gt;
&lt;br /&gt;
Update 'Back to questionnaire' link.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @questionnaire.type == 'RevisionPlanQuestionnaire'%&amp;gt;&lt;br /&gt;
    &amp;lt;%= link_to 'Back to questionnaire', :controller =&amp;gt; 'revision_plan_questionnaires', :action =&amp;gt; 'edit', :id =&amp;gt; @questionnaire.id %&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= link_to 'Back to questionnaire', :controller =&amp;gt; 'questionnaires', :action =&amp;gt; 'edit', :id =&amp;gt; @questionnaire.id %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Reviewing an Assignment====&lt;br /&gt;
Once the Revision Plan Questionnaire and its resubmission round have been finished, the Revision Plan Questionnaire is appended to the Assignment Questionnaire for that round.&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:Review_Wireframe.png|400px|thumb|center|Wireframe of Completing a Review for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Revision_Plan_Questionnaire.png|400px|thumb|center|Review page demonstrating added Revision Plan questions]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
*Add Revision Plan questions to Response&lt;br /&gt;
&lt;br /&gt;
''app/controllers/response_controller.rb''&lt;br /&gt;
&lt;br /&gt;
This methods gets questions sorted by sequence from review and revision questionnaire and merges them in a single list.&lt;br /&gt;
&lt;br /&gt;
  def set_questions_for_new_response&lt;br /&gt;
    @questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    if(@assignment &amp;amp;&amp;amp; @assignment.is_revision_planning_enabled)&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @revision_plan_questionnaire = RevisionPlanTeamMap.find_by(team_id: @map.reviewee_id, used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
      if(@revision_plan_questionnaire)&lt;br /&gt;
        @questions += sort_questions(@revision_plan_questionnaire.questions)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    return @questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method gets questions from a response instead of questionnaire. We use this when response has already been created.&lt;br /&gt;
&lt;br /&gt;
  def set_questions&lt;br /&gt;
    @questions = @response.get_questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
 &lt;br /&gt;
Added a method to get all the questionnaires for a response, response is a collection of answers. Answers contain reference to their question, and question have a reference to questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def questionnaires_by_answers(answers)&lt;br /&gt;
    answers_with_questionnaires = answers.select{ |ans|  ans &amp;amp;&amp;amp; ans.question &amp;amp;&amp;amp; ans.question.questionnaire }&lt;br /&gt;
    questionnaires = answers_with_questionnaires.collect{ |ans| ans.question.questionnaire }.uniq&lt;br /&gt;
    unless(questionnaires.any?)&lt;br /&gt;
      questionnaires = []&lt;br /&gt;
      questionnaires &amp;lt;&amp;lt; questionnaire_by_answer(answers.first)&lt;br /&gt;
    end&lt;br /&gt;
    questionnaires&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This method gets all the questions for a response.&lt;br /&gt;
&lt;br /&gt;
  def get_questions&lt;br /&gt;
    @questions = []&lt;br /&gt;
    questionnaires = questionnaires_by_answers(scores)&lt;br /&gt;
    questionnaires.each {|questionnaire| @questions += questionnaire.questions }&lt;br /&gt;
    return @questions&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
*Separating questions by their questionnaire type&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;construct_review_response&amp;lt;/code&amp;gt; method has been updated to create separate tables for review questions, revision questions and additional comment.&lt;br /&gt;
&lt;br /&gt;
''app/models/questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Add a method to check if heading is to be displayed for the questionnaire.&lt;br /&gt;
&lt;br /&gt;
  def display_heading?&lt;br /&gt;
    return false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/revision_plan_questionnaire.rb''&lt;br /&gt;
&lt;br /&gt;
Overriding the method defined in questionnaire.rb to display heading for revision plan questionnaire.&lt;br /&gt;
 &lt;br /&gt;
  def display_heading?&lt;br /&gt;
    return true&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/views/response/response.html.erb''&lt;br /&gt;
&lt;br /&gt;
View groups questions by questionnaire type and then adds a heading for questionnaires that return true for &amp;lt;code&amp;gt;display_heading?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Bug fix:''' The existing implementation has a bug where the first question in a questionnaire is displayed last in response. This was fixed as well.&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant is able to view their team's score.  The UI below shows what this looks like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor are shown under '''Assignment Questionnaire.'''  The results of the questions created by the team are shown under '''Improvement Plan.'''&lt;br /&gt;
&lt;br /&gt;
=====Initial Wireframe=====&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
=====Final UI=====&lt;br /&gt;
[[File:Summary_Report.png|600px|thumb|center|Summary Report page demonstrating added Revision Plan heatgrid]]&lt;br /&gt;
&lt;br /&gt;
=====Implementation=====&lt;br /&gt;
&lt;br /&gt;
*Show revision plan questions in heat grid.&lt;br /&gt;
&lt;br /&gt;
Heat grids for review responses are currently implemented in a view model defined in ''vm_question_response.rb''.  All functionality of this view model has remained in place, and additional responses are passed to it to create the additional heat grids for revision plan responses.&lt;br /&gt;
&lt;br /&gt;
''app/helpers/grades_helper.rb''&lt;br /&gt;
&lt;br /&gt;
The method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; was created from the original code shared by both &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; in ''app/controllers/grades_controller'', but with the additional functionality of checking for Revision Plans in responses.  When &amp;lt;code&amp;gt;assignment.vary_by_round&amp;lt;/code&amp;gt;, an additional heatgrid is added for each round of Revision Planning.  When &amp;lt;code&amp;gt;!assignment.vary_by_round&amp;lt;/code&amp;gt;, only one heatgrid is added for the Revision Plan used in the most recent round of review.&lt;br /&gt;
&lt;br /&gt;
  def generate_heatgrid(participant, assignment, team, team_id, questionnaires, vmlist)&lt;br /&gt;
    counter_for_revisions = -1&lt;br /&gt;
    counter_for_same_rubric = 0&lt;br /&gt;
    questionnaires.each do |questionnaire|&lt;br /&gt;
      if assignment.vary_by_round? &amp;amp;&amp;amp; questionnaire.type == &amp;quot;ReviewQuestionnaire&amp;quot;&lt;br /&gt;
        questionnaires = AssignmentQuestionnaire.where(assignment_id: assignment.id, questionnaire_id: questionnaire.id)&lt;br /&gt;
        if questionnaires.count &amp;gt; 1&lt;br /&gt;
          @round = questionnaires[counter_for_same_rubric].used_in_round&lt;br /&gt;
          counter_for_same_rubric += 1&lt;br /&gt;
        else&lt;br /&gt;
          @round = questionnaires[0].used_in_round&lt;br /&gt;
          counter_for_same_rubric = 0&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      add_response_to_vmlist(participant, assignment, team, questionnaire, vmlist, @round)&lt;br /&gt;
      if assignment.vary_by_round? &amp;amp;&amp;amp; assignment.is_revision_planning_enabled?&lt;br /&gt;
        rp_questionnaire = RevisionPlanTeamMap.find_by(team: Team.find(team_id), used_in_round: counter_for_revisions).try(:questionnaire)&lt;br /&gt;
        if rp_questionnaire&lt;br /&gt;
          add_response_to_vmlist(participant, assignment, team, rp_questionnaire, vmlist, @round)&lt;br /&gt;
        end&lt;br /&gt;
        counter_for_revisions += 1&lt;br /&gt;
      elsif assignment.is_revision_planning_enabled? &amp;amp;&amp;amp; questionnaire == questionnaires.last&lt;br /&gt;
        if assignment.get_current_stage == &amp;quot;Finished&amp;quot;&lt;br /&gt;
          current_round = assignment.rounds_of_reviews&lt;br /&gt;
        else&lt;br /&gt;
          reviewees_topic = SignedUpTeam.topic_id_by_team_id(participant.id)&lt;br /&gt;
          current_round = assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
        end&lt;br /&gt;
        rp_questionnaire = RevisionPlanTeamMap.find_by(team: Team.find(team_id), used_in_round: current_round).try(:questionnaire)&lt;br /&gt;
        if rp_questionnaire&lt;br /&gt;
          add_response_to_vmlist(participant, assignment, team, rp_questionnaire, vmlist, @round)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The method &amp;lt;code&amp;gt;add_response_to_vmlist&amp;lt;/code&amp;gt; was added to refactor the code that is used multiple times to add another review to the view model.&lt;br /&gt;
&lt;br /&gt;
  def add_response_to_vmlist(participant, assignment, team, questionnaire, vmlist, round)&lt;br /&gt;
    vm = VmQuestionResponse.new(questionnaire, assignment, round)&lt;br /&gt;
    vmquestions = questionnaire.questions&lt;br /&gt;
    vm.add_questions(vmquestions)&lt;br /&gt;
    vm.add_team_members(team)&lt;br /&gt;
    vm.add_reviews(participant, team, assignment.vary_by_round)&lt;br /&gt;
    vm.number_of_comments_greater_than_10_words&lt;br /&gt;
    vmlist &amp;lt;&amp;lt; vm&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/helpers/summary_helper.rb''&lt;br /&gt;
&lt;br /&gt;
'''Bug Fix:''' Reverted &amp;lt;code&amp;gt;get_sentences&amp;lt;/code&amp;gt; back to version in master branch to prevent Active Record Error caused by beta version of code.&lt;br /&gt;
&lt;br /&gt;
  def get_sentences(ans)&lt;br /&gt;
    unless ans.comments.nil?&lt;br /&gt;
      ans.comments.gsub!(/[.?!]/, '\1|')&lt;br /&gt;
      sentences = ans.comments.split('|')&lt;br /&gt;
      sentences.map!(&amp;amp;:strip)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/models/vm_question_response.rb''&lt;br /&gt;
&lt;br /&gt;
Allow &amp;lt;code&amp;gt;RevisionPlanQuestionnaires&amp;lt;/code&amp;gt; to be added to the view model in the same way as &amp;lt;code&amp;gt;ReviewQuestionnaires&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  if (@questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; or @questionnaire_type == &amp;quot;RevisionPlanQuestionnaire&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
''app/views/grades/view_team.html.erb''&lt;br /&gt;
&lt;br /&gt;
Print round number headings for Revision Plan heat grids.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if vm.questionnaire_type == &amp;quot;ReviewQuestionnaire&amp;quot; or vm.questionnaire_type == &amp;quot;RevisionPlanQuestionnaire&amp;quot;%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Separated Review and Revision Plan questions in response&lt;br /&gt;
&lt;br /&gt;
''app/models/response.rb''&lt;br /&gt;
&lt;br /&gt;
Created separate arrays for ReviewQuestionnaire questions and RevsionPlanQuestionnaire questions.  Added headings for Review Responses and Revision Plan Responses. &lt;br /&gt;
&lt;br /&gt;
  review_questions = []&lt;br /&gt;
  revision_plan_questions = []&lt;br /&gt;
  #begin table for Review Responses&lt;br /&gt;
  ...&lt;br /&gt;
  map = ResponseMap.find(self.map_id)&lt;br /&gt;
  unless map.is_a? ReviewResponseMap&lt;br /&gt;
    code = add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
  else&lt;br /&gt;
    assignment = map.assignment&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      if(question.questionnaire.type == 'ReviewQuestionnaire')&lt;br /&gt;
        review_questions.append(question)&lt;br /&gt;
      elsif(question.questionnaire.type == 'RevisionPlanQuestionnaire')&lt;br /&gt;
        revision_plan_questions.append(question)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    code = add_table_rows questionnaire_max, review_questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
    if assignment.is_revision_planning_enabled&lt;br /&gt;
    #end table for Review Responses and begin table for Revision Plan Responses&lt;br /&gt;
      code = add_table_rows questionnaire_max, revision_plan_questions, answers, code, tag_prompt_deployments, current_user&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
*Refactored &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''app/controllers/grades_controller.rb''&lt;br /&gt;
&lt;br /&gt;
The code in the &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; method was almost identical to the code in the &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; method in ''app/helpers/grades_helper.rb''.  It was refactored into a new method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; in ''app/helpers/grades_helper.rb'' and used in &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  def view_team&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    @questions = retrieve_questions questionnaires, @assignment.id&lt;br /&gt;
    @pscore = @participant.scores(@questions)&lt;br /&gt;
    @vmlist = []&lt;br /&gt;
    generate_heatgrid(@participant, @assignment, @team, @team_id, questionnaires, @vmlist)&lt;br /&gt;
    @current_role_name = current_role_name&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''app/helpers/grades_helper.rb''&lt;br /&gt;
&lt;br /&gt;
The code in the &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt; method was almost identical to the code in the &amp;lt;code&amp;gt;view_team&amp;lt;/code&amp;gt; method in ''app/controllers/grades_controller.rb''.  It was refactored into a new method &amp;lt;code&amp;gt;generate_heatgrid&amp;lt;/code&amp;gt; and used in &amp;lt;code&amp;gt;view_heatgrid&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  def view_heatgrid(participant_id, type)&lt;br /&gt;
    # get participant, team, questionnaires for assignment.&lt;br /&gt;
    @participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
    @type = type&lt;br /&gt;
    questionnaires = @assignment.questionnaires&lt;br /&gt;
    @vmlist = []&lt;br /&gt;
    generate_heatgrid(@participant, @assignment, @team, @team_id, questionnaires, @vmlist)&lt;br /&gt;
    render &amp;quot;grades/view_heatgrid.html.erb&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
[[File:Revision Planning Control Flow Diagram.jpeg|400px|thumb|center|Control Flow of the Revision Planning Function]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan - Under progress===&lt;br /&gt;
&lt;br /&gt;
====RSpec Testing====&lt;br /&gt;
The RSpec tests are written to test both controller and models.&lt;br /&gt;
&lt;br /&gt;
Controllers&lt;br /&gt;
&lt;br /&gt;
*spec/controllers/grades_controller_spec.rb:&lt;br /&gt;
&lt;br /&gt;
*spec/controllers/revision_plan_questionnaires_controller_spec.rb: test revision plan questionnaire can be created and edited.&lt;br /&gt;
&lt;br /&gt;
*spec/controllers/assignments_controller_spec.rb: create and validate an assignment with revision planning enabled.&lt;br /&gt;
&lt;br /&gt;
*spec/controllers/response_controller_spec.rb: Updated spec to pass build by stubbing &amp;lt;code&amp;gt;get_questions&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
Models&lt;br /&gt;
&lt;br /&gt;
*spec/models/revision_plan_questionnaire_spec.rb:&lt;br /&gt;
&lt;br /&gt;
*spec/models/revision_plan_team_map_spec.rb:&lt;br /&gt;
&lt;br /&gt;
*spec/models/response_spec.rb: Updated spec to pass build by updating expected html output.&lt;br /&gt;
&lt;br /&gt;
*spec/models/review_response_map_spec.rb: Updated spec to pass build by updating expected html output.&lt;br /&gt;
&lt;br /&gt;
Features&lt;br /&gt;
&lt;br /&gt;
''spec/features/assignment_creation_general_tab_spec.rb''&lt;br /&gt;
&lt;br /&gt;
Test if checking box tag &amp;lt;code&amp;gt;Revision Planning?&amp;lt;/code&amp;gt; could enable revision planning.&lt;br /&gt;
&lt;br /&gt;
  it &amp;quot;should enable revision planning&amp;quot; do&lt;br /&gt;
      fill_assignment_form&lt;br /&gt;
      check(&amp;quot;assignment_form_assignment_is_revision_planning_enabled&amp;quot;)&lt;br /&gt;
      click_button 'Save'&lt;br /&gt;
      assignment = Assignment.where(name: 'edit assignment for test').first&lt;br /&gt;
      expect(assignment).to have_attributes(&lt;br /&gt;
          name: 'edit assignment for test',&lt;br /&gt;
          course_id: Course.find_by(name: 'Course 2').id,&lt;br /&gt;
          directory_path: 'testDirectory1',&lt;br /&gt;
          spec_location: 'testLocation1',&lt;br /&gt;
          is_revision_planning_enabled: true,&lt;br /&gt;
      )&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
Manual testing aims to verify the following:&lt;br /&gt;
* Create an assignment with revision planning enabled.&lt;br /&gt;
* Are participants allowed to create/edit revision plan when round 1+ (1 or greater than 1) reviews have finished.&lt;br /&gt;
* Is revision plan editing disabled when assignment is in review stage.&lt;br /&gt;
* Are reviewers shown questions created by reviewees.&lt;br /&gt;
* Are participants shown summary of score for revision plan after review deadline has expired.&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# Previous Implementation: [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875 wiki], [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016 wiki] &lt;br /&gt;
# Forked Repository: [https://github.com/SidharthMehta/expertiza/tree/beta E2083 github]&lt;br /&gt;
# Pull Request: [https://github.com/expertiza/expertiza/pull/1832 E2083 pull request]&lt;br /&gt;
# Demo: [https://youtu.be/7pdz_A8vDkk E2083 demo video]&lt;br /&gt;
# Deployment: [http://152.7.98.99:8080/ temporary deployment link]&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=136401</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=136401"/>
		<updated>2020-10-28T19:13:13Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza. In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementations===&lt;br /&gt;
Revision planning has been implemented twice before, once in [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875] and once in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016]. While the functionality worked and effectively minimized changes to the code, they also had the following problems:&lt;br /&gt;
*Hardcoded “round” numbers in many places of the code.&lt;br /&gt;
*Documentation does not reflect the new changes they made.&lt;br /&gt;
*Revision planning responses and responses to the other items are not distinguished in heatgrid view.&lt;br /&gt;
*The idea of adding a &amp;lt;code&amp;gt;team_id&amp;lt;/code&amp;gt; field to each question is intuitive. However, they failed to come up with a clean implementation of this idea. Specifically, they had passed some trailing parameters several methods down before reaching the place that needs them.&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
To implement revision planning, [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016] added &amp;lt;code&amp;gt;EnableRevisionPlan&amp;lt;/code&amp;gt; (boolean) to &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;TeamID&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;Question&amp;lt;/code&amp;gt;.  Adding a boolean to enable revision planning for an assignment makes sense, but having certain questions belong to a team is not a clean implementation. Instead, we will create a new questionnaire that will belong to each team and keep track of the set of questions. We will use this new questionnaire to separate the revision plan responses and responses to other items in heatgrid view by creating a different table for each.&lt;br /&gt;
&lt;br /&gt;
===Files Modified===&lt;br /&gt;
This is a list of files requiring modification and will be updated as the implementation progresses. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Changed'': &amp;lt;br&amp;gt;&lt;br /&gt;
controllers/questionnaires_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
controllers/response_controller.rb&amp;lt;br&amp;gt;&lt;br /&gt;
controllers/grades_controller.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/response.rb&amp;lt;br&amp;gt;&lt;br /&gt;
models/assignment_team.rb&amp;lt;br&amp;gt;&lt;br /&gt;
views/questionnaires/_questioinnaire.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
views/student_task/view.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
views/assignments/edit/_review_strategy.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
views/response/view.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
views/response/response.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
views/grades/_review.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Added'': &amp;lt;br&amp;gt;&lt;br /&gt;
controllers/revision_plan_questionnaire.rb &amp;lt;br&amp;gt;&lt;br /&gt;
models/revision_plan_questionnaire.rb &amp;lt;br&amp;gt;&lt;br /&gt;
views/questionnaires/edit_revision_plan.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
Items in green are additions.&lt;br /&gt;
[[File:E2083_Proposed_Design.png|1000px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
In the assignment table we will add &amp;lt;code&amp;gt;is_revision_enabled?&amp;lt;/code&amp;gt; column to indicate whether the assignment accepts a revision plan along with review rubric.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; maps a questionnaire to an assignment team and round. This will map to a questionnaire that will be created by the reviewee.&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
# A team would be allowed to create a &amp;lt;code&amp;gt;RevisionPlanQuestionnaire&amp;lt;/code&amp;gt; after completion of round 1 of review. This revision plan questionnaire would be linked to the next round and to the team. Team would be able to add questions to this revision plan questionnaire. &lt;br /&gt;
# Reviewer would be displayed questions of both the original assignment review rubric and reviewee created revision plan. To achieve this we will create a &amp;lt;code&amp;gt;CompositeQuestionnaire&amp;lt;/code&amp;gt; by combining the two questionnaires. This composite questionnaire would not have any revision plan or review rubric based code. &lt;br /&gt;
#* Composite questionnaire will be created in the following:&lt;br /&gt;
## When revision plan is enabled and a questionnaire is requested from &amp;lt;code&amp;gt;ReviewResponseMap&amp;lt;/code&amp;gt;.&lt;br /&gt;
## When revision plan is enabled and questionnaire is requested from response.&lt;br /&gt;
#* Composite questionnaire would have a function &amp;lt;code&amp;gt;questions&amp;lt;/code&amp;gt; to return questions of contained questionnaires.&lt;br /&gt;
# The Response currently displays section headings using &amp;lt;code&amp;gt;SectionHeader&amp;lt;/code&amp;gt;. SectionHeader is a child class of &amp;lt;code&amp;gt;QuestionnaireHeader&amp;lt;/code&amp;gt; which itself derives from &amp;lt;code&amp;gt;Question&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt; A new &amp;lt;code&amp;gt;QuestionnaireNameHeader&amp;lt;/code&amp;gt; class which derives from QuestionnaireHeader will be created to display name of Questionnaire (Improvement Plan/Assignment) in a way which is similar to how we show section headings in UI.&lt;br /&gt;
&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Enable Revision Planning====&lt;br /&gt;
In order to enable '''Revision Planning''', the setting must be enabled when creating or editing an assignment under the '''General''' tab.  The wireframe below demonstrates creating an assignment, and editing the assignment functions similarly.  '''Improvement plan?''' should be checked to enable this option. &lt;br /&gt;
&lt;br /&gt;
[[File:Enable_Revision_Planning_Wireframe.png|700px|thumb|center|Wireframe of Enabling Assignment's Revision Planning]]&lt;br /&gt;
&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to a page explained under the ‘Revision planning page’ subsection.&lt;br /&gt;
&lt;br /&gt;
[[File:Link_to_the_revision_planning.jpeg|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking '''Remove''' in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods. &lt;br /&gt;
 &lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|600px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant will be able to view their team's score.  The wireframe below shows what this will look like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor will be shown under '''Assignment Questionnaire.'''  The results of the questions created by the team will be shown under '''Improvement Plan.'''&lt;br /&gt;
&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
[[File:Revision Planning Control Flow Diagram.jpeg|400px|thumb|center|Control Flow of the Revision Planning Function]]&lt;br /&gt;
&lt;br /&gt;
===Test Plan===&lt;br /&gt;
&lt;br /&gt;
====RSpec Testing====&lt;br /&gt;
The RSpec tests would test both controller and models.&lt;br /&gt;
&lt;br /&gt;
Controllers&lt;br /&gt;
* spec/controllers/questionnaires_controller_spec.rb: test revision plan questionnaire can be created and edited.&lt;br /&gt;
* spec/controllers/assignments_controller_spec.rb: create and validate an assignment with revision planning enabled.&lt;br /&gt;
&lt;br /&gt;
Models&lt;br /&gt;
Test validations and logic present in revision plan and composite questionnaire models.&lt;br /&gt;
* spec/models/revision_plan_questionnaire_spec.rb&lt;br /&gt;
* spec/models/composite_questionnaire_spec.rb&lt;br /&gt;
&lt;br /&gt;
====Manual Testing====&lt;br /&gt;
Manual testing will aim to verify the following:&lt;br /&gt;
* Create an assignment with revision planning enabled.&lt;br /&gt;
* Are participants allowed to create/edit revision plan when round 1+ (1 or greater than 1) reviews have finished.&lt;br /&gt;
* Is revision plan editing disabled when assignment is in review stage.&lt;br /&gt;
* Are reviewers shown questions created by reviewees.&lt;br /&gt;
* Are participants shown summary of score for revision plan after review deadline has expired.&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# Previous Implementation: [https://expertiza.csc.ncsu.edu/index.php/E1875_Revision_Planning_Tool E1875 wiki], [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2020_E2016_Revision_planning_tool E2016 wiki] &lt;br /&gt;
# Forked Repository: [https://github.com/SidharthMehta/expertiza/tree/beta E2083 github]&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135858</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135858"/>
		<updated>2020-10-20T22:59:52Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Control Flow Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza.  In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to a page explained under the ‘Revision planning page’ subsection.&lt;br /&gt;
&lt;br /&gt;
[[File:Link_to_the_revision_planning.jpeg|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking &amp;quot;Remove&amp;quot; in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods.  &lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|600px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant will be able to view their team's score.  The wireframe below shows what this will look like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor will be shown under &amp;quot;Assignment Questionnaire.&amp;quot;  The results of the questions created by the team will be shown under &amp;quot;Improvement Plan.&amp;quot;&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
[[File:Revision Planning Control Flow Diagram.jpeg|400px|thumb|center|Control Flow of the Revision Planning Function]]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Revision_Planning_Control_Flow_Diagram.jpeg&amp;diff=135857</id>
		<title>File:Revision Planning Control Flow Diagram.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Revision_Planning_Control_Flow_Diagram.jpeg&amp;diff=135857"/>
		<updated>2020-10-20T22:57:06Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135837</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135837"/>
		<updated>2020-10-20T22:05:30Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Assignment Overview Page (contains the Link to the revision planning page) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza.  In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to a page explained under the ‘Revision planning page’ subsection.&lt;br /&gt;
&lt;br /&gt;
[[File:Link_to_the_revision_planning.jpeg|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking &amp;quot;Remove&amp;quot; in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods.  &lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|600px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant will be able to view their team's score.  The wireframe below shows what this will look like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor will be shown under &amp;quot;Assignment Questionnaire.&amp;quot;  The results of the questions created by the team will be shown under &amp;quot;Improvement Plan.&amp;quot;&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Link_to_the_revision_planning.jpeg&amp;diff=135836</id>
		<title>File:Link to the revision planning.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Link_to_the_revision_planning.jpeg&amp;diff=135836"/>
		<updated>2020-10-20T22:05:01Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135833</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135833"/>
		<updated>2020-10-20T22:01:20Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Assignment Overview Page (contains the Link to the revision planning page) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza.  In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to a page explained under the ‘Revision planning page’ subsection.&lt;br /&gt;
&lt;br /&gt;
[[File:Link_to_the_revision_planning.png|600px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking &amp;quot;Remove&amp;quot; in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods.  &lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|600px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant will be able to view their team's score.  The wireframe below shows what this will look like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor will be shown under &amp;quot;Assignment Questionnaire.&amp;quot;  The results of the questions created by the team will be shown under &amp;quot;Improvement Plan.&amp;quot;&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135832</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135832"/>
		<updated>2020-10-20T22:00:42Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Assignment Overview Page (contains the Link to the revision planning page) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza.  In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
The '''Revision Planning''' link is available to students during every submission period (except the first round submission) and not available during every review period. As shown in the wireframe, by clicking '''Revision Planning''' students would be redirected to a page explained under the ‘Revision planning page’ subsection.&lt;br /&gt;
&lt;br /&gt;
[[File:Link_to_the_revision_planning.png|400px|thumb|center|Wireframe of Assignment Overview Page]]&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking &amp;quot;Remove&amp;quot; in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods.  &lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|600px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant will be able to view their team's score.  The wireframe below shows what this will look like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor will be shown under &amp;quot;Assignment Questionnaire.&amp;quot;  The results of the questions created by the team will be shown under &amp;quot;Improvement Plan.&amp;quot;&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Link_to_the_revision_planning.png&amp;diff=135828</id>
		<title>File:Link to the revision planning.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Link_to_the_revision_planning.png&amp;diff=135828"/>
		<updated>2020-10-20T21:47:52Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135827</id>
		<title>CSC/ECE 517 Fall 2020 - E2083. Revision planning tool E2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2083._Revision_planning_tool_E2016&amp;diff=135827"/>
		<updated>2020-10-20T21:39:28Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Submission Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Rounds of peer reviews may be implemented between submissions for assignments on Expertiza.  In order to better track the implementation of reviewer's suggestions, a Revision Planning Tool should be implemented.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In the first round of Expertiza reviews, we ask reviewers to give authors some guidance on how to improve their work. Then in the second round, reviewers rate how well authors have followed their suggestions. We could carry the interaction one step further if we asked authors to make up a revision plan based on the first-round reviews. That is, authors would say what they were planning to do to improve their work. Then second-round reviewers would assess how well they did it. In essence, this means that authors would be adding criteria to the second-round rubric that applied only to their submission. We are interested in having this implemented and used in a class so that we can study its effect.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Database Design===&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
===User Interface===&lt;br /&gt;
====Assignment Overview Page (contains the Link to the revision planning page)====&lt;br /&gt;
&lt;br /&gt;
====Editing the Revision Plan Questionnaire====&lt;br /&gt;
After creating the Revision Plan Questionnaire, it must be edited.  Questions can be added by specifying the amount of questions and their type.  Questions can be removed by clicking &amp;quot;Remove&amp;quot; in the leftmost column.  Once the questionnaire is complete, it can be saved.  This page will be visible during each submission period after the first and will be unavailable during all review periods.  &lt;br /&gt;
[[File:Edit_Revision_Plan_Wireframe.png|600px|thumb|center|Wireframe of Editing an Assignment's Revision Plan]]&lt;br /&gt;
&lt;br /&gt;
====Summary Report Page====&lt;br /&gt;
When a project has been reviewed at least once, a participant will be able to view their team's score.  The wireframe below shows what this will look like after the second round of reviews.  For the second and all subsequent reviews, the results of questions that were created by the instructor will be shown under &amp;quot;Assignment Questionnaire.&amp;quot;  The results of the questions created by the team will be shown under &amp;quot;Improvement Plan.&amp;quot;&lt;br /&gt;
[[File:View_Scores_Wireframe.png|400px|thumb|center|Wireframe of Summary Report for an Assignment]]&lt;br /&gt;
&lt;br /&gt;
===Control Flow Diagram===&lt;br /&gt;
==Team Members==&lt;br /&gt;
Chaitanya Mehta (cmehta)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Darby Madewell (demadewe)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Dongni Yang (dyang23)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Sidharth Mehta (smehta22)&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
'''Mentor:''' Yulin Zhang (yzhan114)&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134738</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134738"/>
		<updated>2020-10-12T18:58:28Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
'''action_allowed method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
'''view method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:updated_comment_waiting_list.PNG]]&lt;br /&gt;
[[File:added_requirements_method.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. The original line had a complex conditional that made the code hard to read. This conditional was moved to a new method in which it was refactored and commented to be more understandable and readable.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue5 fix.png|1000px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue5 fix2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Moved '''@teammate_review_allowed''' 's condition to '''due_date.rb''' so the code is more readable.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue9 fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Both '''advertise_for_partners''' and '''remove_advertisement''' are necessary in terms of readability.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue12 fix.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Clarified what review method intends to do.&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
File: spec/controllers/student_teams_controller_spec.rb &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe StudentTeamsController do&lt;br /&gt;
  let (:student_teams_controller) { StudentTeamsController.new }&lt;br /&gt;
  let(:student) { double &amp;quot;student&amp;quot; }&lt;br /&gt;
  describe '#view' do&lt;br /&gt;
    it 'sets the student' do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).with('12345').and_return student&lt;br /&gt;
      allow(student_teams_controller).to receive(:current_user_id?)&lt;br /&gt;
      allow(student_teams_controller).to receive(:params).and_return(student_id: '12345')&lt;br /&gt;
      allow(student).to receive(:user_id)&lt;br /&gt;
      student_teams_controller.view&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134737</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134737"/>
		<updated>2020-10-12T18:43:24Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Add method comment for Advertise_for_partners and remove_advertisement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
'''action_allowed method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
'''view method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:updated_comment_waiting_list.PNG]]&lt;br /&gt;
[[File:added_requirements_method.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. The original line had a complex conditional that made the code hard to read. This conditional was moved to a new method in which it was refactored and commented to be more understandable and readable.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue5 fix.png|1000px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue5 fix2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Moved '''@teammate_review_allowed''' 's condition to '''due_date.rb''' so the code is more readable.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue9 fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Both '''advertise_for_partners''' and '''remove_advertisement''' are necessary in terms of readability.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue12 fix.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Clarified what review method intends to do.&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue9_fix.png&amp;diff=134736</id>
		<title>File:Issue9 fix.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue9_fix.png&amp;diff=134736"/>
		<updated>2020-10-12T18:39:20Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134735</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134735"/>
		<updated>2020-10-12T17:27:07Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Add method comment for the review method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
'''action_allowed method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
'''view method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:updated_comment_waiting_list.PNG]]&lt;br /&gt;
[[File:added_requirements_method.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. The original line had a complex conditional that made the code hard to read. This conditional was moved to a new method in which it was refactored and commented to be more understandable and readable.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue5 fix.png|1000px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue5 fix2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Moved '''@teammate_review_allowed''' 's condition to '''due_date.rb''' so the code is more readable.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue12 fix.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Clarified what review method intends to do.&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue12_fix.png&amp;diff=134734</id>
		<title>File:Issue12 fix.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue12_fix.png&amp;diff=134734"/>
		<updated>2020-10-12T17:19:59Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134732</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134732"/>
		<updated>2020-10-12T17:17:23Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Refactor @teammate_review_allowed into due_date.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
'''action_allowed method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
'''view method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:updated_comment_waiting_list.PNG]]&lt;br /&gt;
[[File:added_requirements_method.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. The original line had a complex conditional that made the code hard to read. This conditional was moved to a new method in which it was refactored and commented to be more understandable and readable.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue5 fix.png|1000px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue5 fix2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Moved '''@teammate_review_allowed''' 's condition to '''due_date.rb''' so the code is more readable.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134730</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134730"/>
		<updated>2020-10-12T17:14:34Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
'''action_allowed method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&amp;lt;br&amp;gt;&lt;br /&gt;
'''view method'''&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:updated_comment_waiting_list.PNG]]&lt;br /&gt;
[[File:added_requirements_method.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. The original line had a complex conditional that made the code hard to read. This conditional was moved to a new method in which it was refactored and commented to be more understandable and readable.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue5 fix.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue5 fix2.png]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Moved '''@teammate_review_allowed''' 's condition to '''due_date.rb''' so the code is more readable.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134728</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134728"/>
		<updated>2020-10-12T17:11:08Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Refactor @teammate_review_allowed into due_date.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue5 fix.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue5 fix2.png]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Moved '''@teammate_review_allowed''' 's condition to '''due_date.rb''' so the code is more readable.&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134726</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134726"/>
		<updated>2020-10-12T17:05:13Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png|1000px]]&lt;br /&gt;
[[File:Issue1 fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue5_fix2.png&amp;diff=134723</id>
		<title>File:Issue5 fix2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue5_fix2.png&amp;diff=134723"/>
		<updated>2020-10-12T17:02:01Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue5_fix.png&amp;diff=134722</id>
		<title>File:Issue5 fix.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue5_fix.png&amp;diff=134722"/>
		<updated>2020-10-12T17:01:37Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134721</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134721"/>
		<updated>2020-10-12T16:55:40Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134720</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134720"/>
		<updated>2020-10-12T16:55:06Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134719</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134719"/>
		<updated>2020-10-12T16:54:45Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134718</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134718"/>
		<updated>2020-10-12T16:54:13Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134717</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134717"/>
		<updated>2020-10-12T16:52:19Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134716</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134716"/>
		<updated>2020-10-12T16:50:30Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134715</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134715"/>
		<updated>2020-10-12T16:49:57Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted 'return unless current_user_id? student.user_id' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method. So that every time before view method is called, this sentence in the action_allowed method will run first.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134714</id>
		<title>CSC/ECE 517 Fall 2020 - E2067. Refactor student teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2020_-_E2067._Refactor_student_teams_controller.rb&amp;diff=134714"/>
		<updated>2020-10-12T16:43:54Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: /* Move return unless current_user_id? student.user_id into action_allowed method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Background===&lt;br /&gt;
The '''student_teams_controller.rb''' controller used in Expertiza to manipulate teams that are created for assignments. Primary functions that this controller provides is create a new team, update team name and delete members from a team.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The motivation of our work is to improve the maintainability and readability of '''student_teams_controller.rb''' Controller. Furthermore, we also fix several occasions where the '''student_teams_controller.rb''' contains code snippets that actually belongs to the model classes. This will help enforce single responsibility principle and model-view-controller pattern.&lt;br /&gt;
&lt;br /&gt;
===Task Identified===&lt;br /&gt;
* Move '''return unless current_user_id? student.user_id''' into '''action_allowed method'''&lt;br /&gt;
* Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class'''&lt;br /&gt;
* Remove variable '''current_team'''&lt;br /&gt;
* Add comment for '''@users_on_waiting_list''' and also simplify the condition&lt;br /&gt;
* Refactor '''@teammate_review_allowed''' into '''due_date.rb'''&lt;br /&gt;
* Rename '''existing_assignments?''' to '''existing_teams'''&lt;br /&gt;
* Add method comment for the '''update method'''&lt;br /&gt;
* Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?'''&lt;br /&gt;
* Add method comment for '''Advertise_for_partners''' and '''remove_advertisement'''&lt;br /&gt;
* Rename '''sign_up''' into '''signup'''&lt;br /&gt;
* Refactor code from '''remove_participant''' into '''waitlist.rb'''&lt;br /&gt;
* Add method comment for the '''review method'''&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
*/controllers/student_teams_controller.rb&lt;br /&gt;
*/models/waitlist.rb&lt;br /&gt;
*/models/due_date.rb&lt;br /&gt;
&lt;br /&gt;
==Code Review==&lt;br /&gt;
The purpose of this section is to provide the before and after change comparison so the developer can perform code review to ensure the correctness of the change. &lt;br /&gt;
&lt;br /&gt;
=== Move '''return unless current_user_id? student.user_id''' into '''action_allowed method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The action_allowed method determines whether an action is permissible, depending on the privileges of the user who is performing it.  In the view method, there is a clause that says, return unless current_user_id? student.user_id.  This needs to be moved to the when 'view' clause  in the action_allowed method.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:Issue1 fix2.png]]&lt;br /&gt;
[[File:Issue1 fix.png]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Deleted '''return unless current_user_id? student.user_id''' in the view method, and added it to a if clause under the when 'view' clause in the action_allowed method.&lt;br /&gt;
&lt;br /&gt;
=== Refactor code from '''view function''' into may or may not be necessary to add a method to the '''DueDates class''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code beginning at line 44 deals with due_dates, which are part of the “business logic” and should be moved to an appropriate model method.  Thus, @student.assignment.due_dates.each do |due_date| should invoke an appropriate method in due_date.rb.  It may or may not be necessary to add a method to the DueDates class.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''Student_teams_controller.rb'':&lt;br /&gt;
[[File:current_due_date_comparison.PNG]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''due_date.rb'':&amp;lt;br&amp;gt;        &lt;br /&gt;
[[File:due_date_method_added.PNG]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The code in the first image uses logic associated with due dates to assign a variable called '@current_due_date'. This logic was moved to a new method in the model due_dates.rb, shown in the second image. This logic was moved to to simplify the controller but also because the logic is specific to due dates and is more reasonable to be located in the due dates model.&lt;br /&gt;
&lt;br /&gt;
=== Remove variable '''current_team''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The variable current_team seems unnecessary; it only saves one character vs. @student.team. Consider removing it.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:current_team_change_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
In the red line 51 above, the variable 'current_team' is used. This variable is unnecessary as it is not significantly shorter or more descriptive. As shown in the changes between red line 53 and green line 49, the 'current_team' variable was removed and replaced with '@student.team'.&lt;br /&gt;
&lt;br /&gt;
=== Add comment for '''@users_on_waiting_list''' and also simplify the condition ===&lt;br /&gt;
* Objective&lt;br /&gt;
The code on Line 53 (@users_on_waiting_list ...) is not clear at all.  Needs at least a comment, and also the condition should not be so complicated.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:waiting_list_comment_added.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '@users_on_waiting_list' line of code needed a comment to clarify its function. At the suggestion of the teams mentor, the condition was not simplified but instead explained clearly in the comment.&lt;br /&gt;
&lt;br /&gt;
=== Refactor '''@teammate_review_allowed''' into '''due_date.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
In line 55, the @teammate_review_allowed: condition is way too complex, uses magic constants, and belongs in code in another model class (maybe due_date.rb); no way should it be in the controller!&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''existing_assignments?''' to '''existing_teams''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 59: existing_assignments is evidently a team!  So why is the variable name existing_assignments? It should perhaps be changed to existing_teams.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
[[File:existing_assignments_comparison.PNG]]&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The variable 'existing_assignments' was actually a team. To better reflect the purpose of the variable and function of the code, the name was changed from 'existing_assignments' to 'existing_teams'.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for the '''update method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The update method needs comments about what it is doing.&lt;br /&gt;
* Change Comparison (commit 7a9e39)&lt;br /&gt;
[[File:E2067_Issue7_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
The '''if''' condition checks if the new team name is NOT already exist, if so then update the team name. The '''elsif''' condition checks if the new team name is the same the current one, if so then nothing is changed. The '''else''' covers the case where the new team name is already in use, then print an error message and not changing the team name.&lt;br /&gt;
=== Change '''(matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero?''' to '''(matching_teams[0].name == team.name)?''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 95: Why isn’t (matching_teams[0].name &amp;lt;=&amp;gt; team.name).zero? just (matching_teams[0].name == team.name)?&lt;br /&gt;
* Change Comparison (commit d60d92)&lt;br /&gt;
[[File:E2067_Issue8_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
This change is straight forward to satisfy the objective of the task.&lt;br /&gt;
&lt;br /&gt;
=== Add method comment for '''Advertise_for_partners''' and '''remove_advertisement''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 108:  advertise_for_partners needs a method comment. Since its body is only 1 line, does it make sense to have a separate method for this?   It makes sense only if having a separate method improves readability.  Ditto for the remove_advertisement method at line 112.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
=== Rename '''sign_up''' into '''signup''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
The name sign_up needs to be signup; it is being used as a noun (sign_up would suggest a verb, the action of signing up).&lt;br /&gt;
* Change Comparison (commit e393ba)&lt;br /&gt;
[[File:E2067_Issue10_Fix.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
I performed a file search on '''sign_up''' and it only appears in the places shown in the screenshot. I replaced them with signup according to the objective.&lt;br /&gt;
=== Refactor code from '''remove_participant''' into '''waitlist.rb''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
remove_participant is generally good code, but handling of waitlists is again model activity, and should be moved to a model class, perhaps waitlist.rb.&lt;br /&gt;
* Change Comparison (commit 504f84)&lt;br /&gt;
[[File:E2067_Issue11_Fix1.png|1000px]]&lt;br /&gt;
[[File:E2067_Issue11_Fix2.png|1000px]]&lt;br /&gt;
* Change Explanation&lt;br /&gt;
Line 127~142 in '''student_teams_controller.rb''' are moved to Line 14~29 in '''waitlist.rb'''. The only input to the new function '''remove_from_waitlists''' in '''waitlist.rb''' requires '''params[:team_id]''' from '''student_teams_controller.rb'''.&lt;br /&gt;
=== Add method comment for the '''review method''' ===&lt;br /&gt;
* Objective&lt;br /&gt;
Line 169: The review method needs a method comment; its purpose is not clear.&lt;br /&gt;
* Change Comparison&lt;br /&gt;
&lt;br /&gt;
* Change Explanation&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
In the update method of student_teams_controller.rb, the 'elsif' needs a comment to explain its purpose. It is unclear as to why this conditional is present.&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue1_fix2.png&amp;diff=134708</id>
		<title>File:Issue1 fix2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue1_fix2.png&amp;diff=134708"/>
		<updated>2020-10-12T16:36:28Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue1_fix.png&amp;diff=134706</id>
		<title>File:Issue1 fix.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Issue1_fix.png&amp;diff=134706"/>
		<updated>2020-10-12T16:35:42Z</updated>

		<summary type="html">&lt;p&gt;Dyang23: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dyang23</name></author>
	</entry>
</feed>