<?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=Pjloheid</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=Pjloheid"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Pjloheid"/>
	<updated>2026-08-22T21:21:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134373</id>
		<title>CSC/ECE 517 Spring 2020 - E2025: Issues Related to Meta - Reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134373"/>
		<updated>2020-04-26T18:29:36Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Automated Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Overview of Project''' ==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, meta-review is a feature that enables a third party to evaluate the quality of feedback that a reviewer gives a reviewee. meta-review is an important feature that can help students become better reviewers for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified. The task is to fix these issues so that this feature can be used again.&lt;br /&gt;
&lt;br /&gt;
* An assignment is deemed to have meta-reviews if and only if there is a meta-review deadline for this assignment in the `assignments_questionnaires` table.&lt;br /&gt;
* If there is no meta-review deadline, then don’t show the question about whether there is a max meta-review limit.&lt;br /&gt;
* In the DB the default number of meta-reviews allowed and required should be null.&lt;br /&gt;
* As soon as someone checks the Has meta-review Limit box on the Review Strategy tab, the UI should fill in 3 and 3 as the required and allowed number.&lt;br /&gt;
* Student pages should show the list of reviews that have been performed.&lt;br /&gt;
* When a user requests a new meta-review, the field which says the number of meta-reviews left ( refer to above image “Numbers of Meta-reviews left:”) does not change and the button to request a new meta-review disappears.&lt;br /&gt;
&lt;br /&gt;
===Previous Work===&lt;br /&gt;
&lt;br /&gt;
This assignment is a repeat of E1997 which was assigned to students last semester, Fall 2019.&lt;br /&gt;
&lt;br /&gt;
Details of the previous implementation can be found here:&lt;br /&gt;
[http://https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1997._Issues_related_to_meta-reviewing E1997]&lt;br /&gt;
&lt;br /&gt;
Our goals are to update the logic, refactor non-DRY code, and fix bugs.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/32 #32 - Remove all debug comments in the UI]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
It was noted in the previous team's implementation that multiple debugging comments were showing up during their video testing.&lt;br /&gt;
&lt;br /&gt;
Debug messages shown when viewing a completed meta review:&lt;br /&gt;
[[File:Debug_comments.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
There was a mistake in &amp;lt;code&amp;gt;app/views/response/_review.html.erb&amp;lt;/code&amp;gt; where &amp;quot;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;hr/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;quot; was being displayed under the review being meta-reviewed. This was due to being included as a string constant rather than html code. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_comments_response_review.PNG]]&lt;br /&gt;
&lt;br /&gt;
There was an instance in &amp;lt;code&amp;gt;app/views/response/view.html.erb&amp;lt;/code&amp;gt; where ruby code responsible for getting a review to be displayed was being interpreted and displayed, even though the response was being displayed as html in the line before. This resulted in the response details being listed in the UI erroneously.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_response_view.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/49 #49 - &amp;quot;Request a new meta-review&amp;quot; button crashes when there are no available reviews]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
When there are no valid metareviews to perform (either there are no reivews performed on the assignment, the only valid reviews concern your own work or own reviews, you have completed all allowed metareviews, or you have reviewed all valid reviews already) then the &amp;quot;Request a New Review&amp;quot; button still is visible and displays the following error (correctly) when pressed.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. Log in as instructor6, click on mange...-&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
2. Click on edit assignment, navigate to Due Dates and check &amp;quot;Use meta-review deadline&amp;quot; checkbox&lt;br /&gt;
&lt;br /&gt;
3. Select &amp;quot;Yes&amp;quot; for all submission allowed, Review allowed and Meta-review allowed in all of the deadline types&lt;br /&gt;
&lt;br /&gt;
4. Navigate back to Assignment Tree View and click on &amp;quot;Add participant&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Add couple of students(say student1 and student2) to the assignment&lt;br /&gt;
&lt;br /&gt;
6. Impersonate/login as student1 and make a submission&lt;br /&gt;
&lt;br /&gt;
7. Log in as instructor6 as previously described and change the submission due date to be passed so we are currently in the review stage&lt;br /&gt;
&lt;br /&gt;
8. Impersonate/login as student2 and Request for a new review under others work, submit the review&lt;br /&gt;
&lt;br /&gt;
9. Log in as instructor6 as previously described and change the review due date to be passed so we are currently in the meta-review stage&lt;br /&gt;
&lt;br /&gt;
10. Impersonate/login back as student1 (the one with the submission) and Request for a new meta review&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_outofreviews.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we conditionally hide the button based on whether or not the participant has reviews available to perform. These checks are located in assignment.rb which is the model for an Assignment. The following method was added to assignment.rb and returns true when the participant has a valid meta-review available.&lt;br /&gt;
&lt;br /&gt;
  # Returns true if there is a meta-review task available for the user&lt;br /&gt;
  def metareview_available?(user_id)&lt;br /&gt;
    metareviewer = AssignmentParticipant.where(user_id: user_id, parent_id: self.id).first&lt;br /&gt;
    begin&lt;br /&gt;
      self.response_map_to_metareview(metareviewer)&lt;br /&gt;
      true&lt;br /&gt;
    rescue &lt;br /&gt;
      false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/27 #27 - Defaulting Required and Allowed Meta-reviews to NULL in Assignment Database]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
Currently, the number of required and allowed meta-reviews is always being set to 3 in the database. Per the specs of the feature, it should default the database values to NULL. When checkbox &amp;quot;Use meta-review deadline&amp;quot;, in the &amp;quot;Due Dates&amp;quot; tab, is selected then the view should populate required and allowed meta-reviews to 3.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
We created a migration that defaulted the metareviews_allowed and metareviews_required in the Assignment table to nil instead of what the previous team had as 3.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_13.png]]&lt;br /&gt;
&lt;br /&gt;
Since the number of meta-reviews allowed and required are recorded using the values in the text fields, changes were made to &amp;lt;code&amp;gt;app/views/assignment/edit/_review_strategy.html.erb&amp;lt;/code&amp;gt; to set the values and display them as expected.&lt;br /&gt;
&lt;br /&gt;
When the checkbox for setting meta-review limits is unchecked, the values of number of meta-reviews allowed and required should be null. When the checkbox is checked, the values should be set to 3 and 3 by default, or to the values already defined before (in case the assignment was saved with the values set already). On page load, if the checkbox is enabled, then the inputs should be shown with the default or pre-set values, but if the checkbox is disabled then they should be hidden and set to null.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_1.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Changes had to be made to &amp;lt;code&amp;gt;app/views/student_review/list.html.erb&amp;lt;/code&amp;gt; to account for the values being &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_3.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
Tests have been created that test if a metareview can have nil limits. In this case, no limit will be shown to the user. Before this change that was impossible&lt;br /&gt;
&lt;br /&gt;
== '''Issue 5 - Meta Review Limit is Not Functioning Correctly in Assignment Creation''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;has meta review limit&amp;quot; should determine whether a limit or requirement is placed on the student to complete meta reviews. If disabled, then they should be able to complete as many as they want. This is independent of the Meta Review STAGE that is enabled/disabled in the due dates tab. They should not impact each other and currently do within the assignment creation.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. If the &amp;quot;Use meta-review deadline&amp;quot; is disabled, then the Meta Review Limit panel disappears&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Has meta-review limit?&amp;quot; is hidden on edit&lt;br /&gt;
&lt;br /&gt;
3. Possibility the &amp;quot;Has meta-review limit?&amp;quot; not being saved on assignment creation?&lt;br /&gt;
&lt;br /&gt;
4. If the &amp;quot;Use meta-review deadline&amp;quot; is toggled (disabled, enabled), then the &amp;quot;Has meta-review limit?&amp;quot; resets to disabled&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
&lt;br /&gt;
The code in _due_dates.html.erb and the _review_strategy.html.erb within the /app/app/views/assignments/edit folder is lazily written and does not really adhere to the project specifications of how metareviews should work on assignment creation. These views need to be edited to work correctly and also respond to the changes in issue 5.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
The changes were too long to screenshot, so here is the specific diff section:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/1715/files#diff-540fd2bd6c34b48213716b1dd713733a&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/1715/files#diff-80f39fa5f62c73ff8741b02d3b11656c&lt;br /&gt;
&lt;br /&gt;
== '''Discovered Bugs:''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/45 #45 - &amp;quot;Request a new meta-review&amp;quot; button bugs]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Request new a meta-review&amp;quot; button should be hidden when:&lt;br /&gt;
# The number of meta-reviews in-progress is greater than the maximum allowed outstanding reviews.&lt;br /&gt;
# The number of reviews allowed is limited AND the total number of meta-reviews completed or in-progress is greater than the number allowed.&lt;br /&gt;
# There are no valid reviews available for the participant.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 0 reviewers. The user should NOT be able to see the 'Request a new meta-review to perform' button when there are no reviews available.&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** A student should NOT be able to request a meta-review on their own review.&lt;br /&gt;
*** When the meta-review limit on the assignment is set to 1 then a student should NOT be able to request a second meta-review.&lt;br /&gt;
*** The user should not be able to see the 'Request a new meta-review to perform' button when they have performed all valid reviews.&lt;br /&gt;
** with 4 reviewers.&lt;br /&gt;
*** The user should be able to click the 'Begin' button and still see the 'Request a new meta-review to perform' button.&lt;br /&gt;
*** The user should NOT be able to see the 'Request a new meta-review to perform' button when they have reached the meta-review limit.&lt;br /&gt;
*** If the user requests two meta-reviews but has not submitted, then they should not be able to request a new meta-review.&lt;br /&gt;
*** The user should be able to request a meta-review if they are above their required but below the allowed number of meta-reviews.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/30 #30 - “Numbers of Meta-reviews left:” does not update after a user requests a review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Number of meta-reviews left should decrement when a user requests a meta-review. Current behavior only decremented when a review was submitted.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of Meta-Reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_completed %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fixed behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of meta-reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_total %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is requested.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is completed.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/43 #43 - &amp;quot;Review Allowed&amp;quot; flag is required to be set on a due_date for a user to perform a meta-review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
When an assignment with a meta-review is created the round that meta-reviews will be performed in should have the &amp;quot;Meta-review allowed&amp;quot; option set to yes. This should be the only requirement for making meta-reviews available in that round. The problem with the current implementation is that meta-reviews can only be performed in rounds where the &amp;quot;Review allowed&amp;quot; option is set.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025 Issue43.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were applied to app/views/student_review/_responses.html.erb. Since this partial is shared by both reviews and meta-reviews in list.html.erb the title variable was used to determine if the begin option should be active or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; @assignment.can_review(topic_id) %&amp;gt;&lt;br /&gt;
Current behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; &lt;br /&gt;
        ((@assignment.can_review(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Review&amp;quot;) ||&lt;br /&gt;
         (@assignment.metareview_allowed(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Meta-review&amp;quot;)) %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. All meta-review tests make meta-reviews allowed only during the meta-review round. This means that if the simple meta-review test is passing then this feature is working as intended.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/50 #50 - The submit button is not available for meta-reviews.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Users should see save and submit buttons as part of the meta-review form. These buttons should have the same behavior as the review form. The problem right now is there is not submit button for meta-reviews.&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were made adding 'Metareview' to the conditional that determines if the submit button should be shown or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review')) %&amp;gt;&lt;br /&gt;
New behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review') || (@title.eql? 'Metareview'))%&amp;gt;&lt;br /&gt;
   &amp;lt;%= submit_tag &amp;quot;Submit &amp;quot;+@title, :name =&amp;gt; &amp;quot;Submit&amp;quot;, :id =&amp;gt; &amp;quot;Submit&amp;quot; %&amp;gt;&lt;br /&gt;
   &amp;lt;img src=&amp;quot;/assets/info.png&amp;quot; title='- SAVE will only store the peer-review as draft and the peer-review will not be displayed to the reviewee. After clicking SUBMIT, the peer-review will be displayed to reviewee, and you will not be able to update it any more.'&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user is able to SUBMIT a simple meta-review.&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
1. Log in as super_administrator2.  Password is &amp;quot;password&amp;quot;. Click on mange...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Create a new Assignment by clicking the &amp;quot;+&amp;quot; button. Give the assignment these fields: Name, Course and Submission Directory.&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_general.png]]&lt;br /&gt;
&lt;br /&gt;
3. Go to &amp;quot;Due Dates&amp;quot; tab and check &amp;quot;Use meta-review deadline&amp;quot; and then set the due dates 1 into the FUTURE for each review round and meta-review. Leave everything else as default as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_duedates.png]]&lt;br /&gt;
&lt;br /&gt;
4. Go to the &amp;quot;Rubrics&amp;quot; tab and populate as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
5. OPTIONAL: Go to &amp;quot;Review strategy page and select &amp;quot;Has meta-review limit?&amp;quot; and set the number of allowed and required meta-reviews.&lt;br /&gt;
&lt;br /&gt;
6. Once done, &amp;quot;Create&amp;quot; the assignment.&lt;br /&gt;
&lt;br /&gt;
7. Go back to Assignments. manage...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
8. Find the newly created assignment and click on &amp;quot;Add participant&amp;quot;. Add the students below:&lt;br /&gt;
&lt;br /&gt;
[[File:add_participants.png]]&lt;br /&gt;
&lt;br /&gt;
9. Go to manage...Impersonate User and impersonate &amp;quot;Student485&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10. Go to the newly created assignment and submit a link for the assignment.&lt;br /&gt;
&lt;br /&gt;
11. Revert back to super_administrator2 and change the submission due date to a date in the PAST so we are currently in the review stage.&lt;br /&gt;
&lt;br /&gt;
12. Impersonate student486 and request for a new review under others work, submit the review.&lt;br /&gt;
&lt;br /&gt;
13. Revert back to super_administrator2 as previously described and change the review due date to be passed so we are currently in the meta-review stage.&lt;br /&gt;
&lt;br /&gt;
14. Impersonate as student485 and Request for a new meta review.&lt;br /&gt;
&lt;br /&gt;
15. Press &amp;quot;Begin&amp;quot; and complete the meta-review&lt;br /&gt;
&lt;br /&gt;
16. When the review is complete, the &amp;quot;Begin&amp;quot; should disappear and be replaced with &amp;quot;View&amp;quot; and &amp;quot;Edit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Automated Test Plan===&lt;br /&gt;
1. User should NOT be able to see 'Request a new meta-review to perform' button when there are no reviews available. When there are reviews that don't belong to the meta-reviewer submitted, meta-reviews can be performed.&lt;br /&gt;
&lt;br /&gt;
2. User is able to SAVE a simple meta-review.&lt;br /&gt;
&lt;br /&gt;
3. User is able to go BACK during a simple meta-review since this functionality is available for reviews.&lt;br /&gt;
&lt;br /&gt;
4. When the limit and required number of meta-reviews on the assignment are equal, then a student will see they need to submit exactly that number of meta-reviews.&lt;br /&gt;
&lt;br /&gt;
5. When there are more meta-reviews allowed than required, then a student will see they need to submit between the two numbers of meta-reviews&lt;br /&gt;
&lt;br /&gt;
6. When the meta-review limits for an assignment are unset then a student will see that the number of meta-reviews aren't limited&lt;br /&gt;
&lt;br /&gt;
7. A student should not see a number of required or allowed meta-reviews when there are no limits on meta-reviews&lt;br /&gt;
&lt;br /&gt;
8. A student should see the number of meta-reviews decrement after a review is requested&lt;br /&gt;
&lt;br /&gt;
9. A student should see the number of meta-reviews decrement after they complete a review&lt;br /&gt;
&lt;br /&gt;
10. A student should not be able to request a meta-review on their own reviews &lt;br /&gt;
&lt;br /&gt;
11. If the meta-review limit on the assignment is set to 1 then a student should not be able to request a second meta review&lt;br /&gt;
&lt;br /&gt;
12. User should not be able to see 'Request a new meta-review to perform' button when they have reviewed all valid reviews already&lt;br /&gt;
&lt;br /&gt;
13. User should be able to request more than one meta-review before completing any&lt;br /&gt;
&lt;br /&gt;
14. User should not be able to see 'Request a new meta-review to perform' button when they have reached the meta-review limit&lt;br /&gt;
&lt;br /&gt;
15. User should not be able to request more than two meta-reviews without completing at least 1&lt;br /&gt;
&lt;br /&gt;
16. A student should be able to request a meta-review if they are above their required but below their allowed meta-reviews&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_tests_passing.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Coverage===&lt;br /&gt;
Current test coverage is 41.348%. Code coverage will increase based on the test plan above and then if the failing test case described below would be fixed.&lt;br /&gt;
&lt;br /&gt;
Travis CI is currently failing because of:&lt;br /&gt;
  Failures:&lt;br /&gt;
  1) assignment function general tab should edit quiz number available to students&lt;br /&gt;
     Failure/Error:&lt;br /&gt;
       child_nodes.each do |node|&lt;br /&gt;
         initialize_fnode_update_children(params, node, tmp_res)&lt;br /&gt;
       end&lt;br /&gt;
     NoMethodError:&lt;br /&gt;
       undefined method `each' for &amp;quot;&amp;quot;:String&lt;br /&gt;
     # ./app/controllers/tree_display_controller.rb:209:in `children_node_ng'&lt;br /&gt;
     # ./config/diagnostic.rb:11:in `call'&lt;br /&gt;
     # ------------------&lt;br /&gt;
     # --- Caused by: ---&lt;br /&gt;
     # Capybara::CapybaraError:&lt;br /&gt;
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true&lt;br /&gt;
     #   /home/travis/build/expertiza/expertiza/vendor/bundle/ruby/2.2.0/gems/capybara-2.17.0/lib/capybara/session.rb:145:in `raise_server_error!'&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_tests_passing.PNG&amp;diff=134372</id>
		<title>File:E2025 tests passing.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_tests_passing.PNG&amp;diff=134372"/>
		<updated>2020-04-26T18:29:11Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134371</id>
		<title>CSC/ECE 517 Spring 2020 - E2025: Issues Related to Meta - Reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134371"/>
		<updated>2020-04-26T18:25:55Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Automated Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Overview of Project''' ==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, meta-review is a feature that enables a third party to evaluate the quality of feedback that a reviewer gives a reviewee. meta-review is an important feature that can help students become better reviewers for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified. The task is to fix these issues so that this feature can be used again.&lt;br /&gt;
&lt;br /&gt;
* An assignment is deemed to have meta-reviews if and only if there is a meta-review deadline for this assignment in the `assignments_questionnaires` table.&lt;br /&gt;
* If there is no meta-review deadline, then don’t show the question about whether there is a max meta-review limit.&lt;br /&gt;
* In the DB the default number of meta-reviews allowed and required should be null.&lt;br /&gt;
* As soon as someone checks the Has meta-review Limit box on the Review Strategy tab, the UI should fill in 3 and 3 as the required and allowed number.&lt;br /&gt;
* Student pages should show the list of reviews that have been performed.&lt;br /&gt;
* When a user requests a new meta-review, the field which says the number of meta-reviews left ( refer to above image “Numbers of Meta-reviews left:”) does not change and the button to request a new meta-review disappears.&lt;br /&gt;
&lt;br /&gt;
===Previous Work===&lt;br /&gt;
&lt;br /&gt;
This assignment is a repeat of E1997 which was assigned to students last semester, Fall 2019.&lt;br /&gt;
&lt;br /&gt;
Details of the previous implementation can be found here:&lt;br /&gt;
[http://https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1997._Issues_related_to_meta-reviewing E1997]&lt;br /&gt;
&lt;br /&gt;
Our goals are to update the logic, refactor non-DRY code, and fix bugs.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/32 #32 - Remove all debug comments in the UI]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
It was noted in the previous team's implementation that multiple debugging comments were showing up during their video testing.&lt;br /&gt;
&lt;br /&gt;
Debug messages shown when viewing a completed meta review:&lt;br /&gt;
[[File:Debug_comments.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
There was a mistake in &amp;lt;code&amp;gt;app/views/response/_review.html.erb&amp;lt;/code&amp;gt; where &amp;quot;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;hr/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;quot; was being displayed under the review being meta-reviewed. This was due to being included as a string constant rather than html code. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_comments_response_review.PNG]]&lt;br /&gt;
&lt;br /&gt;
There was an instance in &amp;lt;code&amp;gt;app/views/response/view.html.erb&amp;lt;/code&amp;gt; where ruby code responsible for getting a review to be displayed was being interpreted and displayed, even though the response was being displayed as html in the line before. This resulted in the response details being listed in the UI erroneously.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_response_view.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/49 #49 - &amp;quot;Request a new meta-review&amp;quot; button crashes when there are no available reviews]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
When there are no valid metareviews to perform (either there are no reivews performed on the assignment, the only valid reviews concern your own work or own reviews, you have completed all allowed metareviews, or you have reviewed all valid reviews already) then the &amp;quot;Request a New Review&amp;quot; button still is visible and displays the following error (correctly) when pressed.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. Log in as instructor6, click on mange...-&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
2. Click on edit assignment, navigate to Due Dates and check &amp;quot;Use meta-review deadline&amp;quot; checkbox&lt;br /&gt;
&lt;br /&gt;
3. Select &amp;quot;Yes&amp;quot; for all submission allowed, Review allowed and Meta-review allowed in all of the deadline types&lt;br /&gt;
&lt;br /&gt;
4. Navigate back to Assignment Tree View and click on &amp;quot;Add participant&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Add couple of students(say student1 and student2) to the assignment&lt;br /&gt;
&lt;br /&gt;
6. Impersonate/login as student1 and make a submission&lt;br /&gt;
&lt;br /&gt;
7. Log in as instructor6 as previously described and change the submission due date to be passed so we are currently in the review stage&lt;br /&gt;
&lt;br /&gt;
8. Impersonate/login as student2 and Request for a new review under others work, submit the review&lt;br /&gt;
&lt;br /&gt;
9. Log in as instructor6 as previously described and change the review due date to be passed so we are currently in the meta-review stage&lt;br /&gt;
&lt;br /&gt;
10. Impersonate/login back as student1 (the one with the submission) and Request for a new meta review&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_outofreviews.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we conditionally hide the button based on whether or not the participant has reviews available to perform. These checks are located in assignment.rb which is the model for an Assignment. The following method was added to assignment.rb and returns true when the participant has a valid meta-review available.&lt;br /&gt;
&lt;br /&gt;
  # Returns true if there is a meta-review task available for the user&lt;br /&gt;
  def metareview_available?(user_id)&lt;br /&gt;
    metareviewer = AssignmentParticipant.where(user_id: user_id, parent_id: self.id).first&lt;br /&gt;
    begin&lt;br /&gt;
      self.response_map_to_metareview(metareviewer)&lt;br /&gt;
      true&lt;br /&gt;
    rescue &lt;br /&gt;
      false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/27 #27 - Defaulting Required and Allowed Meta-reviews to NULL in Assignment Database]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
Currently, the number of required and allowed meta-reviews is always being set to 3 in the database. Per the specs of the feature, it should default the database values to NULL. When checkbox &amp;quot;Use meta-review deadline&amp;quot;, in the &amp;quot;Due Dates&amp;quot; tab, is selected then the view should populate required and allowed meta-reviews to 3.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
We created a migration that defaulted the metareviews_allowed and metareviews_required in the Assignment table to nil instead of what the previous team had as 3.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_13.png]]&lt;br /&gt;
&lt;br /&gt;
Since the number of meta-reviews allowed and required are recorded using the values in the text fields, changes were made to &amp;lt;code&amp;gt;app/views/assignment/edit/_review_strategy.html.erb&amp;lt;/code&amp;gt; to set the values and display them as expected.&lt;br /&gt;
&lt;br /&gt;
When the checkbox for setting meta-review limits is unchecked, the values of number of meta-reviews allowed and required should be null. When the checkbox is checked, the values should be set to 3 and 3 by default, or to the values already defined before (in case the assignment was saved with the values set already). On page load, if the checkbox is enabled, then the inputs should be shown with the default or pre-set values, but if the checkbox is disabled then they should be hidden and set to null.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_1.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Changes had to be made to &amp;lt;code&amp;gt;app/views/student_review/list.html.erb&amp;lt;/code&amp;gt; to account for the values being &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_3.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
Tests have been created that test if a metareview can have nil limits. In this case, no limit will be shown to the user. Before this change that was impossible&lt;br /&gt;
&lt;br /&gt;
== '''Issue 5 - Meta Review Limit is Not Functioning Correctly in Assignment Creation''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;has meta review limit&amp;quot; should determine whether a limit or requirement is placed on the student to complete meta reviews. If disabled, then they should be able to complete as many as they want. This is independent of the Meta Review STAGE that is enabled/disabled in the due dates tab. They should not impact each other and currently do within the assignment creation.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. If the &amp;quot;Use meta-review deadline&amp;quot; is disabled, then the Meta Review Limit panel disappears&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Has meta-review limit?&amp;quot; is hidden on edit&lt;br /&gt;
&lt;br /&gt;
3. Possibility the &amp;quot;Has meta-review limit?&amp;quot; not being saved on assignment creation?&lt;br /&gt;
&lt;br /&gt;
4. If the &amp;quot;Use meta-review deadline&amp;quot; is toggled (disabled, enabled), then the &amp;quot;Has meta-review limit?&amp;quot; resets to disabled&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
&lt;br /&gt;
The code in _due_dates.html.erb and the _review_strategy.html.erb within the /app/app/views/assignments/edit folder is lazily written and does not really adhere to the project specifications of how metareviews should work on assignment creation. These views need to be edited to work correctly and also respond to the changes in issue 5.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
The changes were too long to screenshot, so here is the specific diff section:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/1715/files#diff-540fd2bd6c34b48213716b1dd713733a&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/1715/files#diff-80f39fa5f62c73ff8741b02d3b11656c&lt;br /&gt;
&lt;br /&gt;
== '''Discovered Bugs:''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/45 #45 - &amp;quot;Request a new meta-review&amp;quot; button bugs]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Request new a meta-review&amp;quot; button should be hidden when:&lt;br /&gt;
# The number of meta-reviews in-progress is greater than the maximum allowed outstanding reviews.&lt;br /&gt;
# The number of reviews allowed is limited AND the total number of meta-reviews completed or in-progress is greater than the number allowed.&lt;br /&gt;
# There are no valid reviews available for the participant.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 0 reviewers. The user should NOT be able to see the 'Request a new meta-review to perform' button when there are no reviews available.&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** A student should NOT be able to request a meta-review on their own review.&lt;br /&gt;
*** When the meta-review limit on the assignment is set to 1 then a student should NOT be able to request a second meta-review.&lt;br /&gt;
*** The user should not be able to see the 'Request a new meta-review to perform' button when they have performed all valid reviews.&lt;br /&gt;
** with 4 reviewers.&lt;br /&gt;
*** The user should be able to click the 'Begin' button and still see the 'Request a new meta-review to perform' button.&lt;br /&gt;
*** The user should NOT be able to see the 'Request a new meta-review to perform' button when they have reached the meta-review limit.&lt;br /&gt;
*** If the user requests two meta-reviews but has not submitted, then they should not be able to request a new meta-review.&lt;br /&gt;
*** The user should be able to request a meta-review if they are above their required but below the allowed number of meta-reviews.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/30 #30 - “Numbers of Meta-reviews left:” does not update after a user requests a review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Number of meta-reviews left should decrement when a user requests a meta-review. Current behavior only decremented when a review was submitted.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of Meta-Reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_completed %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fixed behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of meta-reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_total %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is requested.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is completed.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/43 #43 - &amp;quot;Review Allowed&amp;quot; flag is required to be set on a due_date for a user to perform a meta-review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
When an assignment with a meta-review is created the round that meta-reviews will be performed in should have the &amp;quot;Meta-review allowed&amp;quot; option set to yes. This should be the only requirement for making meta-reviews available in that round. The problem with the current implementation is that meta-reviews can only be performed in rounds where the &amp;quot;Review allowed&amp;quot; option is set.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025 Issue43.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were applied to app/views/student_review/_responses.html.erb. Since this partial is shared by both reviews and meta-reviews in list.html.erb the title variable was used to determine if the begin option should be active or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; @assignment.can_review(topic_id) %&amp;gt;&lt;br /&gt;
Current behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; &lt;br /&gt;
        ((@assignment.can_review(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Review&amp;quot;) ||&lt;br /&gt;
         (@assignment.metareview_allowed(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Meta-review&amp;quot;)) %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. All meta-review tests make meta-reviews allowed only during the meta-review round. This means that if the simple meta-review test is passing then this feature is working as intended.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/50 #50 - The submit button is not available for meta-reviews.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Users should see save and submit buttons as part of the meta-review form. These buttons should have the same behavior as the review form. The problem right now is there is not submit button for meta-reviews.&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were made adding 'Metareview' to the conditional that determines if the submit button should be shown or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review')) %&amp;gt;&lt;br /&gt;
New behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review') || (@title.eql? 'Metareview'))%&amp;gt;&lt;br /&gt;
   &amp;lt;%= submit_tag &amp;quot;Submit &amp;quot;+@title, :name =&amp;gt; &amp;quot;Submit&amp;quot;, :id =&amp;gt; &amp;quot;Submit&amp;quot; %&amp;gt;&lt;br /&gt;
   &amp;lt;img src=&amp;quot;/assets/info.png&amp;quot; title='- SAVE will only store the peer-review as draft and the peer-review will not be displayed to the reviewee. After clicking SUBMIT, the peer-review will be displayed to reviewee, and you will not be able to update it any more.'&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user is able to SUBMIT a simple meta-review.&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
1. Log in as super_administrator2.  Password is &amp;quot;password&amp;quot;. Click on mange...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Create a new Assignment by clicking the &amp;quot;+&amp;quot; button. Give the assignment these fields: Name, Course and Submission Directory.&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_general.png]]&lt;br /&gt;
&lt;br /&gt;
3. Go to &amp;quot;Due Dates&amp;quot; tab and check &amp;quot;Use meta-review deadline&amp;quot; and then set the due dates 1 into the FUTURE for each review round and meta-review. Leave everything else as default as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_duedates.png]]&lt;br /&gt;
&lt;br /&gt;
4. Go to the &amp;quot;Rubrics&amp;quot; tab and populate as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
5. OPTIONAL: Go to &amp;quot;Review strategy page and select &amp;quot;Has meta-review limit?&amp;quot; and set the number of allowed and required meta-reviews.&lt;br /&gt;
&lt;br /&gt;
6. Once done, &amp;quot;Create&amp;quot; the assignment.&lt;br /&gt;
&lt;br /&gt;
7. Go back to Assignments. manage...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
8. Find the newly created assignment and click on &amp;quot;Add participant&amp;quot;. Add the students below:&lt;br /&gt;
&lt;br /&gt;
[[File:add_participants.png]]&lt;br /&gt;
&lt;br /&gt;
9. Go to manage...Impersonate User and impersonate &amp;quot;Student485&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10. Go to the newly created assignment and submit a link for the assignment.&lt;br /&gt;
&lt;br /&gt;
11. Revert back to super_administrator2 and change the submission due date to a date in the PAST so we are currently in the review stage.&lt;br /&gt;
&lt;br /&gt;
12. Impersonate student486 and request for a new review under others work, submit the review.&lt;br /&gt;
&lt;br /&gt;
13. Revert back to super_administrator2 as previously described and change the review due date to be passed so we are currently in the meta-review stage.&lt;br /&gt;
&lt;br /&gt;
14. Impersonate as student485 and Request for a new meta review.&lt;br /&gt;
&lt;br /&gt;
15. Press &amp;quot;Begin&amp;quot; and complete the meta-review&lt;br /&gt;
&lt;br /&gt;
16. When the review is complete, the &amp;quot;Begin&amp;quot; should disappear and be replaced with &amp;quot;View&amp;quot; and &amp;quot;Edit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Automated Test Plan===&lt;br /&gt;
1. User should NOT be able to see 'Request a new meta-review to perform' button when there are no reviews available. When there are reviews that don't belong to the meta-reviewer submitted, meta-reviews can be performed.&lt;br /&gt;
&lt;br /&gt;
2. User is able to SAVE a simple meta-review.&lt;br /&gt;
&lt;br /&gt;
3. User is able to go BACK during a simple meta-review since this functionality is available for reviews.&lt;br /&gt;
&lt;br /&gt;
4. When the limit and required number of meta-reviews on the assignment are equal, then a student will see they need to submit exactly that number of meta-reviews.&lt;br /&gt;
&lt;br /&gt;
5. When there are more meta-reviews allowed than required, then a student will see they need to submit between the two numbers of meta-reviews&lt;br /&gt;
&lt;br /&gt;
6. When the meta-review limits for an assignment are unset then a student will see that the number of meta-reviews aren't limited&lt;br /&gt;
&lt;br /&gt;
7. A student should not see a number of required or allowed meta-reviews when there are no limits on meta-reviews&lt;br /&gt;
&lt;br /&gt;
8. A student should see the number of meta-reviews decrement after a review is requested&lt;br /&gt;
&lt;br /&gt;
9. A student should see the number of meta-reviews decrement after they complete a review&lt;br /&gt;
&lt;br /&gt;
10. A student should not be able to request a meta-review on their own reviews &lt;br /&gt;
&lt;br /&gt;
11. If the meta-review limit on the assignment is set to 1 then a student should not be able to request a second meta review&lt;br /&gt;
&lt;br /&gt;
12. User should not be able to see 'Request a new meta-review to perform' button when they have reviewed all valid reviews already&lt;br /&gt;
&lt;br /&gt;
13. User should be able to request more than one meta-review before completing any&lt;br /&gt;
&lt;br /&gt;
14. User should not be able to see 'Request a new meta-review to perform' button when they have reached the meta-review limit&lt;br /&gt;
&lt;br /&gt;
15. User should not be able to request more than two meta-reviews without completing at least 1&lt;br /&gt;
&lt;br /&gt;
16. A student should be able to request a meta-review if they are above their required but below their allowed meta-reviews&lt;br /&gt;
&lt;br /&gt;
===Coverage===&lt;br /&gt;
Current test coverage is 41.348%. Code coverage will increase based on the test plan above and then if the failing test case described below would be fixed.&lt;br /&gt;
&lt;br /&gt;
Travis CI is currently failing because of:&lt;br /&gt;
  Failures:&lt;br /&gt;
  1) assignment function general tab should edit quiz number available to students&lt;br /&gt;
     Failure/Error:&lt;br /&gt;
       child_nodes.each do |node|&lt;br /&gt;
         initialize_fnode_update_children(params, node, tmp_res)&lt;br /&gt;
       end&lt;br /&gt;
     NoMethodError:&lt;br /&gt;
       undefined method `each' for &amp;quot;&amp;quot;:String&lt;br /&gt;
     # ./app/controllers/tree_display_controller.rb:209:in `children_node_ng'&lt;br /&gt;
     # ./config/diagnostic.rb:11:in `call'&lt;br /&gt;
     # ------------------&lt;br /&gt;
     # --- Caused by: ---&lt;br /&gt;
     # Capybara::CapybaraError:&lt;br /&gt;
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true&lt;br /&gt;
     #   /home/travis/build/expertiza/expertiza/vendor/bundle/ruby/2.2.0/gems/capybara-2.17.0/lib/capybara/session.rb:145:in `raise_server_error!'&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134355</id>
		<title>CSC/ECE 517 Spring 2020 - E2025: Issues Related to Meta - Reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134355"/>
		<updated>2020-04-25T22:00:37Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Overview of Project''' ==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, meta-review is a feature that enables a third party to evaluate the quality of feedback that a reviewer gives a reviewee. meta-review is an important feature that can help students become better reviewers for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified. The task is to fix these issues so that this feature can be used again.&lt;br /&gt;
&lt;br /&gt;
* An assignment is deemed to have meta-reviews if and only if there is a meta-review deadline for this assignment in the `assignments_questionnaires` table.&lt;br /&gt;
* If there is no meta-review deadline, then don’t show the question about whether there is a max meta-review limit.&lt;br /&gt;
* In the DB the default number of meta-reviews allowed and required should be null.&lt;br /&gt;
* As soon as someone checks the Has meta-review Limit box on the Review Strategy tab, the UI should fill in 3 and 3 as the required and allowed number.&lt;br /&gt;
* Student pages should show the list of reviews that have been performed.&lt;br /&gt;
* When a user requests a new meta-review, the field which says the number of meta-reviews left ( refer to above image “Numbers of Meta-reviews left:”) does not change and the button to request a new meta-review disappears.&lt;br /&gt;
&lt;br /&gt;
===Previous Work===&lt;br /&gt;
&lt;br /&gt;
This assignment is a repeat of E1997 which was assigned to students last semester, Fall 2019.&lt;br /&gt;
&lt;br /&gt;
Details of the previous implementation can be found here:&lt;br /&gt;
[http://https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1997._Issues_related_to_meta-reviewing E1997]&lt;br /&gt;
&lt;br /&gt;
Our goals are to update the logic, refactor non-DRY code, and fix bugs.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/32 #32 - Remove all debug comments in the UI]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
It was noted in the previous team's implementation that multiple debugging comments were showing up during their video testing.&lt;br /&gt;
&lt;br /&gt;
Debug messages shown when viewing a completed meta review:&lt;br /&gt;
[[File:Debug_comments.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
There was a mistake in &amp;lt;code&amp;gt;app/views/response/_review.html.erb&amp;lt;/code&amp;gt; where &amp;quot;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;hr/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;quot; was being displayed under the review being meta-reviewed. This was due to being included as a string constant rather than html code. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_comments_response_review.PNG]]&lt;br /&gt;
&lt;br /&gt;
There was an instance in &amp;lt;code&amp;gt;app/views/response/view.html.erb&amp;lt;/code&amp;gt; where ruby code responsible for getting a review to be displayed was being interpreted and displayed, even though the response was being displayed as html in the line before. This resulted in the response details being listed in the UI erroneously.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_response_view.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/49 #49 - &amp;quot;Request a new meta-review&amp;quot; button crashes when there are no available reviews]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
When there are no valid metareviews to perform (either there are no reivews performed on the assignment, the only valid reviews concern your own work or own reviews, you have completed all allowed metareviews, or you have reviewed all valid reviews already) then the &amp;quot;Request a New Review&amp;quot; button still is visible and displays the following error (correctly) when pressed.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. Log in as instructor6, click on mange...-&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
2. Click on edit assignment, navigate to Due Dates and check &amp;quot;Use meta-review deadline&amp;quot; checkbox&lt;br /&gt;
&lt;br /&gt;
3. Select &amp;quot;Yes&amp;quot; for all submission allowed, Review allowed and Meta-review allowed in all of the deadline types&lt;br /&gt;
&lt;br /&gt;
4. Navigate back to Assignment Tree View and click on &amp;quot;Add participant&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Add couple of students(say student1 and student2) to the assignment&lt;br /&gt;
&lt;br /&gt;
6. Impersonate/login as student1 and make a submission&lt;br /&gt;
&lt;br /&gt;
7. Log in as instructor6 as previously described and change the submission due date to be passed so we are currently in the review stage&lt;br /&gt;
&lt;br /&gt;
8. Impersonate/login as student2 and Request for a new review under others work, submit the review&lt;br /&gt;
&lt;br /&gt;
9. Log in as instructor6 as previously described and change the review due date to be passed so we are currently in the meta-review stage&lt;br /&gt;
&lt;br /&gt;
10. Impersonate/login back as student1 (the one with the submission) and Request for a new meta review&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_outofreviews.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we conditionally hide the button based on whether or not the participant has reviews available to perform. These checks are located in assignment.rb which is the model for an Assignment. The following method was added to assignment.rb and returns true when the participant has a valid meta-review available.&lt;br /&gt;
&lt;br /&gt;
  # Returns true if there is a meta-review task available for the user&lt;br /&gt;
  def metareview_available?(user_id)&lt;br /&gt;
    metareviewer = AssignmentParticipant.where(user_id: user_id, parent_id: self.id).first&lt;br /&gt;
    begin&lt;br /&gt;
      self.response_map_to_metareview(metareviewer)&lt;br /&gt;
      true&lt;br /&gt;
    rescue &lt;br /&gt;
      false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/27 #27 - Defaulting Required and Allowed Meta-reviews to NULL in Assignment Database]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
Currently, the number of required and allowed meta-reviews is always being set to 3 in the database. Per the specs of the feature, it should default the database values to NULL. When checkbox &amp;quot;Use meta-review deadline&amp;quot;, in the &amp;quot;Due Dates&amp;quot; tab, is selected then the view should populate required and allowed meta-reviews to 3.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
We created a migration that defaulted the metareviews_allowed and metareviews_required in the Assignment table to nil instead of what the previous team had as 3.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_13.png]]&lt;br /&gt;
&lt;br /&gt;
Since the number of meta-reviews allowed and required are recorded using the values in the text fields, changes were made to &amp;lt;code&amp;gt;app/views/assignment/edit/_review_strategy.html.erb&amp;lt;/code&amp;gt; to set the values and display them as expected.&lt;br /&gt;
&lt;br /&gt;
When the checkbox for setting meta-review limits is unchecked, the values of number of meta-reviews allowed and required should be null. When the checkbox is checked, the values should be set to 3 and 3 by default, or to the values already defined before (in case the assignment was saved with the values set already). On page load, if the checkbox is enabled, then the inputs should be shown with the default or pre-set values, but if the checkbox is disabled then they should be hidden and set to null.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_1.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_2.PNG]]&lt;br /&gt;
&lt;br /&gt;
Changes had to be made to &amp;lt;code&amp;gt;app/views/student_review/list.html.erb&amp;lt;/code&amp;gt; to account for the values being &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_metareview_limit_3.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
&lt;br /&gt;
Tests have been created that test if a metareview can have nil limits. In this case, no limit will be shown to the user. Before this change that was impossible&lt;br /&gt;
&lt;br /&gt;
== '''Issue 5 - Meta Review Limit is Not Functioning Correctly in Assignment Creation''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;has meta review limit&amp;quot; should determine whether a limit or requirement is placed on the student to complete meta reviews. If disabled, then they should be able to complete as many as they want. This is independent of the Meta Review STAGE that is enabled/disabled in the due dates tab. They should not impact each other and currently do within the assignment creation.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. If the &amp;quot;Use meta-review deadline&amp;quot; is disabled, then the Meta Review Limit panel disappears&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Has meta-review limit?&amp;quot; is hidden on edit&lt;br /&gt;
&lt;br /&gt;
3. Possibility the &amp;quot;Has meta-review limit?&amp;quot; not being saved on assignment creation?&lt;br /&gt;
&lt;br /&gt;
4. If the &amp;quot;Use meta-review deadline&amp;quot; is toggled (disabled, enabled), then the &amp;quot;Has meta-review limit?&amp;quot; resets to disabled&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
&lt;br /&gt;
The code in _due_dates.html.erb and the _review_strategy.html.erb within the /app/app/views/assignments/edit folder is lazily written and does not really adhere to the project specifications of how metareviews should work on assignment creation. These views need to be edited to work correctly and also respond to the changes in issue 5.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
The changes were too long to screenshot, so here is the specific diff section:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/1715/files#diff-540fd2bd6c34b48213716b1dd713733a&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/1715/files#diff-80f39fa5f62c73ff8741b02d3b11656c&lt;br /&gt;
&lt;br /&gt;
== '''Discovered Bugs:''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/48 #48 - Number of meta-reviews allowed for an assignment is always  nil]''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/45 #45 - &amp;quot;Request a new meta-review&amp;quot; button bugs]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Request new a meta-review&amp;quot; button should be hidden when:&lt;br /&gt;
# The number of meta-reviews in-progress is greater than the maximum allowed outstanding reviews.&lt;br /&gt;
# The number of reviews allowed is limited AND the total number of meta-reviews completed or in-progress is greater than the number allowed.&lt;br /&gt;
# There are no valid reviews available for the participant.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 0 reviewers. The user should NOT be able to see the 'Request a new meta-review to perform' button when there are no reviews available.&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** A student should NOT be able to request a meta-review on their own review.&lt;br /&gt;
*** When the meta-review limit on the assignment is set to 1 then a student should NOT be able to request a second meta-review.&lt;br /&gt;
*** The user should not be able to see the 'Request a new meta-review to perform' button when they have performed all valid reviews.&lt;br /&gt;
** with 4 reviewers.&lt;br /&gt;
*** The user should be able to click the 'Begin' button and still see the 'Request a new meta-review to perform' button.&lt;br /&gt;
*** The user should NOT be able to see the 'Request a new meta-review to perform' button when they have reached the meta-review limit.&lt;br /&gt;
*** If the user requests two meta-reviews but has not submitted, then they should not be able to request a new meta-review.&lt;br /&gt;
*** The user should be able to request a meta-review if they are above their required but below the allowed number of meta-reviews.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/30 #30 - “Numbers of Meta-reviews left:” does not update after a user requests a review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Number of meta-reviews left should decrement when a user requests a meta-review. Current behavior only decremented when a review was submitted.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of Meta-Reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_completed %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fixed behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of meta-reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_total %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is requested.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is completed.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/43 #43 - &amp;quot;Review Allowed&amp;quot; flag is required to be set on a due_date for a user to perform a meta-review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
When an assignment with a meta-review is created the round that meta-reviews will be performed in should have the &amp;quot;Meta-review allowed&amp;quot; option set to yes. This should be the only requirement for making meta-reviews available in that round. The problem with the current implementation is that meta-reviews can only be performed in rounds where the &amp;quot;Review allowed&amp;quot; option is set.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025 Issue43.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were applied to app/views/student_review/_responses.html.erb. Since this partial is shared by both reviews and meta-reviews in list.html.erb the title variable was used to determine if the begin option should be active or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; @assignment.can_review(topic_id) %&amp;gt;&lt;br /&gt;
Current behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; &lt;br /&gt;
        ((@assignment.can_review(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Review&amp;quot;) ||&lt;br /&gt;
         (@assignment.metareview_allowed(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Meta-review&amp;quot;)) %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. All meta-review tests make meta-reviews allowed only during the meta-review round. This means that if the simple meta-review test is passing then this feature is working as intended.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/50 #50 - The submit button is not available for meta-reviews.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Users should see save and submit buttons as part of the meta-review form. These buttons should have the same behavior as the review form. The problem right now is there is not submit button for meta-reviews.&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were made adding 'Metareview' to the conditional that determines if the submit button should be shown or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review')) %&amp;gt;&lt;br /&gt;
New behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review') || (@title.eql? 'Metareview'))%&amp;gt;&lt;br /&gt;
   &amp;lt;%= submit_tag &amp;quot;Submit &amp;quot;+@title, :name =&amp;gt; &amp;quot;Submit&amp;quot;, :id =&amp;gt; &amp;quot;Submit&amp;quot; %&amp;gt;&lt;br /&gt;
   &amp;lt;img src=&amp;quot;/assets/info.png&amp;quot; title='- SAVE will only store the peer-review as draft and the peer-review will not be displayed to the reviewee. After clicking SUBMIT, the peer-review will be displayed to reviewee, and you will not be able to update it any more.'&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user is able to SUBMIT a simple meta-review.&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
1. Log in as super_administrator2.  Password is &amp;quot;password&amp;quot;. Click on mange...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Create a new Assignment by clicking the &amp;quot;+&amp;quot; button. Give the assignment these fields: Name, Course and Submission Directory.&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_general.png]]&lt;br /&gt;
&lt;br /&gt;
3. Go to &amp;quot;Due Dates&amp;quot; tab and check &amp;quot;Use meta-review deadline&amp;quot; and then set the due dates 1 into the FUTURE for each review round and meta-review. Leave everything else as default as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_duedates.png]]&lt;br /&gt;
&lt;br /&gt;
4. Go to the &amp;quot;Rubrics&amp;quot; tab and populate as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
5. OPTIONAL: Go to &amp;quot;Review strategy page and select &amp;quot;Has meta-review limit?&amp;quot; and set the number of allowed and required meta-reviews.&lt;br /&gt;
&lt;br /&gt;
6. Once done, &amp;quot;Create&amp;quot; the assignment.&lt;br /&gt;
&lt;br /&gt;
7. Go back to Assignments. manage...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
8. Find the newly created assignment and click on &amp;quot;Add participant&amp;quot;. Add the students below:&lt;br /&gt;
&lt;br /&gt;
[[File:add_participants.png]]&lt;br /&gt;
&lt;br /&gt;
9. Go to manage...Impersonate User and impersonate &amp;quot;Student485&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10. Go to the newly created assignment and submit a link for the assignment.&lt;br /&gt;
&lt;br /&gt;
11. Revert back to super_administrator2 and change the submission due date to a date in the PAST so we are currently in the review stage.&lt;br /&gt;
&lt;br /&gt;
12. Impersonate student486 and request for a new review under others work, submit the review.&lt;br /&gt;
&lt;br /&gt;
13. Revert back to super_administrator2 as previously described and change the review due date to be passed so we are currently in the meta-review stage.&lt;br /&gt;
&lt;br /&gt;
14. Impersonate as student485 and Request for a new meta review.&lt;br /&gt;
&lt;br /&gt;
15. Press &amp;quot;Begin&amp;quot; and complete the meta-review&lt;br /&gt;
&lt;br /&gt;
16. When the review is complete, the &amp;quot;Begin&amp;quot; should disappear and be replaced with &amp;quot;View&amp;quot; and &amp;quot;Edit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Automated Test Plan===&lt;br /&gt;
1. If I create an assignment, then the number of meta-reviews is set to null.&lt;br /&gt;
&lt;br /&gt;
2. If 'Use metareview deadline' is not enabled in the due dates tab, then the meta-review fields in the review strategy tab are not visible.&lt;br /&gt;
&lt;br /&gt;
3. If the metareview limit on the assignment is set to 3, then a student will see they need to submit 3 meta reviews&lt;br /&gt;
&lt;br /&gt;
4. If the metareview deadline is enabled, the assignment cannot be created without a metareview rubric&lt;br /&gt;
&lt;br /&gt;
5. If the assignment created is in a stage that does not have metareview enabled, a metareview cannot be created&lt;br /&gt;
&lt;br /&gt;
6. If the assignment does not have any legal meta reviews, then the &amp;quot;Request a new metareview to perform&amp;quot; button is not visible&lt;br /&gt;
&lt;br /&gt;
7. A student should not be able to request a metareview if they have reached the limit of their allowed reviews&lt;br /&gt;
&lt;br /&gt;
8. A student should be able to request a metareview if they are above their required but below their allowed reviews&lt;br /&gt;
&lt;br /&gt;
9. A student should not be able to request a metareview about their own work. &lt;br /&gt;
&lt;br /&gt;
10. A student should not be able to request a metareview about themselves. &lt;br /&gt;
&lt;br /&gt;
11. If there is a valid metareview to perform related to two other students, then the metareview should be able to be performed.&lt;br /&gt;
&lt;br /&gt;
12. If a student has requested two metareviewes but have not submitted it, then they should not be able to request a new metareview.&lt;br /&gt;
&lt;br /&gt;
13. If the metareview limit on the assignment is set to 1 then a student should not be able to request a second meta review&lt;br /&gt;
&lt;br /&gt;
===Coverage===&lt;br /&gt;
Current test coverage is 41.348%. Code coverage will increase based on the test plan above and then if the failing test case described below would be fixed.&lt;br /&gt;
&lt;br /&gt;
Travis CI is currently failing because of:&lt;br /&gt;
  Failures:&lt;br /&gt;
  1) assignment function general tab should edit quiz number available to students&lt;br /&gt;
     Failure/Error:&lt;br /&gt;
       child_nodes.each do |node|&lt;br /&gt;
         initialize_fnode_update_children(params, node, tmp_res)&lt;br /&gt;
       end&lt;br /&gt;
     NoMethodError:&lt;br /&gt;
       undefined method `each' for &amp;quot;&amp;quot;:String&lt;br /&gt;
     # ./app/controllers/tree_display_controller.rb:209:in `children_node_ng'&lt;br /&gt;
     # ./config/diagnostic.rb:11:in `call'&lt;br /&gt;
     # ------------------&lt;br /&gt;
     # --- Caused by: ---&lt;br /&gt;
     # Capybara::CapybaraError:&lt;br /&gt;
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true&lt;br /&gt;
     #   /home/travis/build/expertiza/expertiza/vendor/bundle/ruby/2.2.0/gems/capybara-2.17.0/lib/capybara/session.rb:145:in `raise_server_error!'&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_metareview_limit_3.PNG&amp;diff=134353</id>
		<title>File:E2025 metareview limit 3.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_metareview_limit_3.PNG&amp;diff=134353"/>
		<updated>2020-04-25T21:56:52Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_metareview_limit_2.PNG&amp;diff=134350</id>
		<title>File:E2025 metareview limit 2.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_metareview_limit_2.PNG&amp;diff=134350"/>
		<updated>2020-04-25T21:54:23Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_metareview_limit_1.PNG&amp;diff=134349</id>
		<title>File:E2025 metareview limit 1.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_metareview_limit_1.PNG&amp;diff=134349"/>
		<updated>2020-04-25T21:54:12Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134347</id>
		<title>CSC/ECE 517 Spring 2020 - E2025: Issues Related to Meta - Reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134347"/>
		<updated>2020-04-25T21:41:24Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* #27 - Defaulting Required and Allowed Meta-reviews to NULL in Assignment Database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Overview of Project''' ==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, meta-review is a feature that enables a third party to evaluate the quality of feedback that a reviewer gives a reviewee. meta-review is an important feature that can help students become better reviewers for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified. The task is to fix these issues so that this feature can be used again.&lt;br /&gt;
&lt;br /&gt;
* An assignment is deemed to have meta-reviews if and only if there is a meta-review deadline for this assignment in the `assignments_questionnaires` table.&lt;br /&gt;
* If there is no meta-review deadline, then don’t show the question about whether there is a max meta-review limit.&lt;br /&gt;
* In the DB the default number of meta-reviews allowed and required should be null.&lt;br /&gt;
* As soon as someone checks the Has meta-review Limit box on the Review Strategy tab, the UI should fill in 3 and 3 as the required and allowed number.&lt;br /&gt;
* Student pages should show the list of reviews that have been performed.&lt;br /&gt;
* When a user requests a new meta-review, the field which says the number of meta-reviews left ( refer to above image “Numbers of Meta-reviews left:”) does not change and the button to request a new meta-review disappears.&lt;br /&gt;
&lt;br /&gt;
===Previous Work===&lt;br /&gt;
&lt;br /&gt;
This assignment is a repeat of E1997 which was assigned to students last semester, Fall 2019.&lt;br /&gt;
&lt;br /&gt;
Details of the previous implementation can be found here:&lt;br /&gt;
[http://https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1997._Issues_related_to_meta-reviewing E1997]&lt;br /&gt;
&lt;br /&gt;
Our goals are to update the logic, refactor non-DRY code, and fix bugs.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/32 #32 - Remove all debug comments in the UI]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
It was noted in the previous team's implementation that multiple debugging comments were showing up during their video testing.&lt;br /&gt;
&lt;br /&gt;
Debug messages shown when viewing a completed meta review:&lt;br /&gt;
[[File:Debug_comments.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
There was a mistake in &amp;lt;code&amp;gt;app/views/response/_review.html.erb&amp;lt;/code&amp;gt; where &amp;quot;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;hr/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;quot; was being displayed under the review being meta-reviewed. This was due to being included as a string constant rather than html code. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_comments_response_review.PNG]]&lt;br /&gt;
&lt;br /&gt;
There was an instance in &amp;lt;code&amp;gt;app/views/response/view.html.erb&amp;lt;/code&amp;gt; where ruby code responsible for getting a review to be displayed was being interpreted and displayed, even though the response was being displayed as html in the line before. This resulted in the response details being listed in the UI erroneously.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_response_view.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/49 #49 - &amp;quot;Request a new meta-review&amp;quot; button crashes when there are no available reviews]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
When there are no valid metareviews to perform (either there are no reivews performed on the assignment, the only valid reviews concern your own work or own reviews, you have completed all allowed metareviews, or you have reviewed all valid reviews already) then the &amp;quot;Request a New Review&amp;quot; button still is visible and displays the following error (correctly) when pressed.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. Log in as instructor6, click on mange...-&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
2. Click on edit assignment, navigate to Due Dates and check &amp;quot;Use meta-review deadline&amp;quot; checkbox&lt;br /&gt;
&lt;br /&gt;
3. Select &amp;quot;Yes&amp;quot; for all submission allowed, Review allowed and Meta-review allowed in all of the deadline types&lt;br /&gt;
&lt;br /&gt;
4. Navigate back to Assignment Tree View and click on &amp;quot;Add participant&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Add couple of students(say student1 and student2) to the assignment&lt;br /&gt;
&lt;br /&gt;
6. Impersonate/login as student1 and make a submission&lt;br /&gt;
&lt;br /&gt;
7. Log in as instructor6 as previously described and change the submission due date to be passed so we are currently in the review stage&lt;br /&gt;
&lt;br /&gt;
8. Impersonate/login as student2 and Request for a new review under others work, submit the review&lt;br /&gt;
&lt;br /&gt;
9. Log in as instructor6 as previously described and change the review due date to be passed so we are currently in the meta-review stage&lt;br /&gt;
&lt;br /&gt;
10. Impersonate/login back as student1 (the one with the submission) and Request for a new meta review&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_outofreviews.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we conditionally hide the button based on whether or not the participant has reviews available to perform. These checks are located in assignment.rb which is the model for an Assignment. The following method was added to assignment.rb and returns true when the participant has a valid meta-review available.&lt;br /&gt;
&lt;br /&gt;
  # Returns true if there is a meta-review task available for the user&lt;br /&gt;
  def metareview_available?(user_id)&lt;br /&gt;
    metareviewer = AssignmentParticipant.where(user_id: user_id, parent_id: self.id).first&lt;br /&gt;
    begin&lt;br /&gt;
      self.response_map_to_metareview(metareviewer)&lt;br /&gt;
      true&lt;br /&gt;
    rescue &lt;br /&gt;
      false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/27 #27 - Defaulting Required and Allowed Meta-reviews to NULL in Assignment Database]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
Currently, the number of required and allowed meta-reviews is always being set to 3 in the database. Per the specs of the feature, it should default the database values to NULL. When checkbox &amp;quot;Use meta-review deadline&amp;quot;, in the &amp;quot;Due Dates&amp;quot; tab, is selected then the view should populate required and allowed meta-reviews to 3.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
== '''Issue 5 - Meta Review Limit is Not Functioning Correctly in Assignment Creation''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;has meta review limit&amp;quot; should determine whether a limit or requirement is placed on the student to complete meta reviews. If disabled, then they should be able to complete as many as they want. This is independent of the Meta Review STAGE that is enabled/disabled in the due dates tab. They should not impact each other and currently do within the assignment creation.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. If the &amp;quot;Use meta-review deadline&amp;quot; is disabled, then the Meta Review Limit panel disappears&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Has meta-review limit?&amp;quot; is hidden on edit&lt;br /&gt;
&lt;br /&gt;
3. Possibility the &amp;quot;Has meta-review limit?&amp;quot; not being saved on assignment creation?&lt;br /&gt;
&lt;br /&gt;
4. If the &amp;quot;Use meta-review deadline&amp;quot; is toggled (disabled, enabled), then the &amp;quot;Has meta-review limit?&amp;quot; resets to disabled&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
&lt;br /&gt;
The code in _due_dates.html.erb and the _review_strategy.html.erb within the /app/app/views/assignments/edit folder is lazily written and does not really adhere to the project specifications of how metareviews should work on assignment creation. These views need to be edited to work correctly and also respond to the changes in issue 5.&lt;br /&gt;
&lt;br /&gt;
== '''Discovered Bugs:''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/48 #48 - Number of meta-reviews allowed for an assignment is always  nil]''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/45 #45 - &amp;quot;Request a new meta-review&amp;quot; button bugs]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Request new a meta-review&amp;quot; button should be hidden when:&lt;br /&gt;
# The number of meta-reviews in-progress is greater than the maximum allowed outstanding reviews.&lt;br /&gt;
# The number of reviews allowed is limited AND the total number of meta-reviews completed or in-progress is greater than the number allowed.&lt;br /&gt;
# There are no valid reviews available for the participant.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 0 reviewers. The user should NOT be able to see the 'Request a new meta-review to perform' button when there are no reviews available.&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** A student should NOT be able to request a meta-review on their own review.&lt;br /&gt;
*** When the meta-review limit on the assignment is set to 1 then a student should NOT be able to request a second meta-review.&lt;br /&gt;
*** The user should not be able to see the 'Request a new meta-review to perform' button when they have performed all valid reviews.&lt;br /&gt;
** with 4 reviewers.&lt;br /&gt;
*** The user should be able to click the 'Begin' button and still see the 'Request a new meta-review to perform' button.&lt;br /&gt;
*** The user should NOT be able to see the 'Request a new meta-review to perform' button when they have reached the meta-review limit.&lt;br /&gt;
*** If the user requests two meta-reviews but has not submitted, then they should not be able to request a new meta-review.&lt;br /&gt;
*** The user should be able to request a meta-review if they are above their required but below the allowed number of meta-reviews.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/30 #30 - “Numbers of Meta-reviews left:” does not update after a user requests a review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Number of meta-reviews left should decrement when a user requests a meta-review. Current behavior only decremented when a review was submitted.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of Meta-Reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_completed %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fixed behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of meta-reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_total %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is requested.&lt;br /&gt;
*** The user should see the number of meta-reviews left decrement after a new meta-review is completed.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/43 #43 - &amp;quot;Review Allowed&amp;quot; flag is required to be set on a due_date for a user to perform a meta-review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
When an assignment with a meta-review is created the round that meta-reviews will be performed in should have the &amp;quot;Meta-review allowed&amp;quot; option set to yes. This should be the only requirement for making meta-reviews available in that round. The problem with the current implementation is that meta-reviews can only be performed in rounds where the &amp;quot;Review allowed&amp;quot; option is set.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025 Issue43.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were applied to app/views/student_review/_responses.html.erb. Since this partial is shared by both reviews and meta-reviews in list.html.erb the title variable was used to determine if the begin option should be active or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; @assignment.can_review(topic_id) %&amp;gt;&lt;br /&gt;
Current behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; &lt;br /&gt;
        ((@assignment.can_review(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Review&amp;quot;) ||&lt;br /&gt;
         (@assignment.metareview_allowed(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Meta-review&amp;quot;)) %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. All meta-review tests make meta-reviews allowed only during the meta-review round. This means that if the simple meta-review test is passing then this feature is working as intended.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/50 #50 - The submit button is not available for meta-reviews.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Users should see save and submit buttons as part of the meta-review form. These buttons should have the same behavior as the review form. The problem right now is there is not submit button for meta-reviews.&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were made adding 'Metareview' to the conditional that determines if the submit button should be shown or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review')) %&amp;gt;&lt;br /&gt;
New behavior:&lt;br /&gt;
 &amp;lt;% if @title &amp;amp;&amp;amp; ((@title.eql? 'Review') || (@title.eql? 'Self Review') || (@title.eql? 'Metareview'))%&amp;gt;&lt;br /&gt;
   &amp;lt;%= submit_tag &amp;quot;Submit &amp;quot;+@title, :name =&amp;gt; &amp;quot;Submit&amp;quot;, :id =&amp;gt; &amp;quot;Submit&amp;quot; %&amp;gt;&lt;br /&gt;
   &amp;lt;img src=&amp;quot;/assets/info.png&amp;quot; title='- SAVE will only store the peer-review as draft and the peer-review will not be displayed to the reviewee. After clicking SUBMIT, the peer-review will be displayed to reviewee, and you will not be able to update it any more.'&amp;gt;&lt;br /&gt;
 &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Functional tests from a student perspective are in /spec/features/meta_review_spec.rb. The tests assume the allowed number of meta-reviews is 5 and the required number of meta-reviews is 3. Tests for this feature are explained in summary below:&lt;br /&gt;
* For assignments that have a meta-review deadline...&lt;br /&gt;
** with 1 reviewer.&lt;br /&gt;
*** The user is able to SUBMIT a simple meta-review.&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
1. Log in as super_administrator2.  Password is &amp;quot;password&amp;quot;. Click on mange...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Create a new Assignment by clicking the &amp;quot;+&amp;quot; button. Give the assignment these fields: Name, Course and Submission Directory.&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_general.png]]&lt;br /&gt;
&lt;br /&gt;
3. Go to &amp;quot;Due Dates&amp;quot; tab and check &amp;quot;Use meta-review deadline&amp;quot; and then set the due dates 1 into the FUTURE for each review round and meta-review. Leave everything else as default as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_duedates.png]]&lt;br /&gt;
&lt;br /&gt;
4. Go to the &amp;quot;Rubrics&amp;quot; tab and populate as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
5. OPTIONAL: Go to &amp;quot;Review strategy page and select &amp;quot;Has meta-review limit?&amp;quot; and set the number of allowed and required meta-reviews.&lt;br /&gt;
&lt;br /&gt;
6. Once done, &amp;quot;Create&amp;quot; the assignment.&lt;br /&gt;
&lt;br /&gt;
7. Go back to Assignments. manage...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
8. Find the newly created assignment and click on &amp;quot;Add participant&amp;quot;. Add the students below:&lt;br /&gt;
&lt;br /&gt;
[[File:add_participants.png]]&lt;br /&gt;
&lt;br /&gt;
9. Go to manage...Impersonate User and impersonate &amp;quot;Student485&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10. Go to the newly created assignment and submit a link for the assignment.&lt;br /&gt;
&lt;br /&gt;
11. Revert back to super_administrator2 and change the submission due date to a date in the PAST so we are currently in the review stage.&lt;br /&gt;
&lt;br /&gt;
12. Impersonate student486 and request for a new review under others work, submit the review.&lt;br /&gt;
&lt;br /&gt;
13. Revert back to super_administrator2 as previously described and change the review due date to be passed so we are currently in the meta-review stage.&lt;br /&gt;
&lt;br /&gt;
14. Impersonate as student485 and Request for a new meta review.&lt;br /&gt;
&lt;br /&gt;
15. Press &amp;quot;Begin&amp;quot; and complete the meta-review&lt;br /&gt;
&lt;br /&gt;
16. When the review is complete, the &amp;quot;Begin&amp;quot; should disappear and be replaced with &amp;quot;View&amp;quot; and &amp;quot;Edit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Automated Test Plan===&lt;br /&gt;
1. If I create an assignment, then the number of meta-reviews is set to null.&lt;br /&gt;
&lt;br /&gt;
2. If 'Use metareview deadline' is not enabled in the due dates tab, then the meta-review fields in the review strategy tab are not visible.&lt;br /&gt;
&lt;br /&gt;
3. If the metareview limit on the assignment is set to 3, then a student will see they need to submit 3 meta reviews&lt;br /&gt;
&lt;br /&gt;
4. If the metareview deadline is enabled, the assignment cannot be created without a metareview rubric&lt;br /&gt;
&lt;br /&gt;
5. If the assignment created is in a stage that does not have metareview enabled, a metareview cannot be created&lt;br /&gt;
&lt;br /&gt;
6. If the assignment does not have any legal meta reviews, then the &amp;quot;Request a new metareview to perform&amp;quot; button is not visible&lt;br /&gt;
&lt;br /&gt;
7. A student should not be able to request a metareview if they have reached the limit of their allowed reviews&lt;br /&gt;
&lt;br /&gt;
8. A student should be able to request a metareview if they are above their required but below their allowed reviews&lt;br /&gt;
&lt;br /&gt;
9. A student should not be able to request a metareview about their own work. &lt;br /&gt;
&lt;br /&gt;
10. A student should not be able to request a metareview about themselves. &lt;br /&gt;
&lt;br /&gt;
11. If there is a valid metareview to perform related to two other students, then the metareview should be able to be performed.&lt;br /&gt;
&lt;br /&gt;
12. If a student has requested two metareviewes but have not submitted it, then they should not be able to request a new metareview.&lt;br /&gt;
&lt;br /&gt;
13. If the metareview limit on the assignment is set to 1 then a student should not be able to request a second meta review&lt;br /&gt;
&lt;br /&gt;
===Coverage===&lt;br /&gt;
Current test coverage is 41.348%. Code coverage will increase based on the test plan above and the failing test case described below will be fixed.&lt;br /&gt;
&lt;br /&gt;
Travis CI is currently failing because of:&lt;br /&gt;
  Failures:&lt;br /&gt;
  1) assignment function general tab should edit quiz number available to students&lt;br /&gt;
     Failure/Error:&lt;br /&gt;
       child_nodes.each do |node|&lt;br /&gt;
         initialize_fnode_update_children(params, node, tmp_res)&lt;br /&gt;
       end&lt;br /&gt;
     NoMethodError:&lt;br /&gt;
       undefined method `each' for &amp;quot;&amp;quot;:String&lt;br /&gt;
     # ./app/controllers/tree_display_controller.rb:209:in `children_node_ng'&lt;br /&gt;
     # ./config/diagnostic.rb:11:in `call'&lt;br /&gt;
     # ------------------&lt;br /&gt;
     # --- Caused by: ---&lt;br /&gt;
     # Capybara::CapybaraError:&lt;br /&gt;
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true&lt;br /&gt;
     #   /home/travis/build/expertiza/expertiza/vendor/bundle/ruby/2.2.0/gems/capybara-2.17.0/lib/capybara/session.rb:145:in `raise_server_error!'&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134330</id>
		<title>CSC/ECE 517 Spring 2020 - E2025: Issues Related to Meta - Reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=134330"/>
		<updated>2020-04-25T16:15:28Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Proposed Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Overview of Project''' ==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, meta-review is a feature that enables a third party to evaluate the quality of feedback that a reviewer gives a reviewee. meta-review is an important feature that can help students become better reviewers for their peers by providing detailed feedback that is actionable and positively formulated. Unfortunately, this feature is broken and the following issues were identified. The task is to fix these issues so that this feature can be used again.&lt;br /&gt;
&lt;br /&gt;
* An assignment is deemed to have meta-reviews if and only if there is a meta-review deadline for this assignment in the `assignments_questionnaires` table.&lt;br /&gt;
* If there is no meta-review deadline, then don’t show the question about whether there is a max meta-review limit.&lt;br /&gt;
* In the DB the default number of meta-reviews allowed and required should be null.&lt;br /&gt;
* As soon as someone checks the Has meta-review Limit box on the Review Strategy tab, the UI should fill in 3 and 3 as the required and allowed number.&lt;br /&gt;
* Student pages should show the list of reviews that have been performed.&lt;br /&gt;
* When a user requests a new meta-review, the field which says the number of meta-reviews left ( refer to above image “Numbers of Meta-reviews left:”) does not change and the button to request a new meta-review disappears.&lt;br /&gt;
&lt;br /&gt;
===Previous Work===&lt;br /&gt;
&lt;br /&gt;
This assignment is a repeat of E1997 which was assigned to students last semester, Fall 2019.&lt;br /&gt;
&lt;br /&gt;
Details of the previous implementation can be found here:&lt;br /&gt;
[http://https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1997._Issues_related_to_meta-reviewing E1997]&lt;br /&gt;
&lt;br /&gt;
Our goals are to update the logic, refactor non-DRY code, and fix bugs.&lt;br /&gt;
&lt;br /&gt;
===Meta-Review Flow Design===&lt;br /&gt;
&lt;br /&gt;
This diagram describes the interactions of the meta-review system.(From E1997)&lt;br /&gt;
&lt;br /&gt;
[[File:E1997_1.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''Issue 1 - Removing Debugging Comments''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
It was noted in the previous team's implementation that multiple debugging comments were showing up during their video testing.&lt;br /&gt;
&lt;br /&gt;
Debug messages shown when viewing a completed meta review:&lt;br /&gt;
[[File:Debug_comments.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
There was a mistake in &amp;lt;code&amp;gt;app/views/response/_review.html.erb&amp;lt;/code&amp;gt; where &amp;quot;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;hr/&amp;gt;&amp;lt;&amp;lt;nowiki/&amp;gt;br/&amp;gt;&amp;quot; was being displayed under the review being meta-reviewed. This was due to being included as a string constant rather than html code. &lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_comments_response_review.PNG]]&lt;br /&gt;
&lt;br /&gt;
There was an instance in &amp;lt;code&amp;gt;app/views/response/view.html.erb&amp;lt;/code&amp;gt; where ruby code responsible for getting a review to be displayed was being interpreted and displayed, even though the response was being displayed as html in the line before. This resulted in the response details being listed in the UI erroneously.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_debug_response_view.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/49 #49 - &amp;quot;Request a new meta-review&amp;quot; button crashes when there are no available reviews]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
When there are no valid metareviews to perform (either there are no reivews performed on the assignment, the only valid reviews concern your own work or own reviews, you have completed all allowed metareviews, or you have reviewed all valid reviews already) then the &amp;quot;Request a New Review&amp;quot; button still is visible and displays the following error (correctly) when pressed.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. Log in as instructor6, click on mange...-&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
2. Click on edit assignment, navigate to Due Dates and check &amp;quot;Use meta-review deadline&amp;quot; checkbox&lt;br /&gt;
&lt;br /&gt;
3. Select &amp;quot;Yes&amp;quot; for all submission allowed, Review allowed and Meta-review allowed in all of the deadline types&lt;br /&gt;
&lt;br /&gt;
4. Navigate back to Assignment Tree View and click on &amp;quot;Add participant&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Add couple of students(say student1 and student2) to the assignment&lt;br /&gt;
&lt;br /&gt;
6. Impersonate/login as student1 and make a submission&lt;br /&gt;
&lt;br /&gt;
7. Log in as instructor6 as previously described and change the submission due date to be passed so we are currently in the review stage&lt;br /&gt;
&lt;br /&gt;
8. Impersonate/login as student2 and Request for a new review under others work, submit the review&lt;br /&gt;
&lt;br /&gt;
9. Log in as instructor6 as previously described and change the review due date to be passed so we are currently in the meta-review stage&lt;br /&gt;
&lt;br /&gt;
10. Impersonate/login back as student1 (the one with the submission) and Request for a new meta review&lt;br /&gt;
&lt;br /&gt;
[[File:E2025_outofreviews.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we conditionally hide the button based on whether or not the participant has reviews available to perform. These checks are located in assignment.rb which is the controller for Assignment. The following method was added to assignment.rb and returns true when the participant has a valid meta-review available.&lt;br /&gt;
&lt;br /&gt;
  # Returns true if there is a meta-review task available for the user&lt;br /&gt;
  def metareview_available?(user_id)&lt;br /&gt;
    metareviewer = AssignmentParticipant.where(user_id: user_id, parent_id: self.id).first&lt;br /&gt;
    begin&lt;br /&gt;
      self.response_map_to_metareview(metareviewer)&lt;br /&gt;
      true&lt;br /&gt;
    rescue &lt;br /&gt;
      false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''Issue 3 - Private Methods''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Within the code for the meta-reviewing, it is noted that many statements could be moved to private methods to avoid conflating the purpose of the method with meta-reviewing specifics. We will use the code climate as a guide to reduce the block size and use existing or new private methods when possible to make the logic of the program easier to follow.&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
On first inspection, this will mainly apply to the code that is located in the Response Controller (response_conotroller.rb) and the view for &amp;quot;list.html.erb&amp;quot; under app/views/student_review. &lt;br /&gt;
&lt;br /&gt;
For example: The &amp;quot;new&amp;quot; method has meta review checks that should probably be abstracted and placed as private methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will also continue applying this to any changes that we make across the course of the project. This also will apply to the scripts that are used in the _due_dates.html.erb and the _review_strategy.html.erb within the /app/app/views/assignments/edit folder. They should be extracted to somewhere else.&lt;br /&gt;
&lt;br /&gt;
== '''Issue 5 - Defaulting Required and Allowed Meta-reviews to NULL in Assignment Database''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
Currently, the number of required and allowed meta-reviews is always being set to 3 in the database. Per the specs of the feature, it should default the database values to NULL. When checkbox &amp;quot;Use meta-review deadline&amp;quot;, in the &amp;quot;Due Dates&amp;quot; tab, is selected then the view should populate required and allowed meta-reviews to 3.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. Log in as instructor6, click on mange...-&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
2. Click on edit assignment, navigate to Due Dates and confirm that &amp;quot;Use meta-review deadline&amp;quot; checkbox is unchecked&lt;br /&gt;
&lt;br /&gt;
3. Use rails c to access the DB&lt;br /&gt;
&lt;br /&gt;
4. Observe that all assignments contain the incorrect db value (3 for all) for Assignments in the db&lt;br /&gt;
&lt;br /&gt;
===Proposed Change===&lt;br /&gt;
&lt;br /&gt;
This will just require making a new migration in the Assignment database to set the default to NULL instead of 3, which we believe it is now on default. This may also bring up other issues in the code in the view by allowing assignments without meta-review limits, but we are unable to see that at this time.&lt;br /&gt;
&lt;br /&gt;
file: schema.rb&lt;br /&gt;
&lt;br /&gt;
  create_table &amp;quot;assignments&amp;quot;, force: :cascade do |t|&lt;br /&gt;
    ...&lt;br /&gt;
    t.boolean  &amp;quot;is_anonymous&amp;quot;,                                                     default: true&lt;br /&gt;
    t.integer  &amp;quot;num_reviews_required&amp;quot;,                               limit: 4,     default: 3&lt;br /&gt;
    t.integer  &amp;quot;num_metareviews_required&amp;quot;,                           limit: 4,     default: '''NULL'''&lt;br /&gt;
    t.integer  &amp;quot;num_metareviews_allowed&amp;quot;,                            limit: 4,     default: '''NULL'''&lt;br /&gt;
    t.integer  &amp;quot;num_reviews_allowed&amp;quot;,                                limit: 4,     default: 3&lt;br /&gt;
    t.integer  &amp;quot;simicheck&amp;quot;,                                          limit: 4,     default: -1&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
file: _review_strategy.html.erb &lt;br /&gt;
&lt;br /&gt;
This file has all the logic to populate the view with a default value once the &amp;quot;Use meta-review deadline&amp;quot; is checked. No modifications needed.&lt;br /&gt;
&lt;br /&gt;
== '''Issue 6 - Meta Review Limit is Not Functioning Correctly in Assignment Creation''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;has meta review limit&amp;quot; should determine whether a limit or requirement is placed on the student to complete meta reviews. If disabled, then they should be able to complete as many as they want. This is independent of the Meta Review STAGE that is enabled/disabled in the due dates tab. They should not impact each other and currently do within the assignment creation.&lt;br /&gt;
&lt;br /&gt;
===Reproducing Existing Issue===&lt;br /&gt;
&lt;br /&gt;
1. If the &amp;quot;Use meta-review deadline&amp;quot; is disabled, then the Meta Review Limit panel disappears&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Has meta-review limit?&amp;quot; is hidden on edit&lt;br /&gt;
&lt;br /&gt;
3. Possibility the &amp;quot;Has meta-review limit?&amp;quot; not being saved on assignment creation?&lt;br /&gt;
&lt;br /&gt;
4. If the &amp;quot;Use meta-review deadline&amp;quot; is toggled (disabled, enabled), then the &amp;quot;Has meta-review limit?&amp;quot; resets to disabled&lt;br /&gt;
&lt;br /&gt;
===Proposed Changes===&lt;br /&gt;
&lt;br /&gt;
The code in _due_dates.html.erb and the _review_strategy.html.erb within the /app/app/views/assignments/edit folder is lazily written and does not really adhere to the project specifications of how metareviews should work on assignment creation. These views need to be edited to work correctly and also respond to the changes in issue 5.&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/48 #48 - Number of meta-reviews allowed for an assignment is always  nil]''' ==&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/45 #45 - &amp;quot;Request a new meta-review&amp;quot; button bugs]''' ==&lt;br /&gt;
&lt;br /&gt;
===Issue Description===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Request new a meta-review&amp;quot; button should be hidden when:&lt;br /&gt;
# The number of meta-reviews in-progress is greater than the maximum allowed outstanding reviews.&lt;br /&gt;
# The number of reviews allowed is limited AND the total number of meta-reviews completed or in-progress is greater than the number allowed.&lt;br /&gt;
# There are no valid reviews available for the participant.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
This issue deals with the view &amp;quot;list.html.erb&amp;quot; under /app/views/student_review. The code below shows the conditional used to display the &amp;quot;Request new meta-review&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;% if @num_metareviews_in_progress &amp;gt;= Assignment.max_outstanding_reviews %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can't have more than 2 outstanding meta-reviews. You must complete one of your&lt;br /&gt;
    outstanding meta-reviews before selecting another.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif @assignment.num_metareviews_allowed &amp;amp;&amp;amp; @num_metareviews_total == @assignment.num_metareviews_allowed %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Note: You can not do more than &amp;lt;%=@assignment.num_metareviews_allowed%&amp;gt; meta-reviews according&lt;br /&gt;
    to assignment policy.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% elsif (!@assignment.metareview_available?(session[:user].id)) %&amp;gt;&lt;br /&gt;
    &amp;lt;span&amp;gt;Meta-reviews cannot be performed at this time.&amp;lt;/span&amp;gt;&lt;br /&gt;
  &amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;%= render :partial =&amp;gt; 'set_dynamic_metareview', :locals =&amp;gt; {:assignment =&amp;gt; @assignment} %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/RPHolloway/expertiza/issues/31 #31 - Tests]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/30 #30 - “Numbers of Meta-reviews left:” does not update after a user requests a review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
Number of meta-reviews left should decrement when a user requests a meta-review. Current behavior only decremented when a review was submitted.&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of Meta-Reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_completed %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fixed behavior:&lt;br /&gt;
&lt;br /&gt;
 Number of meta-reviews left: &amp;lt;%= @assignment.num_metareviews_allowed - @num_metareviews_total %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/43 #43 - &amp;quot;Review Allowed&amp;quot; flag is required to be set on a due_date for a user to perform a meta-review.]''' ==&lt;br /&gt;
===Issue Description===&lt;br /&gt;
When an assignment with a meta-review is created the round that meta-reviews will be performed in should have the &amp;quot;Meta-review allowed&amp;quot; option set to yes. This should be the only requirement for making meta-reviews available in that round. The problem with the current implementation is that meta-reviews can only be performed in rounds where the &amp;quot;Review allowed&amp;quot; option is set.&lt;br /&gt;
&lt;br /&gt;
[[File:E2025 Issue43.png]]&lt;br /&gt;
&lt;br /&gt;
===Changes===&lt;br /&gt;
Code changes were applied to app/views/student_review/_responses.html.erb. Since this partial is shared by both reviews and meta-reviews in list.html.erb the title variable was used to determine if the begin option should be active or not.&lt;br /&gt;
&lt;br /&gt;
Previous behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; @assignment.can_review(topic_id) %&amp;gt;&lt;br /&gt;
Current behavior:&lt;br /&gt;
 &amp;lt;% elsif @assignment.get_current_stage(topic_id) != &amp;quot;Complete&amp;quot; &amp;amp;&amp;amp; &lt;br /&gt;
        ((@assignment.can_review(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Review&amp;quot;) ||&lt;br /&gt;
         (@assignment.metareview_allowed(topic_id) &amp;amp;&amp;amp; title == &amp;quot;Meta-review&amp;quot;)) %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/RPHolloway/expertiza/issues/29 #29 - Tests]&lt;br /&gt;
&lt;br /&gt;
== '''[https://github.com/RPHolloway/expertiza/issues/50 #50 - The submit button is not available for meta-reviews.]''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
1. Log in as super_administrator2.  Password is &amp;quot;password&amp;quot;. Click on mange...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Create a new Assignment by clicking the &amp;quot;+&amp;quot; button. Give the assignment these fields: Name, Course and Submission Directory.&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_general.png]]&lt;br /&gt;
&lt;br /&gt;
3. Go to &amp;quot;Due Dates&amp;quot; tab and check &amp;quot;Use meta-review deadline&amp;quot; and then set the due dates 1 into the FUTURE for each review round and meta-review. Leave everything else as default as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_duedates.png]]&lt;br /&gt;
&lt;br /&gt;
4. Go to the &amp;quot;Rubrics&amp;quot; tab and populate as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:New_assignment_rubrics.png]]&lt;br /&gt;
&lt;br /&gt;
5. OPTIONAL: Go to &amp;quot;Review strategy page and select &amp;quot;Has meta-review limit?&amp;quot; and set the number of allowed and required meta-reviews.&lt;br /&gt;
&lt;br /&gt;
6. Once done, &amp;quot;Create&amp;quot; the assignment.&lt;br /&gt;
&lt;br /&gt;
7. Go back to Assignments. manage...-&amp;gt; Assignments.&lt;br /&gt;
&lt;br /&gt;
8. Find the newly created assignment and click on &amp;quot;Add participant&amp;quot;. Add the students below:&lt;br /&gt;
&lt;br /&gt;
[[File:add_participants.png]]&lt;br /&gt;
&lt;br /&gt;
9. Go to manage...Impersonate User and impersonate &amp;quot;Student485&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10. Go to the newly created assignment and submit a link for the assignment.&lt;br /&gt;
&lt;br /&gt;
11. Revert back to super_administrator2 and change the submission due date to a date in the PAST so we are currently in the review stage.&lt;br /&gt;
&lt;br /&gt;
12. Impersonate student486 and request for a new review under others work, submit the review.&lt;br /&gt;
&lt;br /&gt;
13. Revert back to super_administrator2 as previously described and change the review due date to be passed so we are currently in the meta-review stage.&lt;br /&gt;
&lt;br /&gt;
14. Impersonate as student485 and Request for a new meta review.&lt;br /&gt;
&lt;br /&gt;
15. Press &amp;quot;Begin&amp;quot; and complete the meta-review&lt;br /&gt;
&lt;br /&gt;
16. When the review is complete, the &amp;quot;Begin&amp;quot; should disappear and be replaced with &amp;quot;View&amp;quot; and &amp;quot;Edit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Automated Test Plan===&lt;br /&gt;
1. If I create an assignment, then the number of meta-reviews is set to null.&lt;br /&gt;
&lt;br /&gt;
2. If 'Use metareview deadline' is not enabled in the due dates tab, then the meta-review fields in the review strategy tab are not visible.&lt;br /&gt;
&lt;br /&gt;
3. If the metareview limit on the assignment is set to 3, then a student will see they need to submit 3 meta reviews&lt;br /&gt;
&lt;br /&gt;
4. If the metareview deadline is enabled, the assignment cannot be created without a metareview rubric&lt;br /&gt;
&lt;br /&gt;
5. If the assignment created is in a stage that does not have metareview enabled, a metareview cannot be created&lt;br /&gt;
&lt;br /&gt;
6. If the assignment does not have any legal meta reviews, then the &amp;quot;Request a new metareview to perform&amp;quot; button is not visible&lt;br /&gt;
&lt;br /&gt;
7. A student should not be able to request a metareview if they have reached the limit of their allowed reviews&lt;br /&gt;
&lt;br /&gt;
8. A student should be able to request a metareview if they are above their required but below their allowed reviews&lt;br /&gt;
&lt;br /&gt;
9. A student should not be able to request a metareview about their own work. &lt;br /&gt;
&lt;br /&gt;
10. A student should not be able to request a metareview about themselves. &lt;br /&gt;
&lt;br /&gt;
11. If there is a valid metareview to perform related to two other students, then the metareview should be able to be performed.&lt;br /&gt;
&lt;br /&gt;
12. If a student has requested two metareviewes but have not submitted it, then they should not be able to request a new metareview.&lt;br /&gt;
&lt;br /&gt;
13. If the metareview limit on the assignment is set to 1 then a student should not be able to request a second meta review&lt;br /&gt;
&lt;br /&gt;
===Coverage===&lt;br /&gt;
Current test coverage is 41.348%. Code coverage will increase based on the test plan above and the failing test case described below will be fixed.&lt;br /&gt;
&lt;br /&gt;
Travis CI is currently failing because of:&lt;br /&gt;
  Failures:&lt;br /&gt;
  1) assignment function general tab should edit quiz number available to students&lt;br /&gt;
     Failure/Error:&lt;br /&gt;
       child_nodes.each do |node|&lt;br /&gt;
         initialize_fnode_update_children(params, node, tmp_res)&lt;br /&gt;
       end&lt;br /&gt;
     NoMethodError:&lt;br /&gt;
       undefined method `each' for &amp;quot;&amp;quot;:String&lt;br /&gt;
     # ./app/controllers/tree_display_controller.rb:209:in `children_node_ng'&lt;br /&gt;
     # ./config/diagnostic.rb:11:in `call'&lt;br /&gt;
     # ------------------&lt;br /&gt;
     # --- Caused by: ---&lt;br /&gt;
     # Capybara::CapybaraError:&lt;br /&gt;
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true&lt;br /&gt;
     #   /home/travis/build/expertiza/expertiza/vendor/bundle/ruby/2.2.0/gems/capybara-2.17.0/lib/capybara/session.rb:145:in `raise_server_error!'&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_debug_response_view.PNG&amp;diff=134329</id>
		<title>File:E2025 debug response view.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_debug_response_view.PNG&amp;diff=134329"/>
		<updated>2020-04-25T16:14:45Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_debug_comments_response_review.PNG&amp;diff=134328</id>
		<title>File:E2025 debug comments response review.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2025_debug_comments_response_review.PNG&amp;diff=134328"/>
		<updated>2020-04-25T16:03:19Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=132676</id>
		<title>CSC/ECE 517 Spring 2020 - E2025: Issues Related to Meta - Reviewing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2025:_Issues_Related_to_Meta_-_Reviewing&amp;diff=132676"/>
		<updated>2020-04-04T23:35:39Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Creation of page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Intro==&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132606</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132606"/>
		<updated>2020-04-01T02:42:37Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
# '''Remove unnecessary methods''' - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
# '''Save code and avoid DRY issues''' - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
# '''Improve understanding''' - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
The sections below include a link to the commits where the changes were made following the description. We believe that by providing the links to code changes that we will improve the flow of the wiki while giving a better idea of what the code changes look like in each commit. All code changes can be found in pull request [https://github.com/expertiza/expertiza/pull/1698 #1698]&lt;br /&gt;
&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
Code that is only called within the &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt; was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
&amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called by the view to return &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt;. The resulting json of this call was then passed, without modification, into &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt;. Since this was the only place &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called it was combined with &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; method was refactored to include the behavior of &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt;. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call &amp;lt;code&amp;gt;serialize_folder_to_json&amp;lt;/code&amp;gt; makes the code easier to read instead of chasing nested function calls through &amp;lt;code&amp;gt;initialize_fnode_update_children&amp;lt;/code&amp;gt; which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng_2===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng_2&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; since it returns the subfolder items for the folders obtained by &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; in json format. Like the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; refactor &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; was simplified to make a single call to &amp;lt;code&amp;gt;serialize_sub_folder_to_json&amp;lt;/code&amp;gt; making the code easier to read. Again this method was changed from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/d7a364edce289f0efb8487429ba8fec8038f3557 Refactor children_node_ng_2] [https://github.com/expertiza/expertiza/pull/1698/commits/9a1d5caec559d15e576faf10fb55952cf9d99bf7 Rename children_node_2_ng to get_sub_folder_contents] [https://github.com/expertiza/expertiza/pull/1698/commits/867fa9d3f9d5cc988824ce2890e5ebc90708bf79 Rename serialize_to_json to serialize_sub_folder_to_json]&lt;br /&gt;
&lt;br /&gt;
=== Inline function calls to make json serialization more clear ===&lt;br /&gt;
Where it could be done without making the existing functions unwieldy functions that updated json properties were moved up one level. This makes it easier to see in one place what properties are being modified by the serialization functions. [https://github.com/expertiza/expertiza/pull/1698/commits/d7acad1904a5431d1714008b738bc127582d53a7 Inline function calls to make json serialization more clear]&lt;br /&gt;
&lt;br /&gt;
=== Simplify checks for determining a users access to view a course ===&lt;br /&gt;
With guidance from Dr. Gehringer it was determined a TA should have access to view all items for a given course if and only if they are mapped to that course. Likewise a instructor should be able to view all of the items for courses they teach. Admins and super admins have access to all items on the website. These facts allowed us to greatly simplify the checks necessary to determine if a course was available to the current user and if it should be private or not. [https://github.com/expertiza/expertiza/pull/1698/commits/2ea9a2286688ef173613efc1d19e1fdf460af4d0 Simplified is_available checks] [https://github.com/expertiza/expertiza/pull/1698/commits/a9dcbe459ffbab9effa0589b9f618b0a7fb19810 Removed unused is_available checks]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
In the legacy code found in &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt;, 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the &amp;lt;code&amp;gt;goto_controller()&amp;lt;/code&amp;gt; method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unnecessary code to sort assignments by instructor and creation date===&lt;br /&gt;
By default assignments are received from &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt; sorted by instructor and creation date. There is no need to resort this object. [https://github.com/expertiza/expertiza/pull/1698/commits/81a401083e5a4fd2d9720fd015dd7d515b808f83 Remove unnecessary code to sort assignments by instructor and creation date]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;filter_node_is_qan()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* &amp;lt;code&amp;gt;courses_assignments_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;confirm_notifications_access()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;child_nodes_from_params()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;res_node_for_child()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* &amp;lt;code&amp;gt;update_tmp_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the &amp;lt;code&amp;gt;serialize_to_json&amp;lt;/code&amp;gt; method which called it there was no reason to write a new method to call. Especially since the &amp;lt;code&amp;gt;update_tmp_obj&amp;lt;/code&amp;gt; method was only making minor changes to the json.&lt;br /&gt;
* &amp;lt;code&amp;gt;bridge_to_is_available()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;action()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All tests described below have been implemented in the [https://github.com/RPHolloway/expertiza/blob/beta/spec/controllers/tree_display_controller_spec.rb tree_display_controller_spec.rb file]. Since this project was focused on refactoring the tree_display_controller.rb code, and not on adding any functionality, we have edited the spec file to accommodate for our changes. [https://github.com/expertiza/expertiza/pull/1698/files?file-filters%5B%5D=.rb#diff-daf992d845e06cb7f3dff81021736967 All changes to the spec file] correspond to the refactoring that we have done.&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should not redirect to tree_display#list if the current user is an instructor.&lt;br /&gt;
:A user is defined to be an instructor. When the &amp;lt;code&amp;gt;get &amp;quot;list&amp;quot;&amp;lt;/code&amp;gt; method is called, the response should not redirect to the tree_display/list&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to student_task#list if current user is a student&lt;br /&gt;
:A user is defined to be a student. Instead of redirecting to the tree_display list, it should redirect to the student_task list. &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to login page if current user is nil.&lt;br /&gt;
:This is a catch all for if a user somehow directs to the list without signing in, they shouldn't be able to see anything without signing in first.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#ta_for_current_mappings?&amp;lt;/code&amp;gt; should return true if the current user is a TA for current course&lt;br /&gt;
:This test should check that the method properly returns true if it receives a ta as the user.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#drill&amp;lt;/code&amp;gt; should redirect to list action&lt;br /&gt;
:The drill method should redirect to the tree_display controller with the list action.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #session_last_open_tab&amp;lt;/code&amp;gt; should return a status of 200.&lt;br /&gt;
:The HTTP status 200 is the OK SUCCESS status to show that the get request succeeds.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(private) as a json.&lt;br /&gt;
:When there is a course (private) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return an empty list if no courses&lt;br /&gt;
:When the public and private courses have been deleted/aren't present, then the list returned should be empty, consisting of 'Courses: []'&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(public) as a json.&lt;br /&gt;
:When there is a course (public) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty array if the logged in user is not a TA.&lt;br /&gt;
:Edge case testing to ensure that a user with the role of student results in an empty array.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return a list of course objects the TA is supposed to TA in as json.&lt;br /&gt;
:If the logged in user is a TA, then return should be a json of all courses that the user is a ta for.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list when there is no mapping between a ta and a course.&lt;br /&gt;
:If the TA is not mapped to a course then the return should be empty.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only courses that a TA is a TA for. It should not return any courses that the user is a student in, but not a TA in.&lt;br /&gt;
:Edge case test for when the user is a student in some classes, but a TA in others.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only the course he/she is TA of when the TA is a student of the same course.&lt;br /&gt;
:Edge case test for a student in a course also being a TA, most likely because of an error in assignment.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; returns only the assignments which belongs to the course he/she is TA of.&lt;br /&gt;
:All assignments in the courses that the TA is assigned to should be returned.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list if none of the assignments belong to the course he/she is TA of.&lt;br /&gt;
:Edge case test for when there are assignments, but they don't belong to courses which he/she is a TA.&lt;br /&gt;
&lt;br /&gt;
=== Test Results ===&lt;br /&gt;
&lt;br /&gt;
[[File:E2006_test_results.png]]&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2006_test_results.png&amp;diff=132605</id>
		<title>File:E2006 test results.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2006_test_results.png&amp;diff=132605"/>
		<updated>2020-04-01T02:41:30Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:E2006 test results.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2006_test_results.png&amp;diff=132603</id>
		<title>File:E2006 test results.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2006_test_results.png&amp;diff=132603"/>
		<updated>2020-04-01T02:37:30Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132525</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132525"/>
		<updated>2020-03-31T23:12:07Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
# '''Remove unnecessary methods''' - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
# '''Save code and avoid DRY issues''' - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
# '''Improve understanding''' - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
The sections below include a link to the commits where the changes were made following the description. We believe that by providing the links to code changes that we will improve the flow of the wiki while giving a better idea of what the code changes look like in each commit. All code changes can be found in pull request [https://github.com/expertiza/expertiza/pull/1698 #1698]&lt;br /&gt;
&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
Code that is only called within the &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt; was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
&amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called by the view to return &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt;. The resulting json of this call was then passed, without modification, into &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt;. Since this was the only place &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called it was combined with &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; method was refactored to include the behavior of &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt;. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call &amp;lt;code&amp;gt;serialize_folder_to_json&amp;lt;/code&amp;gt; makes the code easier to read instead of chasing nested function calls through &amp;lt;code&amp;gt;initialize_fnode_update_children&amp;lt;/code&amp;gt; which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng_2===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng_2&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; since it returns the subfolder items for the folders obtained by &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; in json format. Like the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; refactor &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; was simplified to make a single call to &amp;lt;code&amp;gt;serialize_sub_folder_to_json&amp;lt;/code&amp;gt; making the code easier to read. Again this method was changed from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/d7a364edce289f0efb8487429ba8fec8038f3557 Refactor children_node_ng_2] [https://github.com/expertiza/expertiza/pull/1698/commits/9a1d5caec559d15e576faf10fb55952cf9d99bf7 Rename children_node_2_ng to get_sub_folder_contents] [https://github.com/expertiza/expertiza/pull/1698/commits/867fa9d3f9d5cc988824ce2890e5ebc90708bf79 Rename serialize_to_json to serialize_sub_folder_to_json]&lt;br /&gt;
&lt;br /&gt;
=== Inline function calls to make json serialization more clear ===&lt;br /&gt;
Where it could be done without making the existing functions unwieldy functions that updated json properties were moved up one level. This makes it easier to see in one place what properties are being modified by the serialization functions. [https://github.com/expertiza/expertiza/pull/1698/commits/d7acad1904a5431d1714008b738bc127582d53a7 Inline function calls to make json serialization more clear]&lt;br /&gt;
&lt;br /&gt;
=== Simplify checks for determining a users access to view a course ===&lt;br /&gt;
With guidance from Dr. Gehringer it was determined a TA should have access to view all items for a given course if and only if they are mapped to that course. Likewise a instructor should be able to view all of the items for courses they teach. Admins and super admins have access to all items on the website. These facts allowed us to greatly simplify the checks necessary to determine if a course was available to the current user and if it should be private or not. [https://github.com/expertiza/expertiza/pull/1698/commits/2ea9a2286688ef173613efc1d19e1fdf460af4d0 Simplified is_available checks] [https://github.com/expertiza/expertiza/pull/1698/commits/a9dcbe459ffbab9effa0589b9f618b0a7fb19810 Removed unused is_available checks]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
In the legacy code found in &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt;, 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the &amp;lt;code&amp;gt;goto_controller()&amp;lt;/code&amp;gt; method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unnecessary code to sort assignments by instructor and creation date===&lt;br /&gt;
By default assignments are received from &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt; sorted by instructor and creation date. There is no need to resort this object. [https://github.com/expertiza/expertiza/pull/1698/commits/81a401083e5a4fd2d9720fd015dd7d515b808f83 Remove unnecessary code to sort assignments by instructor and creation date]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;filter_node_is_qan()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* &amp;lt;code&amp;gt;courses_assignments_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;confirm_notifications_access()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;child_nodes_from_params()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;res_node_for_child()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* &amp;lt;code&amp;gt;update_tmp_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the &amp;lt;code&amp;gt;serialize_to_json&amp;lt;/code&amp;gt; method which called it there was no reason to write a new method to call. Especially since the &amp;lt;code&amp;gt;update_tmp_obj&amp;lt;/code&amp;gt; method was only making minor changes to the json.&lt;br /&gt;
* &amp;lt;code&amp;gt;bridge_to_is_available()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;action()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should not redirect to tree_display#list if the current user is an instructor.&lt;br /&gt;
:A user is defined to be an instructor. When the &amp;lt;code&amp;gt;get &amp;quot;list&amp;quot;&amp;lt;/code&amp;gt; method is called, the response should not redirect to the tree_display/list&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to student_task#list if current user is a student&lt;br /&gt;
:A user is defined to be a student. Instead of redirecting to the tree_display list, it should redirect to the student_task list. &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to login page if current user is nil.&lt;br /&gt;
:This is a catch all for if a user somehow directs to the list without signing in, they shouldn't be able to see anything without signing in first.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#ta_for_current_mappings?&amp;lt;/code&amp;gt; should return true if the current user is a TA for current course&lt;br /&gt;
:This test should check that the method properly returns true if it receives a ta as the user.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#drill&amp;lt;/code&amp;gt; should redirect to list action&lt;br /&gt;
:The drill method should redirect to the tree_display controller with the list action.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #session_last_open_tab&amp;lt;/code&amp;gt; should return a status of 200.&lt;br /&gt;
:The HTTP status 200 is the OK SUCCESS status to show that the get request succeeds.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(private) as a json.&lt;br /&gt;
:When there is a course (private) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return an empty list if no courses&lt;br /&gt;
:When the public and private courses have been deleted/aren't present, then the list returned should be empty, consisting of 'Courses: []'&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(public) as a json.&lt;br /&gt;
:When there is a course (public) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty array if the logged in user is not a TA.&lt;br /&gt;
:Edge case testing to ensure that a user with the role of student results in an empty array.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return a list of course objects the TA is supposed to TA in as json.&lt;br /&gt;
:If the logged in user is a TA, then return should be a json of all courses that the user is a ta for.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list when there is no mapping between a ta and a course.&lt;br /&gt;
:If the TA is not mapped to a course then the return should be empty.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only courses that a TA is a TA for. It should not return any courses that the user is a student in, but not a TA in.&lt;br /&gt;
:Edge case test for when the user is a student in some classes, but a TA in others.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only the course he/she is TA of when the TA is a student of the same course.&lt;br /&gt;
:Edge case test for a student in a course also being a TA, most likely because of an error in assignment.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; returns only the assignments which belongs to the course he/she is TA of.&lt;br /&gt;
:All assignments in the courses that the TA is assigned to should be returned.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list if none of the assignments belong to the course he/she is TA of.&lt;br /&gt;
:Edge case test for when there are assignments, but they don't belong to courses which he/she is a TA.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132064</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132064"/>
		<updated>2020-03-24T02:47:17Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
# '''Remove unnecessary methods''' - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
# '''Save code and avoid DRY issues''' - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
# '''Improve understanding''' - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
The sections below include a link to the commits where the changes were made following the description. All code changes can be found in pull request [https://github.com/expertiza/expertiza/pull/1698 #1698]&lt;br /&gt;
&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
Code that is only called within the &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt; was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
&amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called by the view to return &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt;. The resulting json of this call was then passed, without modification, into &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt;. Since this was the only place &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called it was combined with &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; method was refactored to include the behavior of &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt;. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call &amp;lt;code&amp;gt;serialize_folder_to_json&amp;lt;/code&amp;gt; makes the code easier to read instead of chasing nested function calls through &amp;lt;code&amp;gt;initialize_fnode_update_children&amp;lt;/code&amp;gt; which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng_2===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng_2&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; since it returns the subfolder items for the folders obtained by &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; in json format. Like the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; refactor &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; was simplified to make a single call to &amp;lt;code&amp;gt;serialize_sub_folder_to_json&amp;lt;/code&amp;gt; making the code easier to read. Again this method was changed from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/d7a364edce289f0efb8487429ba8fec8038f3557 Refactor children_node_ng_2] [https://github.com/expertiza/expertiza/pull/1698/commits/9a1d5caec559d15e576faf10fb55952cf9d99bf7 Rename children_node_2_ng to get_sub_folder_contents] [https://github.com/expertiza/expertiza/pull/1698/commits/867fa9d3f9d5cc988824ce2890e5ebc90708bf79 Rename serialize_to_json to serialize_sub_folder_to_json]&lt;br /&gt;
&lt;br /&gt;
=== Inline function calls to make json serialization more clear ===&lt;br /&gt;
Where it could be done without making the existing functions unwieldy functions that updated json properties were moved up one level. This makes it easier to see in one place what properties are being modified by the serialization functions. [https://github.com/expertiza/expertiza/pull/1698/commits/d7acad1904a5431d1714008b738bc127582d53a7 Inline function calls to make json serialization more clear]&lt;br /&gt;
&lt;br /&gt;
=== Simplify checks for determining a users access to view a course ===&lt;br /&gt;
With guidance from Dr. Gehringer it was determined a TA should have access to view all items for a given course if and only if they are mapped to that course. Likewise a instructor should be able to view all of the items for courses they teach. Admins and super admins have access to all items on the website. These facts allowed us to greatly simplify the checks necessary to determine if a course was available to the current user and if it should be private or not. [https://github.com/expertiza/expertiza/pull/1698/commits/2ea9a2286688ef173613efc1d19e1fdf460af4d0 Simplified is_available checks] [https://github.com/expertiza/expertiza/pull/1698/commits/a9dcbe459ffbab9effa0589b9f618b0a7fb19810 Removed unused is_available checks]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
In the legacy code found in &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt;, 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the &amp;lt;code&amp;gt;goto_controller()&amp;lt;/code&amp;gt; method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unnecessary code to sort assignments by instructor and creation date===&lt;br /&gt;
By default assignments are received from &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt; sorted by instructor and creation date. There is no need to resort this object. [https://github.com/expertiza/expertiza/pull/1698/commits/81a401083e5a4fd2d9720fd015dd7d515b808f83 Remove unnecessary code to sort assignments by instructor and creation date]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;filter_node_is_qan()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* &amp;lt;code&amp;gt;courses_assignments_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;confirm_notifications_access()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;child_nodes_from_params()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;res_node_for_child()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* &amp;lt;code&amp;gt;update_tmp_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the &amp;lt;code&amp;gt;serialize_to_json&amp;lt;/code&amp;gt; method which called it there was no reason to write a new method to call. Especially since the &amp;lt;code&amp;gt;update_tmp_obj&amp;lt;/code&amp;gt; method was only making minor changes to the json.&lt;br /&gt;
* &amp;lt;code&amp;gt;bridge_to_is_available()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;action()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should not redirect to tree_display#list if the current user is an instructor.&lt;br /&gt;
:A user is defined to be an instructor. When the &amp;lt;code&amp;gt;get &amp;quot;list&amp;quot;&amp;lt;/code&amp;gt; method is called, the response should not redirect to the tree_display/list&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to student_task#list if current user is a student&lt;br /&gt;
:A user is defined to be a student. Instead of redirecting to the tree_display list, it should redirect to the student_task list. &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to login page if current user is nil.&lt;br /&gt;
:This is a catch all for if a user somehow directs to the list without signing in, they shouldn't be able to see anything without signing in first.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#ta_for_current_mappings?&amp;lt;/code&amp;gt; should return true if the current user is a TA for current course&lt;br /&gt;
:This test should check that the method properly returns true if it receives a ta as the user.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;#drill&amp;lt;/code&amp;gt; should redirect to list action&lt;br /&gt;
:The drill method should redirect to the tree_display controller with the list action.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #session_last_open_tab&amp;lt;/code&amp;gt; should return a status of 200.&lt;br /&gt;
:The HTTP status 200 is the OK SUCCESS status to show that the get request succeeds.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(private) as a json.&lt;br /&gt;
:When there is a course (private) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return an empty list if no courses&lt;br /&gt;
:When the public and private courses have been deleted/aren't present, then the list returned should be empty, consisting of 'Courses: []'&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(public) as a json.&lt;br /&gt;
:When there is a course (public) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty array if the logged in user is not a TA.&lt;br /&gt;
:Edge case testing to ensure that a user with the role of student results in an empty array.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return a list of course objects the TA is supposed to TA in as json.&lt;br /&gt;
:If the logged in user is a TA, then return should be a json of all courses that the user is a ta for.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list when there is no mapping between a ta and a course.&lt;br /&gt;
:If the TA is not mapped to a course then the return should be empty.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only courses that a TA is a TA for. It should not return any courses that the user is a student in, but not a TA in.&lt;br /&gt;
:Edge case test for when the user is a student in some classes, but a TA in others.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only the course he/she is TA of when the TA is a student of the same course.&lt;br /&gt;
:Edge case test for a student in a course also being a TA, most likely because of an error in assignment.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; returns only the assignments which belongs to the course he/she is TA of.&lt;br /&gt;
:All assignments in the courses that the TA is assigned to should be returned.&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list if none of the assignments belong to the course he/she is TA of.&lt;br /&gt;
:Edge case test for when there are assignments, but they don't belong to courses which he/she is a TA.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132063</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132063"/>
		<updated>2020-03-24T02:46:05Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
# '''Remove unnecessary methods''' - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
# '''Save code and avoid DRY issues''' - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
# '''Improve understanding''' - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
The sections below include a link to the commits where the changes were made following the description. All code changes can be found in pull request [https://github.com/expertiza/expertiza/pull/1698 #1698]&lt;br /&gt;
&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
Code that is only called within the &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt; was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
&amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called by the view to return &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt;. The resulting json of this call was then passed, without modification, into &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt;. Since this was the only place &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt; was being called it was combined with &amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; method was refactored to include the behavior of &amp;lt;code&amp;gt;folder_node_ng_getter&amp;lt;/code&amp;gt;. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call &amp;lt;code&amp;gt;serialize_folder_to_json&amp;lt;/code&amp;gt; makes the code easier to read instead of chasing nested function calls through &amp;lt;code&amp;gt;initialize_fnode_update_children&amp;lt;/code&amp;gt; which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng_2===&lt;br /&gt;
&amp;lt;code&amp;gt;children_node_ng_2&amp;lt;/code&amp;gt; was a misleading name. The method has been renamed &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; since it returns the subfolder items for the folders obtained by &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; in json format. Like the &amp;lt;code&amp;gt;get_folder_contents&amp;lt;/code&amp;gt; refactor &amp;lt;code&amp;gt;get_sub_folder_contents&amp;lt;/code&amp;gt; was simplified to make a single call to &amp;lt;code&amp;gt;serialize_sub_folder_to_json&amp;lt;/code&amp;gt; making the code easier to read. Again this method was changed from a post to a get, to better represent what it was doing. Changes to &amp;lt;code&amp;gt;tree_display.jsx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt; had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/d7a364edce289f0efb8487429ba8fec8038f3557 Refactor children_node_ng_2] [https://github.com/expertiza/expertiza/pull/1698/commits/9a1d5caec559d15e576faf10fb55952cf9d99bf7 Rename children_node_2_ng to get_sub_folder_contents] [https://github.com/expertiza/expertiza/pull/1698/commits/867fa9d3f9d5cc988824ce2890e5ebc90708bf79 Rename serialize_to_json to serialize_sub_folder_to_json]&lt;br /&gt;
&lt;br /&gt;
=== Inline function calls to make json serialization more clear ===&lt;br /&gt;
Where it could be done without making the existing functions unwieldy functions that updated json properties were moved up one level. This makes it easier to see in one place what properties are being modified by the serialization functions. [https://github.com/expertiza/expertiza/pull/1698/commits/d7acad1904a5431d1714008b738bc127582d53a7 Inline function calls to make json serialization more clear]&lt;br /&gt;
&lt;br /&gt;
=== Simplify checks for determining a users access to view a course ===&lt;br /&gt;
With guidance from Dr. Gehringer it was determined a TA should have access to view all items for a given course if and only if they are mapped to that course. Likewise a instructor should be able to view all of the items for courses they teach. Admins and super admins have access to all items on the website. These facts allowed us to greatly simplify the checks necessary to determine if a course was available to the current user and if it should be private or not. [https://github.com/expertiza/expertiza/pull/1698/commits/2ea9a2286688ef173613efc1d19e1fdf460af4d0 Simplified is_available checks] [https://github.com/expertiza/expertiza/pull/1698/commits/a9dcbe459ffbab9effa0589b9f618b0a7fb19810 Removed unused is_available checks]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
In the legacy code found in &amp;lt;code&amp;gt;tree_display_controller.rb&amp;lt;/code&amp;gt;, 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the &amp;lt;code&amp;gt;goto_controller()&amp;lt;/code&amp;gt; method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unnecessary code to sort assignments by instructor and creation date===&lt;br /&gt;
By default assignments are received from &amp;lt;code&amp;gt;FolderNode.get&amp;lt;/code&amp;gt; sorted by instructor and creation date. There is no need to resort this object. [https://github.com/expertiza/expertiza/pull/1698/commits/81a401083e5a4fd2d9720fd015dd7d515b808f83 Remove unnecessary code to sort assignments by instructor and creation date]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* &amp;lt;code&amp;gt;filter()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;filter_node_is_qan()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* &amp;lt;code&amp;gt;courses_assignments_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;confirm_notifications_access()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;child_nodes_from_params()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;res_node_for_child()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* &amp;lt;code&amp;gt;update_tmp_obj()&amp;lt;/code&amp;gt;&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the &amp;lt;code&amp;gt;serialize_to_json&amp;lt;/code&amp;gt; method which called it there was no reason to write a new method to call. Especially since the &amp;lt;code&amp;gt;update_tmp_obj&amp;lt;/code&amp;gt; method was only making minor changes to the json.&lt;br /&gt;
* &amp;lt;code&amp;gt;bridge_to_is_available()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;action()&amp;lt;/code&amp;gt;&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from &amp;lt;code&amp;gt;routes.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
; &amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should not redirect to tree_display#list if the current user is an instructor.&lt;br /&gt;
: A user is defined to be an instructor. When the &amp;lt;code&amp;gt;get &amp;quot;list&amp;quot;&amp;lt;/code&amp;gt; method is called, the response should not redirect to the tree_display/list&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to student_task#list if current user is a student&lt;br /&gt;
: A user is defined to be a student. Instead of redirecting to the tree_display list, it should redirect to the student_task list. &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;#list&amp;lt;/code&amp;gt; should redirect to login page if current user is nil.&lt;br /&gt;
: This is a catch all for if a user somehow directs to the list without signing in, they shouldn't be able to see anything without signing in first.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;#ta_for_current_mappings?&amp;lt;/code&amp;gt; should return true if the current user is a TA for current course&lt;br /&gt;
: This test should check that the method properly returns true if it receives a ta as the user.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;#drill&amp;lt;/code&amp;gt; should redirect to list action&lt;br /&gt;
: The drill method should redirect to the tree_display controller with the list action.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #session_last_open_tab&amp;lt;/code&amp;gt; should return a status of 200.&lt;br /&gt;
: The HTTP status 200 is the OK SUCCESS status to show that the get request succeeds.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(private) as a json.&lt;br /&gt;
: When there is a course (private) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return an empty list if no courses&lt;br /&gt;
: When the public and private courses have been deleted/aren't present, then the list returned should be empty, consisting of 'Courses: []'&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents&amp;lt;/code&amp;gt; should return a list of course objects(public) as a json.&lt;br /&gt;
: When there is a course (public) and an assignment defined, the get_folder_contents method should match the json file provided in the test.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty array if the logged in user is not a TA.&lt;br /&gt;
: Edge case testing to ensure that a user with the role of student results in an empty array.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return a list of course objects the TA is supposed to TA in as json.&lt;br /&gt;
: If the logged in user is a TA, then return should be a json of all courses that the user is a ta for.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list when there is no mapping between a ta and a course.&lt;br /&gt;
: If the TA is not mapped to a course then the return should be empty.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only courses that a TA is a TA for. It should not return any courses that the user is a student in, but not a TA in.&lt;br /&gt;
: Edge case test for when the user is a student in some classes, but a TA in others.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return only the course he/she is TA of when the TA is a student of the same course.&lt;br /&gt;
: Edge case test for a student in a course also being a TA, most likely because of an error in assignment.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; returns only the assignments which belongs to the course he/she is TA of.&lt;br /&gt;
: All assignments in the courses that the TA is assigned to should be returned.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;GET #get_folder_contents for TA&amp;lt;/code&amp;gt; should return an empty list if none of the assignments belong to the course he/she is TA of.&lt;br /&gt;
: Edge case test for when there are assignments, but they don't belong to courses which he/she is a TA.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132038</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132038"/>
		<updated>2020-03-24T01:19:20Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
# '''Remove unnecessary methods''' - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
# '''Save code and avoid DRY issues''' - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
# '''Improve understanding''' - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
The sections below include a link to the commits where the changes were made following the description. All code changes can be found in pull request [https://github.com/expertiza/expertiza/pull/1698 #1698]&lt;br /&gt;
&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
&lt;br /&gt;
Code that is only called within the '''tree_display_controller.rb''' was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
'''folder_node_ng_getter''' was being called by the view to return '''FolderNode.get'''. The resulting json of this call was then passed, without modification, into '''children_node_ng'''. Since this was the only place '''folder_node_ng_getter''' was being called it was combined with '''children_node_ng''' to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
'''children_node_ng''' was a misleading name. The method has been renamed '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the '''get_folder_contents''' method was refactored to include the behavior of '''folder_node_ng_getter'''. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call '''serialize_folder_to_json''' makes the code easier to read instead of chasing nested function calls through '''initialize_fnode_update_children''' which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to '''tree_display.jsx''' and '''routes.rb''' had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng_2===&lt;br /&gt;
'''children_node_ng_2''' was a misleading name. The method has been renamed '''get_sub_folder_contents''' since it returns the subfolder items for the folders obtained by '''get_folder_contents''' in json format. Like the '''get_folder_contents''' refactor '''get_sub_folder_contents''' was simplified to make a single call to '''serialize_sub_folder_to_json''' making the code easier to read. Again this method was changed from a post to a get, to better represent what it was doing. Changes to '''tree_display.jsx''' and '''routes.rb''' had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/d7a364edce289f0efb8487429ba8fec8038f3557 Refactor children_node_ng_2] [https://github.com/expertiza/expertiza/pull/1698/commits/9a1d5caec559d15e576faf10fb55952cf9d99bf7 Rename children_node_2_ng to get_sub_folder_contents] [https://github.com/expertiza/expertiza/pull/1698/commits/867fa9d3f9d5cc988824ce2890e5ebc90708bf79 Rename serialize_to_json to serialize_sub_folder_to_json]&lt;br /&gt;
&lt;br /&gt;
=== Inline function calls to make json serialization more clear ===&lt;br /&gt;
Where it could be done without making the existing functions unwieldy functions that updated json properties were moved up one level. This makes it easier to see in one place what properties are being modified by the serialization functions. [https://github.com/expertiza/expertiza/pull/1698/commits/d7acad1904a5431d1714008b738bc127582d53a7 Inline function calls to make json serialization more clear]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unnecessary code to sort assignments by instructor and creation date===&lt;br /&gt;
By default assignments are received from '''FolderNode.get''' sorted by instructor and creation date. There is no need to resort this object. [https://github.com/expertiza/expertiza/pull/1698/commits/81a401083e5a4fd2d9720fd015dd7d515b808f83 Remove unnecessary code to sort assignments by instructor and creation date]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* '''filter()'''&lt;br /&gt;
* '''filter_node_is_qan()'''&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* '''courses_assignments_obj()'''&lt;br /&gt;
* '''confirm_notifications_access()'''&lt;br /&gt;
* '''child_nodes_from_params()'''&lt;br /&gt;
* '''res_node_for_child()'''&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* '''update_tmp_obj()'''&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it there was no reason to write a new method to call. Especially since the '''update_tmp_obj''' method was only making minor changes to the json.&lt;br /&gt;
* '''bridge_to_is_available()'''&lt;br /&gt;
* '''action()'''&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from '''routes.rb'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
; List should not redirect to tree_display#list if the current user is an instructor.&lt;br /&gt;
: A user is defined to be an instructor. When the &amp;lt;code&amp;gt;get &amp;quot;list&amp;quot;&amp;lt;/code&amp;gt; method is called&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132024</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132024"/>
		<updated>2020-03-24T01:01:24Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
; '''Remove unnecessary methods'''&lt;br /&gt;
:Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
; '''Save code and avoid DRY issues'''&lt;br /&gt;
:In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
; '''Improve understanding'''&lt;br /&gt;
:For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
The sections below include a link to the commits where the changes were made following the description. All code changes can be found in pull request [https://github.com/expertiza/expertiza/pull/1698 #1698]&lt;br /&gt;
&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
&lt;br /&gt;
Code that is only called within the '''tree_display_controller.rb''' was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
'''folder_node_ng_getter''' was being called by the view to return '''FolderNode.get'''. The resulting json of this call was then passed, without modification, into '''children_node_ng'''. Since this was the only place '''folder_node_ng_getter''' was being called it was combined with '''children_node_ng''' to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
'''children_node_ng''' was a misleading name. The method has been renamed '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the '''get_folder_contents''' method was refactored to include the behavior of '''folder_node_ng_getter'''. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call '''serialize_folder_to_json''' makes the code easier to read instead of chasing nested function calls through '''initialize_fnode_update_children''' which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to '''tree_display.jsx''' and '''routes.rb''' had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* '''filter()'''&lt;br /&gt;
* '''filter_node_is_qan()'''&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* '''courses_assignments_obj()'''&lt;br /&gt;
* '''confirm_notifications_access()'''&lt;br /&gt;
* '''child_nodes_from_params()'''&lt;br /&gt;
* '''res_node_for_child()'''&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* '''update_tmp_obj()'''&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it there was no reason to write a new method to call. Especially since the '''update_tmp_obj''' method was only making minor changes to the json.&lt;br /&gt;
* '''bridge_to_is_available()'''&lt;br /&gt;
* '''action()'''&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from '''routes.rb'''&lt;br /&gt;
&lt;br /&gt;
=== Assume an object with FolderNode properties is passed to children_node_2_ng ===&lt;br /&gt;
&lt;br /&gt;
=== Populate JSON object within serialize methods ===&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132012</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132012"/>
		<updated>2020-03-24T00:44:17Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
; '''Remove unnecessary methods'''&lt;br /&gt;
:Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
; '''Save code and avoid DRY issues'''&lt;br /&gt;
:In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
; '''Improve understanding'''&lt;br /&gt;
:For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
&lt;br /&gt;
Code that is only called within the '''tree_display_controller.rb''' was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
'''folder_node_ng_getter''' was being called by the view to return '''FolderNode.get'''. The resulting json of this call was then passed, without modification, into '''children_node_ng'''. Since this was the only place '''folder_node_ng_getter''' was being called it was combined with '''children_node_ng''' to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
'''children_node_ng''' was a misleading name. The method has been renamed '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the '''get_folder_contents''' method was refactored to include the behavior of '''folder_node_ng_getter'''. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call '''serialize_folder_to_json''' makes the code easier to read instead of chasing nested function calls through '''initialize_fnode_update_children''' which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to '''tree_display.jsx''' and '''routes.rb''' had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* '''filter()'''&lt;br /&gt;
* '''filter_node_is_qan()'''&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* '''courses_assignments_obj()'''&lt;br /&gt;
* '''confirm_notifications_access()'''&lt;br /&gt;
* '''child_nodes_from_params()'''&lt;br /&gt;
* '''res_node_for_child()'''&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* '''update_tmp_obj()'''&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it there was no reason to write a new method to call. Especially since the '''update_tmp_obj''' method was only making minor changes to the json.&lt;br /&gt;
* '''bridge_to_is_available()'''&lt;br /&gt;
* '''action()'''&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from '''routes.rb'''&lt;br /&gt;
&lt;br /&gt;
=== Assume an object with FolderNode properties is passed to children_node_2_ng ===&lt;br /&gt;
&lt;br /&gt;
=== Populate JSON object within serialize methods ===&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132010</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=132010"/>
		<updated>2020-03-24T00:43:01Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
[https://docs.google.com/document/d/1_-rgdE4Fh_Fz_Jhxw1Qj4vehbu84qiUKAiLWGcFUl5A/edit#heading=h.h37uqoqtoks4 E2006. Refactor tree_display_controller.rb]&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows that specific questionnaires are nested under different questionnaire categories.  This means that the node for a questionnaire has a parent_id that points to a node for a questionnaire category. Similarly, listings of courses and their assignments are hierarchical.&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller was 379 lines long, and contained 45 methods. Many of those methods had similar names and were performing very similar functions. In an effort to save code and avoid DRY issues this file was refactored.&lt;br /&gt;
&lt;br /&gt;
This effort reduced the controller to less than 200 lines, 20 public methods (15 of which are necessary scaffold for menu navigation), and 6 private methods.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background three main goals were derived to focus on in the refactor of tree display controller:&lt;br /&gt;
; '''Remove unnecessary methods'''&lt;br /&gt;
:Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
; '''Save code and avoid DRY issues'''&lt;br /&gt;
:In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
; '''Improve understanding'''&lt;br /&gt;
:For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
&lt;br /&gt;
Code that is only called within the '''tree_display_controller.rb''' was moved to the private scope. This makes the code easier to read and easier to understand what is getting called outside the controller. [https://github.com/expertiza/expertiza/pull/1698/commits/0f3cda31e9e16eb3b435ca8e2a80f26f0e094f39 Assign private designation to internal methods]&lt;br /&gt;
&lt;br /&gt;
=== Combine folder_node_ng_getter with children_node_ng ===&lt;br /&gt;
'''folder_node_ng_getter''' was being called by the view to return '''FolderNode.get'''. The resulting json of this call was then passed, without modification, into '''children_node_ng'''. Since this was the only place '''folder_node_ng_getter''' was being called it was combined with '''children_node_ng''' to make things easier to read when when viewing controller code. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
'''children_node_ng''' was a misleading name. The method has been renamed '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. In addition to the name change, the '''get_folder_contents''' method was refactored to include the behavior of '''folder_node_ng_getter'''. This addition simplifies the code because the method no longer needs to convert the object that was converted to json back to an object. A single call '''serialize_folder_to_json''' makes the code easier to read instead of chasing nested function calls through '''initialize_fnode_update_children''' which ultimately leads to the same result. Another key change was changing the method from a post to a get, to better represent what it was doing. Changes to '''tree_display.jsx''' and '''routes.rb''' had to be made to account for the name change and method type change. [https://github.com/expertiza/expertiza/pull/1698/commits/1d6401807b0fee302b765ea67b8024ca0f1658a7 Refactor children_node_ng]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values. Those 11 methods were condensed into single line methods with one overarching comment to describe them. This change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2). [https://github.com/expertiza/expertiza/pull/1698/commits/2732cef5eb3bcf258b61447277bd82d8d58f7c54 Compact gotos]&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* '''filter()'''&lt;br /&gt;
* '''filter_node_is_qan()'''&lt;br /&gt;
These methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
* '''courses_assignments_obj()'''&lt;br /&gt;
* '''confirm_notifications_access()'''&lt;br /&gt;
* '''child_nodes_from_params()'''&lt;br /&gt;
* '''res_node_for_child()'''&lt;br /&gt;
These methods are not used in the app.&lt;br /&gt;
* '''update_tmp_obj()'''&lt;br /&gt;
This method was used only once in the app, and it was in the tree display controller, since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it there was no reason to write a new method to call. Especially since the '''update_tmp_obj''' method was only making minor changes to the json.&lt;br /&gt;
* '''bridge_to_is_available()'''&lt;br /&gt;
* '''action()'''&lt;br /&gt;
These methods are not called in the app. References to these methods were removed from '''routes.rb'''&lt;br /&gt;
&lt;br /&gt;
=== Assume an object with FolderNode properties is passed to children_node_2_ng ===&lt;br /&gt;
&lt;br /&gt;
=== Populate JSON object within serialize methods ===&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131879</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131879"/>
		<updated>2020-03-23T22:15:03Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Make all file scope methods private */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
&lt;br /&gt;
We decided to make any code that is only called within the '''tree_display_controller.rb''' to be private. By doing this we are making the code easier to read and easier for future people looking at the code to understand what is getting called from outside the controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  private&lt;br /&gt;
  &lt;br /&gt;
  # Add assignment attributes to json&lt;br /&gt;
  def serialize_assignment_to_json(node, json)&lt;br /&gt;
    json.merge!(&lt;br /&gt;
      &amp;quot;course_id&amp;quot; =&amp;gt; node.get_course_id,&lt;br /&gt;
        &amp;quot;max_team_size&amp;quot; =&amp;gt; node.get_max_team_size,&lt;br /&gt;
        &amp;quot;is_intelligent&amp;quot; =&amp;gt; node.get_is_intelligent,&lt;br /&gt;
        &amp;quot;require_quiz&amp;quot; =&amp;gt; node.get_require_quiz,&lt;br /&gt;
        &amp;quot;allow_suggestions&amp;quot; =&amp;gt; node.get_allow_suggestions,&lt;br /&gt;
        &amp;quot;has_topic&amp;quot; =&amp;gt; SignUpTopic.where(['assignment_id = ?', node.node_object_id]).first ? true : false&lt;br /&gt;
    )&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # Creates a json object that can be displayed by the UI&lt;br /&gt;
  def serialize_folder_to_json(folder_type, node)&lt;br /&gt;
    json = {&lt;br /&gt;
      &amp;quot;nodeinfo&amp;quot; =&amp;gt; node,&lt;br /&gt;
      &amp;quot;name&amp;quot; =&amp;gt; node.get_name,&lt;br /&gt;
      &amp;quot;type&amp;quot; =&amp;gt; node.type&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    if folder_type == &amp;quot;Courses&amp;quot; or folder_type == &amp;quot;Assignments&amp;quot;&lt;br /&gt;
      json.merge! ({&lt;br /&gt;
        &amp;quot;directory&amp;quot; =&amp;gt; node.get_directory,&lt;br /&gt;
        &amp;quot;creation_date&amp;quot; =&amp;gt; node.get_creation_date,&lt;br /&gt;
        &amp;quot;updated_date&amp;quot; =&amp;gt; node.get_modified_date,&lt;br /&gt;
        &amp;quot;institution&amp;quot; =&amp;gt; Institution.where(id: node.retrieve_institution_id),&lt;br /&gt;
        &amp;quot;private&amp;quot; =&amp;gt; assignment_or_course_is_available?(node)&lt;br /&gt;
      })&lt;br /&gt;
      json[&amp;quot;instructor_id&amp;quot;] = node.get_instructor_id&lt;br /&gt;
      json[&amp;quot;instructor&amp;quot;] = node.get_instructor_id ? User.find(node.get_instructor_id).name(session[:ip]) : nil&lt;br /&gt;
      json[&amp;quot;is_available&amp;quot;] = assignment_or_course_is_available?(node)&lt;br /&gt;
      if folder_type == &amp;quot;Assignments&amp;quot;&lt;br /&gt;
        serialize_assignment_to_json(node, json)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    return json&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # Creates a json object that can be displayed by the UI&lt;br /&gt;
  def serialize_sub_folder_to_json(node)&lt;br /&gt;
    json = {&lt;br /&gt;
      &amp;quot;nodeinfo&amp;quot; =&amp;gt; node,&lt;br /&gt;
      &amp;quot;name&amp;quot; =&amp;gt; node.get_name,&lt;br /&gt;
      &amp;quot;type&amp;quot; =&amp;gt; node.type,&lt;br /&gt;
      &amp;quot;key&amp;quot; =&amp;gt; params[:reactParams2][:key],&lt;br /&gt;
      &amp;quot;private&amp;quot; =&amp;gt; node.get_private,&lt;br /&gt;
      &amp;quot;creation_date&amp;quot; =&amp;gt; node.get_creation_date,&lt;br /&gt;
      &amp;quot;updated_date&amp;quot; =&amp;gt; node.get_modified_date&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    if node.type == &amp;quot;Courses&amp;quot; or node.type == &amp;quot;Assignments&amp;quot;&lt;br /&gt;
      json[&amp;quot;directory&amp;quot;] = node.get_directory&lt;br /&gt;
      json[&amp;quot;instructor_id&amp;quot;] = node.get_instructor_id&lt;br /&gt;
      json[&amp;quot;instructor&amp;quot;] = node.get_instructor_id ? User.find(node.get_instructor_id).name(session[:ip]) : nil&lt;br /&gt;
      json[&amp;quot;is_available&amp;quot;] = assignment_or_course_is_available?(node)&lt;br /&gt;
      if folder_type == &amp;quot;Assignments&amp;quot;&lt;br /&gt;
        serialize_assignment_to_json(node, json)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    return json&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # Checks if the user is the instructor for the course or assignment node provided.&lt;br /&gt;
  # Note: Admin and super admin users are considered instructors for all courses.&lt;br /&gt;
  def instructor_for_assignment_or_course?(node)&lt;br /&gt;
    is_available(session[:user], node.get_instructor_id)&lt;br /&gt;
  end&lt;br /&gt;
 	&lt;br /&gt;
  # Check if the user is a TA for the course or assignment node provided.&lt;br /&gt;
  def ta_for_assignment_or_course?(node)&lt;br /&gt;
    ta_mappings = TaMapping.where(ta_id: session[:user].id)&lt;br /&gt;
    course_id = node.is_a?(CourseNode) ? node.node_object_id : Assignment.find(node.node_object_id).course_id&lt;br /&gt;
    ta_mappings.any? { |ta_mapping| ta_mapping.course_id == course_id }&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # Check if the provided node is avaiable to the logged in user.&lt;br /&gt;
  def assignment_or_course_is_available?(node)&lt;br /&gt;
    instructor_for_assignment_or_course?(node) or ta_for_assignment_or_course?(node)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Removal of unneeded HTML POST ===&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable. We also changed the method from a post to a get, to better represent what it was doing, so changes had to be made to account for the name change and method type change. In total, changes were made to '''tree_display.jsx''', '''tree_display_controller.rb''', and '''routes.rb'''.&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_contents_png.PNG|Diff_get_folder_contents_png.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display.jsx====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_js.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_get_folder.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* filter()&lt;br /&gt;
* filter_node_is_qan()&lt;br /&gt;
* courses_assignments_obj()&lt;br /&gt;
* confirm_notifications_access()&lt;br /&gt;
* child_nodes_from_params()&lt;br /&gt;
* res_node_for_child()&lt;br /&gt;
* bridge_to_is_available()&lt;br /&gt;
* update_tmp_obj()&lt;br /&gt;
* action()&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
The '''filter''' and '''filter_node_is_qan''' methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def filter	&lt;br /&gt;
    qid = 'filter+'	&lt;br /&gt;
    search = params[:filter_string]	&lt;br /&gt;
    filter_node = params[:filternode]	&lt;br /&gt;
    if filter_node == 'QAN'                       # Questionaire Assignment Name	&lt;br /&gt;
      qid = filter_node_is_qan(search, qid)	&lt;br /&gt;
    elsif filter_node == 'ACN'                    # Assignment Course Name	&lt;br /&gt;
      session[:root] = 2	&lt;br /&gt;
      qid &amp;lt;&amp;lt; search	&lt;br /&gt;
    end	&lt;br /&gt;
    qid	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # if filter node is 'QAN', get the corresponding assignment questionnaires	&lt;br /&gt;
  def filter_node_is_qan(search, qid)	&lt;br /&gt;
    assignment = Assignment.find_by(name: search)	&lt;br /&gt;
    if assignment	&lt;br /&gt;
      assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: assignment.id)	&lt;br /&gt;
      if assignment_questionnaires	&lt;br /&gt;
        assignment_questionnaires.each { |q| qid &amp;lt;&amp;lt; &amp;quot;#{q.questionnaire_id}+&amp;quot; }	&lt;br /&gt;
        session[:root] = 1	&lt;br /&gt;
      end	&lt;br /&gt;
    end	&lt;br /&gt;
    qid	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''course_assignments_obj''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def courses_assignments_obj(node_type, tmp_object, node)	&lt;br /&gt;
    update_tmp_obj(tmp_object, node)	&lt;br /&gt;
    # tmpObject[&amp;quot;private&amp;quot;] = node.get_private	&lt;br /&gt;
    instructor_id = node.get_instructor_id	&lt;br /&gt;
    ## if current user's role is TA for a course, then that course will be listed under his course listing.	&lt;br /&gt;
    update_in_ta_course_listing(instructor_id, node, tmp_object)	&lt;br /&gt;
    update_instructor(tmp_object, instructor_id)	&lt;br /&gt;
    update_is_available(tmp_object, instructor_id, node)	&lt;br /&gt;
    assignments_method(node, tmp_object) if node_type == &amp;quot;Assignments&amp;quot;	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''confirm_notifications_access''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def confirm_notifications_access	&lt;br /&gt;
    redirect_to controller: :notifications, action: :list if current_user.try(:student?)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''child_nodes_from_params''' method is not called anywhere else in the app&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # finding out child_nodes from params	&lt;br /&gt;
  def child_nodes_from_params(child_nodes)	&lt;br /&gt;
    if child_nodes.is_a? String and !child_nodes.empty?	&lt;br /&gt;
      JSON.parse(child_nodes)	&lt;br /&gt;
    else	&lt;br /&gt;
      child_nodes	&lt;br /&gt;
    end	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''res_node_for_child''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # getting result nodes for child	&lt;br /&gt;
  # Changes to this method were done as part of E1788_OSS_project_Maroon_Heatmap_fixes	&lt;br /&gt;
  #	&lt;br /&gt;
  # courses_assignments_obj method makes a call to update_in_ta_course_listing which	&lt;br /&gt;
  # separates out courses based on if he/she is the TA for the course passed	&lt;br /&gt;
  # by marking private to be true in that case	&lt;br /&gt;
  #	&lt;br /&gt;
  # this also ensures that instructors (who are not ta) would have update_in_ta_course_listing	&lt;br /&gt;
  # not changing the private value if he/she is not TA which was set to true for all courses before filtering	&lt;br /&gt;
  # in update_tmp_obj in courses_assignments_obj	&lt;br /&gt;
  #	&lt;br /&gt;
  # below objects/variable names were part of the project as before and	&lt;br /&gt;
  # refactoring could have affected other functionalities too, so it was avoided in this fix	&lt;br /&gt;
  #	&lt;br /&gt;
  # fix comment end	&lt;br /&gt;
  #	&lt;br /&gt;
  def res_node_for_child(tmp_res)	&lt;br /&gt;
    res = {}	&lt;br /&gt;
    tmp_res.each_key do |node_type|	&lt;br /&gt;
      res[node_type] = []	&lt;br /&gt;
      tmp_res[node_type].each do |node|	&lt;br /&gt;
        tmp_object = {	&lt;br /&gt;
          &amp;quot;nodeinfo&amp;quot; =&amp;gt; node,	&lt;br /&gt;
          &amp;quot;name&amp;quot; =&amp;gt; node.get_name,	&lt;br /&gt;
          &amp;quot;type&amp;quot; =&amp;gt; node.type	&lt;br /&gt;
        }	&lt;br /&gt;
        courses_assignments_obj(node_type, tmp_object, node) if %w[Courses Assignments].include? node_type	&lt;br /&gt;
        res[node_type] &amp;lt;&amp;lt; tmp_object	&lt;br /&gt;
      end	&lt;br /&gt;
    end	&lt;br /&gt;
    res	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''bridge_to_is_available''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def bridge_to_is_available	&lt;br /&gt;
    user = session[:user]	&lt;br /&gt;
    owner_id = params[:owner_id]	&lt;br /&gt;
    is_available(user, owner_id)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''update_tmp_obj''' method was used only once in the app, and it was in the tree display controller. We decided that since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it, there was no reason to write a new method to call, especially since the '''update_tmp_obj''' method seemed like it was only making minor changes to the json.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def update_tmp_obj(tmp_object, node)	&lt;br /&gt;
    tmp = {	&lt;br /&gt;
      &amp;quot;directory&amp;quot; =&amp;gt; node.get_directory,	&lt;br /&gt;
      &amp;quot;creation_date&amp;quot; =&amp;gt; node.get_creation_date,	&lt;br /&gt;
      &amp;quot;updated_date&amp;quot; =&amp;gt; node.get_modified_date,	&lt;br /&gt;
      &amp;quot;institution&amp;quot; =&amp;gt; Institution.where(id: node.retrieve_institution_id),	&lt;br /&gt;
      &amp;quot;private&amp;quot; =&amp;gt; node.get_instructor_id == session[:user].id	&lt;br /&gt;
    }	&lt;br /&gt;
    tmp_object.merge!(tmp)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
We removed the call for '''bridge_to_is_available''' and found that the '''action''' method was also unused.&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_remove_functions.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Assume an object with FolderNode properties is passed to children_node_2_ng ===&lt;br /&gt;
&lt;br /&gt;
=== Populate JSON object within serialize methods ===&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131708</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131708"/>
		<updated>2020-03-23T13:10:41Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Save code and avoid DRY issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.&lt;br /&gt;
&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
=== Removal of unneeded HTML POST ===&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable. We also changed the method from a post to a get, to better represent what it was doing, so changes had to be made to account for the name change and method type change. In total, changes were made to '''tree_display.jsx''', '''tree_display_controller.rb''', and '''routes.rb'''.&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_contents_png.PNG|Diff_get_folder_contents_png.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display.jsx====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_js.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_get_folder.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* filter()&lt;br /&gt;
* filter_node_is_qan()&lt;br /&gt;
* courses_assignments_obj()&lt;br /&gt;
* confirm_notifications_access()&lt;br /&gt;
* child_nodes_from_params()&lt;br /&gt;
* res_node_for_child()&lt;br /&gt;
* bridge_to_is_available()&lt;br /&gt;
* update_tmp_obj()&lt;br /&gt;
* action()&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
The '''filter''' and '''filter_node_is_qan''' methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def filter	&lt;br /&gt;
    qid = 'filter+'	&lt;br /&gt;
    search = params[:filter_string]	&lt;br /&gt;
    filter_node = params[:filternode]	&lt;br /&gt;
    if filter_node == 'QAN'                       # Questionaire Assignment Name	&lt;br /&gt;
      qid = filter_node_is_qan(search, qid)	&lt;br /&gt;
    elsif filter_node == 'ACN'                    # Assignment Course Name	&lt;br /&gt;
      session[:root] = 2	&lt;br /&gt;
      qid &amp;lt;&amp;lt; search	&lt;br /&gt;
    end	&lt;br /&gt;
    qid	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # if filter node is 'QAN', get the corresponding assignment questionnaires	&lt;br /&gt;
  def filter_node_is_qan(search, qid)	&lt;br /&gt;
    assignment = Assignment.find_by(name: search)	&lt;br /&gt;
    if assignment	&lt;br /&gt;
      assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: assignment.id)	&lt;br /&gt;
      if assignment_questionnaires	&lt;br /&gt;
        assignment_questionnaires.each { |q| qid &amp;lt;&amp;lt; &amp;quot;#{q.questionnaire_id}+&amp;quot; }	&lt;br /&gt;
        session[:root] = 1	&lt;br /&gt;
      end	&lt;br /&gt;
    end	&lt;br /&gt;
    qid	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''course_assignments_obj''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def courses_assignments_obj(node_type, tmp_object, node)	&lt;br /&gt;
    update_tmp_obj(tmp_object, node)	&lt;br /&gt;
    # tmpObject[&amp;quot;private&amp;quot;] = node.get_private	&lt;br /&gt;
    instructor_id = node.get_instructor_id	&lt;br /&gt;
    ## if current user's role is TA for a course, then that course will be listed under his course listing.	&lt;br /&gt;
    update_in_ta_course_listing(instructor_id, node, tmp_object)	&lt;br /&gt;
    update_instructor(tmp_object, instructor_id)	&lt;br /&gt;
    update_is_available(tmp_object, instructor_id, node)	&lt;br /&gt;
    assignments_method(node, tmp_object) if node_type == &amp;quot;Assignments&amp;quot;	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''confirm_notifications_access''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def confirm_notifications_access	&lt;br /&gt;
    redirect_to controller: :notifications, action: :list if current_user.try(:student?)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''child_nodes_from_params''' method is not called anywhere else in the app&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # finding out child_nodes from params	&lt;br /&gt;
  def child_nodes_from_params(child_nodes)	&lt;br /&gt;
    if child_nodes.is_a? String and !child_nodes.empty?	&lt;br /&gt;
      JSON.parse(child_nodes)	&lt;br /&gt;
    else	&lt;br /&gt;
      child_nodes	&lt;br /&gt;
    end	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''res_node_for_child''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # getting result nodes for child	&lt;br /&gt;
  # Changes to this method were done as part of E1788_OSS_project_Maroon_Heatmap_fixes	&lt;br /&gt;
  #	&lt;br /&gt;
  # courses_assignments_obj method makes a call to update_in_ta_course_listing which	&lt;br /&gt;
  # separates out courses based on if he/she is the TA for the course passed	&lt;br /&gt;
  # by marking private to be true in that case	&lt;br /&gt;
  #	&lt;br /&gt;
  # this also ensures that instructors (who are not ta) would have update_in_ta_course_listing	&lt;br /&gt;
  # not changing the private value if he/she is not TA which was set to true for all courses before filtering	&lt;br /&gt;
  # in update_tmp_obj in courses_assignments_obj	&lt;br /&gt;
  #	&lt;br /&gt;
  # below objects/variable names were part of the project as before and	&lt;br /&gt;
  # refactoring could have affected other functionalities too, so it was avoided in this fix	&lt;br /&gt;
  #	&lt;br /&gt;
  # fix comment end	&lt;br /&gt;
  #	&lt;br /&gt;
  def res_node_for_child(tmp_res)	&lt;br /&gt;
    res = {}	&lt;br /&gt;
    tmp_res.each_key do |node_type|	&lt;br /&gt;
      res[node_type] = []	&lt;br /&gt;
      tmp_res[node_type].each do |node|	&lt;br /&gt;
        tmp_object = {	&lt;br /&gt;
          &amp;quot;nodeinfo&amp;quot; =&amp;gt; node,	&lt;br /&gt;
          &amp;quot;name&amp;quot; =&amp;gt; node.get_name,	&lt;br /&gt;
          &amp;quot;type&amp;quot; =&amp;gt; node.type	&lt;br /&gt;
        }	&lt;br /&gt;
        courses_assignments_obj(node_type, tmp_object, node) if %w[Courses Assignments].include? node_type	&lt;br /&gt;
        res[node_type] &amp;lt;&amp;lt; tmp_object	&lt;br /&gt;
      end	&lt;br /&gt;
    end	&lt;br /&gt;
    res	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''bridge_to_is_available''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def bridge_to_is_available	&lt;br /&gt;
    user = session[:user]	&lt;br /&gt;
    owner_id = params[:owner_id]	&lt;br /&gt;
    is_available(user, owner_id)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''update_tmp_obj''' method was used only once in the app, and it was in the tree display controller. We decided that since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it, there was no reason to write a new method to call, especially since the '''update_tmp_obj''' method seemed like it was only making minor changes to the json.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def update_tmp_obj(tmp_object, node)	&lt;br /&gt;
    tmp = {	&lt;br /&gt;
      &amp;quot;directory&amp;quot; =&amp;gt; node.get_directory,	&lt;br /&gt;
      &amp;quot;creation_date&amp;quot; =&amp;gt; node.get_creation_date,	&lt;br /&gt;
      &amp;quot;updated_date&amp;quot; =&amp;gt; node.get_modified_date,	&lt;br /&gt;
      &amp;quot;institution&amp;quot; =&amp;gt; Institution.where(id: node.retrieve_institution_id),	&lt;br /&gt;
      &amp;quot;private&amp;quot; =&amp;gt; node.get_instructor_id == session[:user].id	&lt;br /&gt;
    }	&lt;br /&gt;
    tmp_object.merge!(tmp)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
We removed the call for '''bridge_to_is_available''' and found that the '''action''' method was also unused.&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_remove_functions.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Assume an object with FolderNode properties is passed to children_node_2_ng ===&lt;br /&gt;
&lt;br /&gt;
=== Populate JSON object within serialize methods ===&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131707</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131707"/>
		<updated>2020-03-23T13:09:51Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Remove unused functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
=== Make all file scope methods private ===&lt;br /&gt;
=== Removal of unneeded HTML POST ===&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable. We also changed the method from a post to a get, to better represent what it was doing, so changes had to be made to account for the name change and method type change. In total, changes were made to '''tree_display.jsx''', '''tree_display_controller.rb''', and '''routes.rb'''.&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_contents_png.PNG|Diff_get_folder_contents_png.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display.jsx====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_js.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_get_folder.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1). Others became unused once refactoring was completed.&lt;br /&gt;
* filter()&lt;br /&gt;
* filter_node_is_qan()&lt;br /&gt;
* courses_assignments_obj()&lt;br /&gt;
* confirm_notifications_access()&lt;br /&gt;
* child_nodes_from_params()&lt;br /&gt;
* res_node_for_child()&lt;br /&gt;
* bridge_to_is_available()&lt;br /&gt;
* update_tmp_obj()&lt;br /&gt;
* action()&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
The '''filter''' and '''filter_node_is_qan''' methods were both removed because they were only used in the page_header partial for tree display, which was [https://github.com/expertiza/expertiza/commit/167cd7893e2c7eab660495ea29ff2678024d9c47 removed approximately 3 years prior.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def filter	&lt;br /&gt;
    qid = 'filter+'	&lt;br /&gt;
    search = params[:filter_string]	&lt;br /&gt;
    filter_node = params[:filternode]	&lt;br /&gt;
    if filter_node == 'QAN'                       # Questionaire Assignment Name	&lt;br /&gt;
      qid = filter_node_is_qan(search, qid)	&lt;br /&gt;
    elsif filter_node == 'ACN'                    # Assignment Course Name	&lt;br /&gt;
      session[:root] = 2	&lt;br /&gt;
      qid &amp;lt;&amp;lt; search	&lt;br /&gt;
    end	&lt;br /&gt;
    qid	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # if filter node is 'QAN', get the corresponding assignment questionnaires	&lt;br /&gt;
  def filter_node_is_qan(search, qid)	&lt;br /&gt;
    assignment = Assignment.find_by(name: search)	&lt;br /&gt;
    if assignment	&lt;br /&gt;
      assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: assignment.id)	&lt;br /&gt;
      if assignment_questionnaires	&lt;br /&gt;
        assignment_questionnaires.each { |q| qid &amp;lt;&amp;lt; &amp;quot;#{q.questionnaire_id}+&amp;quot; }	&lt;br /&gt;
        session[:root] = 1	&lt;br /&gt;
      end	&lt;br /&gt;
    end	&lt;br /&gt;
    qid	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''course_assignments_obj''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def courses_assignments_obj(node_type, tmp_object, node)	&lt;br /&gt;
    update_tmp_obj(tmp_object, node)	&lt;br /&gt;
    # tmpObject[&amp;quot;private&amp;quot;] = node.get_private	&lt;br /&gt;
    instructor_id = node.get_instructor_id	&lt;br /&gt;
    ## if current user's role is TA for a course, then that course will be listed under his course listing.	&lt;br /&gt;
    update_in_ta_course_listing(instructor_id, node, tmp_object)	&lt;br /&gt;
    update_instructor(tmp_object, instructor_id)	&lt;br /&gt;
    update_is_available(tmp_object, instructor_id, node)	&lt;br /&gt;
    assignments_method(node, tmp_object) if node_type == &amp;quot;Assignments&amp;quot;	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''confirm_notifications_access''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def confirm_notifications_access	&lt;br /&gt;
    redirect_to controller: :notifications, action: :list if current_user.try(:student?)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''child_nodes_from_params''' method is not called anywhere else in the app&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # finding out child_nodes from params	&lt;br /&gt;
  def child_nodes_from_params(child_nodes)	&lt;br /&gt;
    if child_nodes.is_a? String and !child_nodes.empty?	&lt;br /&gt;
      JSON.parse(child_nodes)	&lt;br /&gt;
    else	&lt;br /&gt;
      child_nodes	&lt;br /&gt;
    end	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''res_node_for_child''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # getting result nodes for child	&lt;br /&gt;
  # Changes to this method were done as part of E1788_OSS_project_Maroon_Heatmap_fixes	&lt;br /&gt;
  #	&lt;br /&gt;
  # courses_assignments_obj method makes a call to update_in_ta_course_listing which	&lt;br /&gt;
  # separates out courses based on if he/she is the TA for the course passed	&lt;br /&gt;
  # by marking private to be true in that case	&lt;br /&gt;
  #	&lt;br /&gt;
  # this also ensures that instructors (who are not ta) would have update_in_ta_course_listing	&lt;br /&gt;
  # not changing the private value if he/she is not TA which was set to true for all courses before filtering	&lt;br /&gt;
  # in update_tmp_obj in courses_assignments_obj	&lt;br /&gt;
  #	&lt;br /&gt;
  # below objects/variable names were part of the project as before and	&lt;br /&gt;
  # refactoring could have affected other functionalities too, so it was avoided in this fix	&lt;br /&gt;
  #	&lt;br /&gt;
  # fix comment end	&lt;br /&gt;
  #	&lt;br /&gt;
  def res_node_for_child(tmp_res)	&lt;br /&gt;
    res = {}	&lt;br /&gt;
    tmp_res.each_key do |node_type|	&lt;br /&gt;
      res[node_type] = []	&lt;br /&gt;
      tmp_res[node_type].each do |node|	&lt;br /&gt;
        tmp_object = {	&lt;br /&gt;
          &amp;quot;nodeinfo&amp;quot; =&amp;gt; node,	&lt;br /&gt;
          &amp;quot;name&amp;quot; =&amp;gt; node.get_name,	&lt;br /&gt;
          &amp;quot;type&amp;quot; =&amp;gt; node.type	&lt;br /&gt;
        }	&lt;br /&gt;
        courses_assignments_obj(node_type, tmp_object, node) if %w[Courses Assignments].include? node_type	&lt;br /&gt;
        res[node_type] &amp;lt;&amp;lt; tmp_object	&lt;br /&gt;
      end	&lt;br /&gt;
    end	&lt;br /&gt;
    res	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''bridge_to_is_available''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def bridge_to_is_available	&lt;br /&gt;
    user = session[:user]	&lt;br /&gt;
    owner_id = params[:owner_id]	&lt;br /&gt;
    is_available(user, owner_id)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''update_tmp_obj''' method was used only once in the app, and it was in the tree display controller. We decided that since the purpose of the method was aligned with the purpose of the '''serialize_to_json''' method which called it, there was no reason to write a new method to call, especially since the '''update_tmp_obj''' method seemed like it was only making minor changes to the json.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def update_tmp_obj(tmp_object, node)	&lt;br /&gt;
    tmp = {	&lt;br /&gt;
      &amp;quot;directory&amp;quot; =&amp;gt; node.get_directory,	&lt;br /&gt;
      &amp;quot;creation_date&amp;quot; =&amp;gt; node.get_creation_date,	&lt;br /&gt;
      &amp;quot;updated_date&amp;quot; =&amp;gt; node.get_modified_date,	&lt;br /&gt;
      &amp;quot;institution&amp;quot; =&amp;gt; Institution.where(id: node.retrieve_institution_id),	&lt;br /&gt;
      &amp;quot;private&amp;quot; =&amp;gt; node.get_instructor_id == session[:user].id	&lt;br /&gt;
    }	&lt;br /&gt;
    tmp_object.merge!(tmp)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
We removed the call for '''bridge_to_is_available''' and found that the '''action''' method was also unused.&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_remove_functions.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Assume an object with FolderNode properties is passed to children_node_2_ng ===&lt;br /&gt;
&lt;br /&gt;
=== Populate JSON object within serialize methods ===&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131673</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131673"/>
		<updated>2020-03-23T02:12:33Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable. We also changed the method from a post to a get, to better represent what it was doing, so changes had to be made to account for the name change and method type change. In total, changes were made to '''tree_display.jsx''', '''tree_display_controller.rb''', and '''routes.rb'''.&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_contents_png.PNG|Diff_get_folder_contents_png.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display.jsx====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_js.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_get_folder.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Remove unused functions===&lt;br /&gt;
&lt;br /&gt;
By searching for the implementations of all functions in the controller we were able to recognize some of them as being unused and remove them (Goal 1).&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
The '''bridge_to_is_available''' method is not called anywhere else in the app.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  def bridge_to_is_available	&lt;br /&gt;
    user = session[:user]	&lt;br /&gt;
    owner_id = params[:owner_id]	&lt;br /&gt;
    is_available(user, owner_id)	&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
We removed the call for '''bridge_to_is_available''' and found that the '''action''' method was also unused.&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_remove_functions.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_config_routes_remove_functions.PNG&amp;diff=131672</id>
		<title>File:Diff config routes remove functions.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_config_routes_remove_functions.PNG&amp;diff=131672"/>
		<updated>2020-03-23T02:10:59Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131615</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131615"/>
		<updated>2020-03-22T23:23:06Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Refactor children_node_ng */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable. We also changed the method from a post to a get, to better represent what it was doing, so changes had to be made to account for the name change and method type change. In total, changes were made to '''tree_display.jsx''', '''tree_display_controller.rb''', and '''routes.rb'''.&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display_controller.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_contents_png.PNG|Diff_get_folder_contents_png.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to tree_display.jsx====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_js.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Changes to routes.rb====&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_config_routes_get_folder.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_config_routes_get_folder.PNG&amp;diff=131613</id>
		<title>File:Diff config routes get folder.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_config_routes_get_folder.PNG&amp;diff=131613"/>
		<updated>2020-03-22T23:21:21Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_js.PNG&amp;diff=131611</id>
		<title>File:Diff get folder js.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_js.PNG&amp;diff=131611"/>
		<updated>2020-03-22T23:19:31Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131599</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131599"/>
		<updated>2020-03-22T22:58:46Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Refactor children_node_ng */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable.&lt;br /&gt;
&lt;br /&gt;
[[File:Diff_get_folder_contents_png.PNG|Diff_get_folder_contents_png.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_contents_png.PNG&amp;diff=131596</id>
		<title>File:Diff get folder contents png.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_contents_png.PNG&amp;diff=131596"/>
		<updated>2020-03-22T22:51:59Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_contents.JPG&amp;diff=131594</id>
		<title>File:Diff get folder contents.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_contents.JPG&amp;diff=131594"/>
		<updated>2020-03-22T22:49:25Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Diff get folder contents.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_contents.JPG&amp;diff=131583</id>
		<title>File:Diff get folder contents.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Diff_get_folder_contents.JPG&amp;diff=131583"/>
		<updated>2020-03-22T22:38:01Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131573</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131573"/>
		<updated>2020-03-22T22:22:11Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Updating images&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage1.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing_capture.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable.&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing_capture.JPG&amp;diff=131572</id>
		<title>File:Questionnaires listing capture.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing_capture.JPG&amp;diff=131572"/>
		<updated>2020-03-22T22:21:11Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing.JPG&amp;diff=131570</id>
		<title>File:Questionnaires listing.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing.JPG&amp;diff=131570"/>
		<updated>2020-03-22T22:20:41Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Questionnaires listing.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing.JPG&amp;diff=131569</id>
		<title>File:Questionnaires listing.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing.JPG&amp;diff=131569"/>
		<updated>2020-03-22T22:19:05Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Questionnaires listing.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage1.JPG&amp;diff=131568</id>
		<title>File:Example instructor homepage1.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage1.JPG&amp;diff=131568"/>
		<updated>2020-03-22T22:15:56Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131567</id>
		<title>File:Example instructor homepage.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131567"/>
		<updated>2020-03-22T22:14:59Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Example instructor homepage.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131564</id>
		<title>File:Example instructor homepage.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131564"/>
		<updated>2020-03-22T22:12:40Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Example instructor homepage.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131558</id>
		<title>File:Example instructor homepage.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131558"/>
		<updated>2020-03-22T22:09:27Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Example instructor homepage.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131557</id>
		<title>File:Example instructor homepage.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131557"/>
		<updated>2020-03-22T22:05:57Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Example instructor homepage.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131556</id>
		<title>File:Example instructor homepage.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Example_instructor_homepage.JPG&amp;diff=131556"/>
		<updated>2020-03-22T22:04:01Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Example instructor homepage.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131555</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131555"/>
		<updated>2020-03-22T21:50:37Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Proposed Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Refactor children_node_ng===&lt;br /&gt;
&lt;br /&gt;
We determined that the '''children_node_ng''' method had a misleading name for its function. We propose that the method be renamed to '''get_folder_contents''' since it returns the contents of each top level folder (assignments, courses, and questionnaires) in json format. We believe that the proposed name change and comment make the code easier to understand (Goal 3). In addition to the name change, the '''get_folder_contents''' method is refactored to make the method itself more understandable.&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131551</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131551"/>
		<updated>2020-03-22T21:17:55Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Restructuring the proposed changes and goals&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main goals to focus on in the tree display controller:&lt;br /&gt;
===Remove unnecessary methods===&lt;br /&gt;
Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
===Save code and avoid DRY issues===&lt;br /&gt;
In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
===Improve understanding===&lt;br /&gt;
For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
===Collapse 'goto' methods===&lt;br /&gt;
&lt;br /&gt;
In the legacy code found in '''tree_display_controller.rb''', 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them. We believe that this change makes the code easier to read, since each of the 11 methods condensed carry out the same functionality, and easier to understand since we have added in a better comment for understanding what the code does (Goal 3). This also saved 41 lines of code in the controller (Goal 2).&lt;br /&gt;
====Original Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Proposed Implementation====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
Special thanks to our mentor and professor: &amp;lt;b&amp;gt;Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131546</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131546"/>
		<updated>2020-03-22T20:25:52Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Collapse 'goto' methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
===Issues===&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main issues to focus on in the tree display controller:&lt;br /&gt;
* Remove unnecessary methods - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
* Save code and avoid DRY issues - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
* Improve understanding - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
To be completed. (Repeat issues above and how they are currently being dealt with if they have a current solution).&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
==='''Collapse 'goto' methods'''===&lt;br /&gt;
&lt;br /&gt;
In the legacy code, 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them.&lt;br /&gt;
===='''Original Implementation'''====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
  # refactored method to provide direct access to parameters&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to questionnaires&lt;br /&gt;
  def goto_questionnaires&lt;br /&gt;
    goto_controller('Questionnaires')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to review rubrics&lt;br /&gt;
  def goto_review_rubrics&lt;br /&gt;
    goto_controller('Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to metareview rubrics&lt;br /&gt;
  def goto_metareview_rubrics&lt;br /&gt;
    goto_controller('Metareview')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to teammate review rubrics&lt;br /&gt;
  def goto_teammatereview_rubrics&lt;br /&gt;
    goto_controller('Teammate Review')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to author feedbacks&lt;br /&gt;
  def goto_author_feedbacks&lt;br /&gt;
    goto_controller('Author Feedback')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to global survey&lt;br /&gt;
  def goto_global_survey&lt;br /&gt;
    goto_controller('Global Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to surveys&lt;br /&gt;
  def goto_surveys&lt;br /&gt;
    goto_controller('Assignment Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to course surveys&lt;br /&gt;
  def goto_course_surveys&lt;br /&gt;
    goto_controller('Course Survey')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to courses&lt;br /&gt;
  def goto_courses&lt;br /&gt;
    goto_controller('Courses')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_bookmarkrating_rubrics&lt;br /&gt;
    goto_controller('Bookmarkrating')&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  # direct access to assignments&lt;br /&gt;
  def goto_assignments&lt;br /&gt;
    goto_controller('Assignments')&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===='''Proposed Implementation'''====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: green&amp;quot;&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Files modified===&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor: Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131519</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131519"/>
		<updated>2020-03-22T16:58:25Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* Proposed Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
===Issues===&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main issues to focus on in the tree display controller:&lt;br /&gt;
* Remove unnecessary methods - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
* Save code and avoid DRY issues - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
* Improve understanding - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
To be completed. (Repeat issues above and how they are currently being dealt with if they have a current solution).&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
==='''Collapse 'goto' methods'''===&lt;br /&gt;
&lt;br /&gt;
In the legacy code, 60 lines are dedicated to the 12 methods related to traversing the menu system. 11 of the methods call the '''goto_controller()''' method with different values, so we decided that those 11 methods could be condensed into single line methods with one overarching comment to describe them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Still need to add in legacy code or diff&amp;lt;/strong&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  # The goto_ methods listed below are used to traverse the menu system. It is &lt;br /&gt;
  # hard to tell exactly where they are called from, but at least some (if not all) &lt;br /&gt;
  # are necessary. These functions may be better suited for another controller.&lt;br /&gt;
  def goto_controller(name_parameter)&lt;br /&gt;
    node_object = TreeFolder.find_by(name: name_parameter)&lt;br /&gt;
    session[:root] = FolderNode.find_by(node_object_id: node_object.id).id&lt;br /&gt;
    redirect_to controller: 'tree_display', action: 'list'&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
  def goto_questionnaires; goto_controller('Questionnaires') end&lt;br /&gt;
  def goto_review_rubrics; goto_controller('Review') end&lt;br /&gt;
  def goto_metareview_rubrics; goto_controller('Metareview') end&lt;br /&gt;
  def goto_teammatereview_rubrics; goto_controller('Teammate Review') end&lt;br /&gt;
  def goto_author_feedbacks; goto_controller('Author Feedback') end&lt;br /&gt;
  def goto_global_survey; goto_controller('Global Survey') end&lt;br /&gt;
  def goto_surveys; goto_controller('Assignment Survey') end&lt;br /&gt;
  def goto_course_surveys; goto_controller('Course Survey') end&lt;br /&gt;
  def goto_courses; goto_controller('Courses') end&lt;br /&gt;
  def goto_bookmarkrating_rubrics; goto_controller('Bookmarkrating') end&lt;br /&gt;
  def goto_assignments; goto_controller('Assignments') end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Files modified===&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor: Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131502</id>
		<title>CSC/ECE 517 Spring 2020 - E2006. Refactor Tree Display Controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2006._Refactor_Tree_Display_Controller&amp;diff=131502"/>
		<updated>2020-03-22T16:22:39Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: /* About Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==&amp;lt;b&amp;gt;E2006. Refactor tree_display_controller.rb&amp;lt;/b&amp;gt;==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza] is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
E2006. Refactor tree_display_controller.rb&lt;br /&gt;
===Background===&lt;br /&gt;
The tree_display_controller is responsible for rendering hierarchical lists in the instructor user interface.  Here is a sample instructor homepage:&lt;br /&gt;
&lt;br /&gt;
[[File:Example_instructor_homepage.JPG]]&lt;br /&gt;
&lt;br /&gt;
You will see here that assignments are nested within courses.  This means that the node for an assignment has a parent_id that points to a node for a course. Similarly, listings of questionnaires are hierarchical:&lt;br /&gt;
&lt;br /&gt;
[[File:Questionnaires_listing.JPG]]&lt;br /&gt;
&lt;br /&gt;
The various rubrics, as well as surveys, are types of questionnaires. So the parent_id of a particular rubric will be the type of rubric (e.g., teammate review) that it is.&lt;br /&gt;
&lt;br /&gt;
The tree_display_controller is 379 lines long, and contains 45 methods.  Many of those methods have similar names, yet there may be good reasons for having separate methods.  Look over how these methods are used, and then decide.  Then analyze the rest of the methods and try to find ways to save code and avoid DRY issues.  Even if you cannot find a way to improve a method, you should be able to come up with a 1-line or 2-line comment explaining what that method does.&lt;br /&gt;
&lt;br /&gt;
===Issues===&lt;br /&gt;
&lt;br /&gt;
From the problem background, we have derived three main issues to focus on in the tree display controller:&lt;br /&gt;
* Remove unnecessary methods - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.&lt;br /&gt;
* Save code and avoid DRY issues - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller an easier to read.&lt;br /&gt;
* Improve understanding - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
To be completed. (Repeat issues above and how they are currently being dealt with if they have a current solution).&lt;br /&gt;
&lt;br /&gt;
==Proposed Implementation==&lt;br /&gt;
&lt;br /&gt;
===Files modified===&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Code Coverage==&lt;br /&gt;
To be completed.&lt;br /&gt;
&lt;br /&gt;
==Team Information==&lt;br /&gt;
Brooks Anderson&lt;br /&gt;
&lt;br /&gt;
Rick Holloway&lt;br /&gt;
&lt;br /&gt;
PJ Loheide&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor: Dr. Edward Gehringer&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
To be completed.&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing.JPG&amp;diff=131486</id>
		<title>File:Questionnaires listing.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Questionnaires_listing.JPG&amp;diff=131486"/>
		<updated>2020-03-22T15:35:25Z</updated>

		<summary type="html">&lt;p&gt;Pjloheid: Pjloheid uploaded a new version of File:Questionnaires listing.JPG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pjloheid</name></author>
	</entry>
</feed>