<?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=Kjones15</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=Kjones15"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Kjones15"/>
	<updated>2026-09-15T05:23:35Z</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_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149646</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149646"/>
		<updated>2023-04-13T01:13:13Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap (Ex: the 'edit' partial hasn't been updated in TextResponse yet). More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza. For more information refer to the Test Plan section below.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all methods]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all methods, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality. For instance the name 'complete_first_second_input' might not be intuitive for some who didn't work on the code. The comment provides more insight into what will be displayed for each method.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable. Then we would like to get our code ready to merge into Expertiza.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149601</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149601"/>
		<updated>2023-04-13T00:18:06Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Plan of work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap (Ex: the 'edit' partial hasn't been updated in TextResponse yet). More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza. For more information refer to the Test Plan section below.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality. For instance the name 'complete_first_second_input' might not be intuitive for some who didn't work on the code. The comment provides more insight into what will be displayed for each method.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable. Then we would like to get our code ready to merge into Expertiza.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149526</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149526"/>
		<updated>2023-04-12T22:39:24Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza. For more information refer to the Test Plan section below.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality. For instance the name 'complete_first_second_input' might not be intuitive for some who didn't work on the code. The comment provides more insight into what will be displayed for each method.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable. Then we would like to get our code ready to merge into Expertiza.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149524</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149524"/>
		<updated>2023-04-12T22:37:25Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality. For instance the name 'complete_first_second_input' might not be intuitive for some who didn't work on the code. The comment provides more insight into what will be displayed for each method.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable. Then we would like to get our code ready to merge into Expertiza.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149523</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149523"/>
		<updated>2023-04-12T22:36:46Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Next Steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality. For instance the name 'complete_first_second_input' might not be intuitive for some who didn't work on the code. The comment provides more insight into what will be displayed for each method.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable. Then we would like to get our code ready to merge into Expertiza.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149521</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149521"/>
		<updated>2023-04-12T22:35:53Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality. For instance the name 'complete_first_second_input' might not be intuitive for some who didn't work on the code. The comment provides more insight into what will be displayed for each method.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149520</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149520"/>
		<updated>2023-04-12T22:33:52Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149519</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149519"/>
		<updated>2023-04-12T22:32:10Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test - tests 4 methods]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test - all methods and different # of boxes selected]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test - different tests to make sure valid questions can be created]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test - tests all methods]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test - tests 2 methods]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149441</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149441"/>
		<updated>2023-04-12T15:06:27Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tests */ Removed list (added to table)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149440</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149440"/>
		<updated>2023-04-12T15:05:56Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Test&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/checkbox_spec.rb Created RSpec testing for all method]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/criterion_spec.rb Created RSpec testing for all method, and different question scenarios]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/dropdown_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_checkbox_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/multiple_choice_radio_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/scale_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_area_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/text_field_spec.rb RSpec test]&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/spec/models/upload_file.rb RSpec test]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149439</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149439"/>
		<updated>2023-04-12T14:56:08Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Overall, we met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149438</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149438"/>
		<updated>2023-04-12T14:55:45Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
     ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149437</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149437"/>
		<updated>2023-04-12T14:53:23Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */ Moving example comment to different section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149436</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149436"/>
		<updated>2023-04-12T14:52:05Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Added comments - Provided functionality detail in the comments for all methods&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Update comments - more details in how all functions work&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Added comments - none existed previously&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Added comments - none existed previously&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149435</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149435"/>
		<updated>2023-04-12T14:41:07Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */  Added table for all of the changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
|Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
|&lt;br /&gt;
*Replaced 'edit' method with partial &lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
|&lt;br /&gt;
*Added partial to 'complete' method&lt;br /&gt;
*Updated comments&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
|Updated comments&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149434</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149434"/>
		<updated>2023-04-12T14:22:35Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */ removed links from design goal section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable. &lt;br /&gt;
&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Purpose &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|checkbox.rb&lt;br /&gt;
|All the methods were given in depth comments&lt;br /&gt;
|Better explain functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149433</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149433"/>
		<updated>2023-04-12T14:21:53Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable. &lt;br /&gt;
&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Purpose &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|checkbox.rb&lt;br /&gt;
|All the methods were given in depth comments&lt;br /&gt;
|Better explain functionality&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149432</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149432"/>
		<updated>2023-04-12T14:21:30Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tasks Completed */ Started making table for changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable. &lt;br /&gt;
&lt;br /&gt;
The table below highlights the work we have completed so far:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! File !! Changes Made !! Purpose &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|questionnaires_controller.rb&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|checkbox.rb&lt;br /&gt;
|All the methods were given in depth comments&lt;br /&gt;
|Better explain functionality&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149415</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149415"/>
		<updated>2023-04-11T21:16:26Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass. An example of a partial we created can be seen [https://github.com/pparghod/reimplementation-back-end/blob/main/app/views/questionnaire/edit/_edit_dropdown.erb here], where we made a partial for code that displays an edit input for dropdown questions. Thanks to this partial, in the future if we ever need to call this code again we can just [https://github.com/pparghod/reimplementation-back-end/blob/20093dcb23750c94a9c32803914e1506c9ae556e/app/models/dropdown.rb#L7 call the partial], reducing the number of lines of code and reducing redundancy.  &lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls and overlap. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149414</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149414"/>
		<updated>2023-04-11T21:03:24Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a question controller to further consolidate the changes, since there currently remain some redundant calls. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149413</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149413"/>
		<updated>2023-04-11T21:01:45Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Plan of work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes, since there currently remain some redundant calls. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149412</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149412"/>
		<updated>2023-04-11T20:59:02Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* UML Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes, since there currently remain some redundant calls. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149411</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149411"/>
		<updated>2023-04-11T20:58:06Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Explanation of Feature - Question Hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes, since there currently remain some redundant calls. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1400px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149410</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149410"/>
		<updated>2023-04-11T20:57:39Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Explanation of Feature - Question Hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Below is a written explanation of the hierarchy. For a visual reference, refer to the [[#UML_Diagram UML Diagram]]:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes, since there currently remain some redundant calls. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1400px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149409</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149409"/>
		<updated>2023-04-11T20:51:09Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Plan of work */  Added links for code references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments before this project, and any existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The list shown below shows the current files where we have updated comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb] &lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/criterion.rb criterion.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/dropdown.rb dropdown.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_checkbox.rb multiple_choice_checkbox.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/multiple_choice_radio.rb multiple_choice_radio.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/scale.rb scale.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_area.rb text_area.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/text_field.rb text_field.rb]&lt;br /&gt;
*[https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/upload_file.rb upload_file.rb]&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing, because the method name alone can be confusing. These changes give specifics into the methods functionality.&lt;br /&gt;
&lt;br /&gt;
From [https://github.com/pparghod/reimplementation-back-end/blob/main/app/models/checkbox.rb checkbox.rb]:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we started adding partials by looking at the similarities between all three question types and pulling out the similarities into partials which we stored in [https://github.com/pparghod/reimplementation-back-end/tree/main/app/views 'app/views']. Then we made calls to these partials from within each subclass.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes, since there currently remain some redundant calls. More information is explained below:&lt;br /&gt;
* We plan on making a class with a name like: 'Question_Controller'.&lt;br /&gt;
* This class will  store all of the partials we have made so far and any additional partials we need to create.&lt;br /&gt;
* Then we will update any calls to a partial to just call the singular 'Question_Controller' - this will keep all the partials in once central location and DRY out the code to follow better design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Test Edge Cases'''&lt;br /&gt;
&lt;br /&gt;
The last goal we have for program 4 is to include additional tests to cover any edge cases we missed in program 3. This will help us ensure that we can merge our changes successfully with Expertiza.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy to better give an idea of it's structure. This diagram reflects all of the recent changes we have made after program 3. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1400px]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149408</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149408"/>
		<updated>2023-04-11T20:25:22Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* UML Diagram */ Size adjustment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we added partials by looking at the similarities between all three question types and pulling out the similarities into new classes.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes. &lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. &lt;br /&gt;
&lt;br /&gt;
One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
A few notes about the hierarchy:&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149407</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149407"/>
		<updated>2023-04-11T20:24:41Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* UML Diagram */ Added the diagram&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we added partials by looking at the similarities between all three question types and pulling out the similarities into new classes.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes. &lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. &lt;br /&gt;
&lt;br /&gt;
One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
Below is a diagram showing the overall Question hierarchy. (Click on the image to zoom in)&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-UML.png|850px]]&lt;br /&gt;
&lt;br /&gt;
A few notes about the hierarchy:&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2320-UML.png&amp;diff=149406</id>
		<title>File:E2320-UML.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2320-UML.png&amp;diff=149406"/>
		<updated>2023-04-11T20:18:43Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: A png of E2320 UML diagram for the design doc&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A png of E2320 UML diagram for the design doc&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149393</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149393"/>
		<updated>2023-04-11T17:03:52Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we added partials by looking at the similarities between all three question types and pulling out the similarities into new classes.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes. &lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. &lt;br /&gt;
&lt;br /&gt;
One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
=== UML Diagram ===&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149381</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149381"/>
		<updated>2023-04-11T15:54:57Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. For program 3 we added partials by looking at the similarities between all three question types and pulling out the similarities into new classes.&lt;br /&gt;
&lt;br /&gt;
Moving forward for program 4 we plan on making a a question controller to further consolidate the changes. &lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. &lt;br /&gt;
&lt;br /&gt;
One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149380</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149380"/>
		<updated>2023-04-11T15:43:38Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code.&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. We added partials by looking at the similarities between all three question types and pull out the similarities into a new class.&lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149379</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149379"/>
		<updated>2023-04-11T15:42:59Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Purpose &amp;amp; Goals===&lt;br /&gt;
The overall purpose of this project is to clean up the existing classes so that future developers will have an easy time picking up the existing code, be able to understand it, and be able to add additional functionality with no problem. &lt;br /&gt;
&lt;br /&gt;
The goals of the project include:&lt;br /&gt;
* Improvement of variables and methods names - to give accurate representation of their functionality.&lt;br /&gt;
* Included comments for further clarification - we want someone who didn't work on this project to be able to pick up the code and understand what is going on.&lt;br /&gt;
* Implement partials to deal with the HTML strings - this will DRY up the code&lt;br /&gt;
* Add RSpec test cases - ensure existing tests work and also account for edge cases.&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. We added partials by looking at the similarities between all three question types and pull out the similarities into a new class.&lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149378</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149378"/>
		<updated>2023-04-11T15:32:10Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Explanation of Feature - Question Hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - Do not have a score associated with them and come in 3 styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - Presents all the answers choices with a selectable bubble beside them. The user clicks on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - The user must click on a certain number of check boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - Allow the user to actually type in their answer instead of just being provided answers.&lt;br /&gt;
* Text Area - Question box has a height and width associated with it that can be adjusted.&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Goals===&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. We added partials by looking at the similarities between all three question types and pull out the similarities into a new class.&lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149375</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149375"/>
		<updated>2023-04-10T23:15:32Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question''' - Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored.&lt;br /&gt;
* Scored question - will give a number value depending upon if a user clicks on a particular answer.&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question - don't have  a score associated with them and come in a few different styles.&lt;br /&gt;
** Dropdown - only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer.&lt;br /&gt;
** Multiple Choice - present all the answers choices with a selectable bubble beside them and allow the user to click on the bubble to indicate their answer.&lt;br /&gt;
** Check Box - the user must click on a certain number of boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
'''2. Text Response''' - allow the user to actually type in their answer instead of just being provided answers&lt;br /&gt;
* Text Area - question box has a height and width associated with it that can be adjusted&lt;br /&gt;
* Text Field - 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
'''3. Upload File''' -&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===Goals===&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
'''1. Update code comments'''&lt;br /&gt;
&lt;br /&gt;
Some methods and classes had little to no comments, and existing comments were not in depth enough to give proper context for functionality. One of our design goals is to write more in depth comments that better explain functionality for the code. &lt;br /&gt;
&lt;br /&gt;
The files listed below have been updated with new comments:&lt;br /&gt;
*questionnaires_controller.rb&lt;br /&gt;
*checkbox.rb &lt;br /&gt;
*criterion.rb&lt;br /&gt;
*dropdown.rb&lt;br /&gt;
*multiple_choice_checkbox.rb&lt;br /&gt;
*multiple_choice_radio.rb&lt;br /&gt;
*scale.rb&lt;br /&gt;
*text_area.rb&lt;br /&gt;
*text_field.rb&lt;br /&gt;
*text_response.rb&lt;br /&gt;
*upload_file.rb&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the comments we've added to clarify what the methods are doing because the method name alone can be confusing.&lt;br /&gt;
From checkbox.rb:&lt;br /&gt;
&lt;br /&gt;
  '''# Returns what to display for the first and second inputs (comments and scores).'''&lt;br /&gt;
  def complete_first_second_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_comments\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][comment]\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
    html += &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_score\&amp;quot; name=\&amp;quot;responses[#{count.to_s}][score]\&amp;quot; type=\&amp;quot;hidden\&amp;quot;&amp;quot;&lt;br /&gt;
    html += if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
              'value=&amp;quot;1&amp;quot;'&lt;br /&gt;
            else&lt;br /&gt;
              'value=&amp;quot;0&amp;quot;'&lt;br /&gt;
            end&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Returns what to display for the third input (the checkbox itself).'''&lt;br /&gt;
  def complete_third_input(count, answer = nil)&lt;br /&gt;
    html = &amp;quot;&amp;lt;input id=\&amp;quot;responses_#{count.to_s}_checkbox\&amp;quot; type=\&amp;quot;checkbox\&amp;quot; onchange=\&amp;quot;checkbox#{count.to_s}Changed()\&amp;quot;&amp;quot;&lt;br /&gt;
    html += 'checked=&amp;quot;checked&amp;quot;' if !answer.nil? &amp;amp;&amp;amp; (answer.answer == 1)&lt;br /&gt;
    html += '&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  '''# Create the executable script for client-side interaction on the checkbox'''&lt;br /&gt;
  def complete_script(count)&lt;br /&gt;
    html = &amp;quot;&amp;lt;script&amp;gt;function checkbox#{count.to_s}Changed() {&amp;quot;&lt;br /&gt;
    html += &amp;quot; var checkbox = jQuery(\&amp;quot;#responses_#{count.to_s}_checkbox\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += &amp;quot; var response_score = jQuery(\&amp;quot;#responses_#{count.to_s}_score\&amp;quot;);&amp;quot;&lt;br /&gt;
    html += 'if (checkbox.is(&amp;quot;:checked&amp;quot;)) {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;1&amp;quot;);'&lt;br /&gt;
    html += '} else {'&lt;br /&gt;
    html += 'response_score.val(&amp;quot;0&amp;quot;);}}&amp;lt;/script&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''2. DRY out code with partials'''&lt;br /&gt;
&lt;br /&gt;
Another one of our design goals is to implement additional partials for the question types. We added partials by looking at the similarities between all three question types and pull out the similarities into a new class.&lt;br /&gt;
*Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
== Tests ==&lt;br /&gt;
&lt;br /&gt;
'''RSpec'''&lt;br /&gt;
&lt;br /&gt;
We reimplemented the test cases to match the changes we've made to the question-related models. Front-end testing wasn't necessary because our project doesn't involve changing any controller.&lt;br /&gt;
&lt;br /&gt;
The most notable models that were tested are:&lt;br /&gt;
 checkbox.rb &lt;br /&gt;
 criterion.rb&lt;br /&gt;
 dropdown.rb&lt;br /&gt;
 multiple_choice_checkbox.rb&lt;br /&gt;
 multiple_choice_radio.rb&lt;br /&gt;
 scale.rb&lt;br /&gt;
 text_area.rb&lt;br /&gt;
 text_field.rb&lt;br /&gt;
 text_response.rb&lt;br /&gt;
 upload_file.rb&lt;br /&gt;
&lt;br /&gt;
One of the primary goals we had were to make sure that the existing tests still passed. Several tests were removed for the edit methods in a few of the models (such as checkbox_spec.rb and dropdown_spec.rb) because those methods were replaced with partials. Partials have not been fully implemented which is why we did not include tests for them. However, this is something that should be revisited in the future.&lt;br /&gt;
&lt;br /&gt;
Given below is an example of the tests we've written:&lt;br /&gt;
 describe Dropdown do&lt;br /&gt;
  let!(:dropdown) { Dropdown.create(id: 4, type: 'Dropdown', seq: 4.0, txt: 'Test text', weight: 13) }&lt;br /&gt;
  let!(:answer) { Answer.create(id: 1, question_id: 4, questionnaire_type_id: 1, answer: 1, comments: &amp;quot;Test comment&amp;quot;) }&lt;br /&gt;
  describe '#view_question_text' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_question_text&lt;br /&gt;
      expect(html).to eq('&amp;lt;TR&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt; Test text &amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;left&amp;quot;&amp;gt;Dropdown&amp;lt;/TD&amp;gt;&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;13&amp;lt;/TD&amp;gt;&amp;lt;TD align=&amp;quot;center&amp;quot;&amp;gt;&amp;amp;mdash;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#view_completed_question' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      html = dropdown.view_completed_question(1, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;1. Test text&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbspTest comment')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete_for_alternatives' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1', 'Alternative 2', 'Alternative 3']&lt;br /&gt;
      html = dropdown.complete_for_alternatives(alternatives, answer)&lt;br /&gt;
      expect(html).to eq('&amp;lt;option value=&amp;quot;Alternative 1&amp;quot;&amp;gt;Alternative 1&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 2&amp;quot;&amp;gt;Alternative 2&amp;lt;/option&amp;gt;&amp;lt;option value=&amp;quot;Alternative 3&amp;quot;&amp;gt;Alternative 3&amp;lt;/option&amp;gt;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#complete' do&lt;br /&gt;
    it 'returns the html' do&lt;br /&gt;
      alternatives = ['Alternative 1|Alternative 2|Alternative 3']&lt;br /&gt;
      allow(dropdown).to receive(:alternatives).and_return(alternatives)&lt;br /&gt;
      allow(dropdown).to receive(:complete_for_alternatives).and_return('')&lt;br /&gt;
      html = dropdown.complete(1, answer)&lt;br /&gt;
      &amp;lt;nowiki&amp;gt;expect(html).to eq('&amp;lt;p style=&amp;quot;width: 80%;&amp;quot;&amp;gt;&amp;lt;label for=&amp;quot;responses_1&amp;quot;&amp;quot;&amp;gt;Test text&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/label&amp;gt;'&lt;br /&gt;
      + '&amp;lt;input id=&amp;quot;responses_1_score&amp;quot; name=&amp;quot;responses[1][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot; style=&amp;quot;min-width: 100px;&amp;quot;&amp;gt;'&lt;br /&gt;
      + '&amp;lt;select id=&amp;quot;responses_1_comments&amp;quot; label=Test text name=&amp;quot;responses[1][comment]&amp;quot;&amp;gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;')&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Given below is the full list of tests:&lt;br /&gt;
&lt;br /&gt;
[[File:E2320-RSpec.png]]&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
===Tasks Completed===&lt;br /&gt;
We met our goals of adding comments and improving the names of methods and variables to make the code easily understandable to the user. We implemented several partials to handle the HTML strings and added RSpec test cases. We cleaned up the unused comments/code to make the code readable and understandable.&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
In the future, we would like to fully implement partials and thoroughly test them. We believe partials will improve the code by making it more readable and reusable.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149142</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149142"/>
		<updated>2023-04-07T21:46:33Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored. Scored question will give a number value depending upon if a user clicks on a particular answer. The unscored questions don't have  a score associated with them and come in a few different styles. The answers could be presented in a dropdown menu which only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer. Multiple choice questions present all the answers choices with a selectable bubble beside them and allow the user to click on the bubble to indicate their answer. Checkboxes are similar to multiple choice in that they present all of the answer choices at once however, the user must click on a certain number of boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Text response questions are different in that they allow the user to actually type in their answer instead of just being provided answers. A text area question has a height and width associated with it that can be adjusted while a text field question is just 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
The following list describes tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code. The below files are the ones which we plan too add more comments to:&lt;br /&gt;
**questionnaires_controller.rb&lt;br /&gt;
**checkbox.rb&lt;br /&gt;
**question.rb&lt;br /&gt;
**text_area.rb&lt;br /&gt;
**text_response.rb&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. In program 3 our team had started to create partials for the 3 major types of questions. As we continue with program 4 we are going to continue to add more partials by looking at the similarities between all three types and pull out the similarities into a new class&lt;br /&gt;
**Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
In program 3 tests were created for all of the question types (Ex: criterion_spec.rb, text_area.rb and upload_file.rb to name a few).The only new tests we plan to write for program 4 will be for the new question controller we plan to create. If any additional tests will need to be added this section will be updated to reflect that&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149128</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149128"/>
		<updated>2023-04-07T21:20:12Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */ Added more detail for the goals&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored. Scored question will give a number value depending upon if a user clicks on a particular answer. The unscored questions don't have  a score associated with them and come in a few different styles. The answers could be presented in a dropdown menu which only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer. Multiple choice questions present all the answers choices with a selectable bubble beside them and allow the user to click on the bubble to indicate their answer. Checkboxes are similar to multiple choice in that they present all of the answer choices at once however, the user must click on a certain number of boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Text response questions are different in that they allow the user to actually type in their answer instead of just being provided answers. A text area question has a height and width associated with it that can be adjusted while a text field question is just 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
The following list describes tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code. The below files are the ones which we plan too add more comments to:&lt;br /&gt;
**questionnaires_controller.rb&lt;br /&gt;
**checkbox.rb&lt;br /&gt;
**question.rb&lt;br /&gt;
**text_area.rb&lt;br /&gt;
**text_response.rb&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. In program 3 our team had started to create partials for the 3 major types of questions. As we continue with program 4 we are going to continue to add more partials by looking at the similarities between all three types and pull out the similarities into a new class&lt;br /&gt;
**Ex: Question_Controller - Since all of the sub-categories inherit from the Question class we plan to make a question controller to hold all of the common functionality. One example of this can be seen with the method call 'edit' which exists in many of the subclasses like text_response.rb, text_area.rb, scale.rb, and criterion.rb. The partials will be moved into the question controller.&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149114</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=149114"/>
		<updated>2023-04-07T20:46:09Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Explanation of Feature - Question Hierarchy */  Added more detail for feature&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: scored, unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
Choice questions are types of questions that give the quiz taker a list of answers to choose from. It is broken into two subcategories scored and unscored. Scored question will give a number value depending upon if a user clicks on a particular answer. The unscored questions don't have  a score associated with them and come in a few different styles. The answers could be presented in a dropdown menu which only shows the answer choices after the user clicks on the dropdown arrow and clicks on an answer. Multiple choice questions present all the answers choices with a selectable bubble beside them and allow the user to click on the bubble to indicate their answer. Checkboxes are similar to multiple choice in that they present all of the answer choices at once however, the user must click on a certain number of boxes beside the answers they think are correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Text response questions are different in that they allow the user to actually type in their answer instead of just being provided answers. A text area question has a height and width associated with it that can be adjusted while a text field question is just 1 input line that does not change shape.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last type of question is upload file which allows the user to upload a file to use as a quiz (as the name suggests). This option allows a person to upload a pre-made quiz document to be which will be converted into a quiz. So, a professor could type up their quiz questions and answers in a text file then choose upload and have Expertiza convert it into a quiz for them.&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
The following list describes tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148972</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148972"/>
		<updated>2023-04-07T16:54:34Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Explanation of Feature - Question Hierarchy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class. There are 3 main types of questions in Experitza: Scored, Unscored, and upload file.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
Scored questions are &lt;br /&gt;
Unscored&lt;br /&gt;
Upload file allows the user to upload a file to use as a quiz. Meaning that whatever file is uploaded will be converted into a quiz.&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
The following list describes tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148800</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148800"/>
		<updated>2023-04-05T22:10:05Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: Added ack. and references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
The following list describes tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
* Prof. Edward F. Gehringer&lt;br /&gt;
* Priyam Garg&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
* Colleen Britt&lt;br /&gt;
* Kimberly Jones&lt;br /&gt;
* Priyanka Arghode&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
#[https://stackoverflow.com/questions/3425971/organizing-partials-for-a-polymorphic-resource Organizing Partials]&lt;br /&gt;
#[https://www.amberbit.com/blog/2011/12/27/render-views-and-partials-outside-controllers-in-rails-3 Render Views and Partials Outside Controllers]&lt;br /&gt;
#[https://github.com/pparghod/reimplementation-back-end Github Repo]&lt;br /&gt;
#[https://github.com/expertiza/reimplementation-back-end/pull/10 Link to initial pull request]&lt;br /&gt;
#[https://github.com/users/pparghod/projects/2/views/1 GitHub Project Board]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148799</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148799"/>
		<updated>2023-04-05T22:08:43Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
The following list describes tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148798</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148798"/>
		<updated>2023-04-05T22:08:03Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Explanation of Feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
Tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature - Question Hierarchy===&lt;br /&gt;
The Question class and its sub-classes are used to implement all rubric items, quiz questions, and survey questions in Expertiza. For example, a professor could use this feature to make up a review quiz for their class.&lt;br /&gt;
&lt;br /&gt;
Here is the hierarchy:&lt;br /&gt;
&lt;br /&gt;
'''1. Choice question'''&lt;br /&gt;
* Scored question&lt;br /&gt;
** Scale&lt;br /&gt;
** Criterion&lt;br /&gt;
* Unscored question&lt;br /&gt;
** Dropdown&lt;br /&gt;
** Multiple Choice&lt;br /&gt;
** Check Box&lt;br /&gt;
'''2. Text Response'''&lt;br /&gt;
* Text Area&lt;br /&gt;
* Text Field&lt;br /&gt;
'''3. Upload File'''&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148797</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148797"/>
		<updated>2023-04-05T22:06:40Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Statement Problem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The current implementation of the question hierarchy is not very clean and contains confusing variable and method names. Also, many methods return long HTML strings which are difficult to read. The goal of this project is to reimplement this part of the application to make it more readable, understandable and maintainable.&lt;br /&gt;
&lt;br /&gt;
Tasks that were accomplished in Program 3:&lt;br /&gt;
* Improved naming of variables and methods&lt;br /&gt;
* Included comments for further clarification&lt;br /&gt;
* Implemented partials to deal with the HTML strings&lt;br /&gt;
* Added RSpec test cases&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148796</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148796"/>
		<updated>2023-04-05T22:05:59Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
===Statement Problem===&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Some methods and classes currently do not have any code comments, while other comments are not in depth enough to give proper context for functionality. One of our design goals will be to write more in depth comments that better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148795</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148795"/>
		<updated>2023-04-05T22:03:14Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Plan of work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
===Statement Problem===&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
&lt;br /&gt;
Based on the feedback provided to us by both our mentors and also peer reviews our team has decided upon a few key design goals to work on for the continuation of our work into Program 4. These goals are outlined below.&lt;br /&gt;
&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Write more in depth comments which better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148794</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148794"/>
		<updated>2023-04-05T22:01:46Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Conclusions / Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
===Statement Problem===&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Write more in depth comments which better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
==Conclusions / Future Work==&lt;br /&gt;
===Specific Tasks Completed===&lt;br /&gt;
[Will be updated near final submission deadline]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148793</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148793"/>
		<updated>2023-04-05T22:00:37Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: /* Plan of work */  starting to add goals&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
===Statement Problem===&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
==Plan of work==&lt;br /&gt;
===Design Goals===&lt;br /&gt;
* Update code comments - Write more in depth comments which better explain functionality for the code.&lt;br /&gt;
* DRY out code with partials - Implement additional partials for certain classes. Ex: Question_Controller&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
===Conclusions / Future Work===&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148790</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148790"/>
		<updated>2023-04-05T21:57:14Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: Fixed heading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
===Statement Problem===&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
===Plan of work===&lt;br /&gt;
&lt;br /&gt;
===Tests===&lt;br /&gt;
&lt;br /&gt;
===Conclusions / Future Work===&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148789</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148789"/>
		<updated>2023-04-05T21:56:52Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: Added outline of key topics&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;br /&gt;
&lt;br /&gt;
===Statement Problem===&lt;br /&gt;
&lt;br /&gt;
===Explanation of Feature===&lt;br /&gt;
&lt;br /&gt;
===List of Work Done so Far===&lt;br /&gt;
&lt;br /&gt;
===Plan of work===&lt;br /&gt;
&lt;br /&gt;
==Tests===&lt;br /&gt;
&lt;br /&gt;
===Conclusions / Future Work===&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148786</id>
		<title>CSC/ECE 517 Spring 2023 - E2320. Reimplement the Question Hierarchy</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2320._Reimplement_the_Question_Hierarchy&amp;diff=148786"/>
		<updated>2023-04-05T21:51:46Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: Created page with &amp;quot;Design Doc&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Design Doc&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023&amp;diff=148785</id>
		<title>CSC/ECE 517 Spring 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023&amp;diff=148785"/>
		<updated>2023-04-05T21:50:27Z</updated>

		<summary type="html">&lt;p&gt;Kjones15: Added E2320 link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 -E2306. Refactor user_controller.rb, user.rb and its child classes]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2320. Reimplement the Question hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2312 + E2313. Reimplement response.rb and responses_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - NTNX-1. Support provisioning MongoDb via NDB Kubernetes Operator]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2316. Reimplement sign_up_sheet_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2315. Reimplement signed_up_team.rb, sign_up_topic.rb, sign_up_sheet.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2339. Reimplement signed_up_team.rb, sign_up_topic.rb, sign_up_sheet.rb (Project 4)]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring_2023 - E2323. Refactor DueDate functionality from assignment.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2317: Reimplement participant.rb]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2314. Reimplement the response map hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023- NTNX-4. Extend NDB operator provision postregresql aws]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2321. Reimplement QuestionnairesController and QuestionsController]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2305. Grading audit trail]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2309. Refactor Node model and its subclasses]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - NTNX-2. Support provisioning mySQL databases via NDB Kubernetes Operator]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - E2300. Refactor E1858. Github metrics integration]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Sping 2023 - E2322: Refactor Questionnaire View to display Bookmark Rating]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Spring 2023 - NTNX-3. Refactor models to keep profiles (software, compute, network, etc) as optional and use default if not specified]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2301._Refactor_review_maping_helper]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2337._Reimplement_node_hierarchy]]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE_517_Spring_2023_-_E2320._Reimplement the Question Hierarchy]]&lt;/div&gt;</summary>
		<author><name>Kjones15</name></author>
	</entry>
</feed>