<?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=Dchrist2</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=Dchrist2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dchrist2"/>
	<updated>2026-05-10T21:51:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2532-uml-2.png&amp;diff=164812</id>
		<title>File:E2532-uml-2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2532-uml-2.png&amp;diff=164812"/>
		<updated>2025-04-22T23:06:28Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164811</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164811"/>
		<updated>2025-04-22T23:05:48Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. It maps from two participants, the reviewer and the reviewee, and the relevant assignment to the response object that contains the actual responses to the questions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E2532-uml.png]]&lt;br /&gt;
&lt;br /&gt;
While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
Many of the subclasses are fairly similar with only slight changes in the values returned. An example of one of these is the FeedbackResponseMap:&lt;br /&gt;
&lt;br /&gt;
=====FeedbackResponseMap=====&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
It is not part of a sub-hierarchy so it inherits directly from ResponseMap and only has associations that are different from the parent ResponseMap model.&lt;br /&gt;
&lt;br /&gt;
====Removing Hardcoded Values====&lt;br /&gt;
&lt;br /&gt;
Each bottom level subclass contains a get_title method that returns a string representing the a formatted name of the class. We moved these all to one module that we could include in the parent class, then use the constants from in the subclass methods. We examined other approaches, but felt this would be more extendable if other classes needed to follow the same pattern:&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
  module ResponseMapSubclassTitles&lt;br /&gt;
    ASSIGNMENT_SURVEY_RESPONSE_MAP_TITLE = 'Assignment Survey'&lt;br /&gt;
    BOOKMARK_RATING_RESPONSE_MAP_TITLE = 'Bookmark Review'&lt;br /&gt;
    COURSE_SURVEY_RESPONSE_MAP_TITLE = 'Course Survey'&lt;br /&gt;
    FEEDBACK_RESPONSE_MAP_TITLE = 'Feedback'&lt;br /&gt;
    GLOBAL_SURVEY_RESPONSE_MAP_TITLE = 'Global Survey'&lt;br /&gt;
    METAREVIEW_RESPONSE_MAP_TITLE = 'Metareview'&lt;br /&gt;
    QUIZ_RESPONSE_MAP_TITLE = 'Quiz'&lt;br /&gt;
    REVIEW_RESPONSE_MAP_TITLE = 'Review'&lt;br /&gt;
    TEAMMATE_REVIEW_RESPONSE_MAP_TITLE = 'Teammate Review' &lt;br /&gt;
  end&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
* concerns/response_map_subclass_titles.rb&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
===Example Tests===&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164810</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164810"/>
		<updated>2025-04-22T23:05:39Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. It maps from two participants, the reviewer and the reviewee, and the relevant assignment to the response object that contains the actual responses to the questions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
Many of the subclasses are fairly similar with only slight changes in the values returned. An example of one of these is the FeedbackResponseMap:&lt;br /&gt;
&lt;br /&gt;
=====FeedbackResponseMap=====&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
It is not part of a sub-hierarchy so it inherits directly from ResponseMap and only has associations that are different from the parent ResponseMap model.&lt;br /&gt;
&lt;br /&gt;
====Removing Hardcoded Values====&lt;br /&gt;
&lt;br /&gt;
Each bottom level subclass contains a get_title method that returns a string representing the a formatted name of the class. We moved these all to one module that we could include in the parent class, then use the constants from in the subclass methods. We examined other approaches, but felt this would be more extendable if other classes needed to follow the same pattern:&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
  module ResponseMapSubclassTitles&lt;br /&gt;
    ASSIGNMENT_SURVEY_RESPONSE_MAP_TITLE = 'Assignment Survey'&lt;br /&gt;
    BOOKMARK_RATING_RESPONSE_MAP_TITLE = 'Bookmark Review'&lt;br /&gt;
    COURSE_SURVEY_RESPONSE_MAP_TITLE = 'Course Survey'&lt;br /&gt;
    FEEDBACK_RESPONSE_MAP_TITLE = 'Feedback'&lt;br /&gt;
    GLOBAL_SURVEY_RESPONSE_MAP_TITLE = 'Global Survey'&lt;br /&gt;
    METAREVIEW_RESPONSE_MAP_TITLE = 'Metareview'&lt;br /&gt;
    QUIZ_RESPONSE_MAP_TITLE = 'Quiz'&lt;br /&gt;
    REVIEW_RESPONSE_MAP_TITLE = 'Review'&lt;br /&gt;
    TEAMMATE_REVIEW_RESPONSE_MAP_TITLE = 'Teammate Review' &lt;br /&gt;
  end&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
* concerns/response_map_subclass_titles.rb&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
===Example Tests===&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2532-uml.png&amp;diff=164807</id>
		<title>File:E2532-uml.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2532-uml.png&amp;diff=164807"/>
		<updated>2025-04-22T23:02:52Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: Dchrist2 uploaded a new version of File:E2532-uml.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164798</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164798"/>
		<updated>2025-04-22T22:44:50Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. It maps from two participants, the reviewer and the reviewee, and the relevant assignment to the response object that contains the actual responses to the questions. &lt;br /&gt;
&lt;br /&gt;
[[File:E2532-uml.png]]&lt;br /&gt;
&lt;br /&gt;
While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
Many of the subclasses are fairly similar with only slight changes in the values returned. An example of one of these is the FeedbackResponseMap:&lt;br /&gt;
&lt;br /&gt;
=====FeedbackResponseMap=====&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
It is not part of a sub-hierarchy so it inherits directly from ResponseMap and only has associations that are different from the parent ResponseMap model.&lt;br /&gt;
&lt;br /&gt;
====Removing Hardcoded Values====&lt;br /&gt;
&lt;br /&gt;
Each bottom level subclass contains a get_title method that returns a string representing the a formatted name of the class. We moved these all to one module that we could include in the parent class, then use the constants from in the subclass methods. We examined other approaches, but felt this would be more extendable if other classes needed to follow the same pattern:&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
  module ResponseMapSubclassTitles&lt;br /&gt;
    ASSIGNMENT_SURVEY_RESPONSE_MAP_TITLE = 'Assignment Survey'&lt;br /&gt;
    BOOKMARK_RATING_RESPONSE_MAP_TITLE = 'Bookmark Review'&lt;br /&gt;
    COURSE_SURVEY_RESPONSE_MAP_TITLE = 'Course Survey'&lt;br /&gt;
    FEEDBACK_RESPONSE_MAP_TITLE = 'Feedback'&lt;br /&gt;
    GLOBAL_SURVEY_RESPONSE_MAP_TITLE = 'Global Survey'&lt;br /&gt;
    METAREVIEW_RESPONSE_MAP_TITLE = 'Metareview'&lt;br /&gt;
    QUIZ_RESPONSE_MAP_TITLE = 'Quiz'&lt;br /&gt;
    REVIEW_RESPONSE_MAP_TITLE = 'Review'&lt;br /&gt;
    TEAMMATE_REVIEW_RESPONSE_MAP_TITLE = 'Teammate Review' &lt;br /&gt;
  end&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
* concerns/response_map_subclass_titles.rb&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
===Example Tests===&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164796</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164796"/>
		<updated>2025-04-22T22:43:23Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Removing Hardcoded Values */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. It maps from two participants, the reviewer and the reviewee, and the relevant assignment to the response object that contains the actual responses to the questions. &lt;br /&gt;
&lt;br /&gt;
[[File:E2532-uml.png]]&lt;br /&gt;
&lt;br /&gt;
While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
Many of the subclasses are fairly similar with only slight changes in the values returned. An example of one of these is the FeedbackResponseMap:&lt;br /&gt;
&lt;br /&gt;
=====FeedbackResponseMap=====&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
It is not part of a sub-hierarchy so it inherits directly from ResponseMap and only has associations that are different from the parent ResponseMap model.&lt;br /&gt;
&lt;br /&gt;
====Removing Hardcoded Values====&lt;br /&gt;
&lt;br /&gt;
Each bottom level subclass contains a get_title method that returns a string representing the a formatted name of the class. We moved these all to one module that we could include in the parent class, then use the constants from in the subclass methods. We examined other approaches, but felt this would be more extendable if other classes needed to follow the same pattern:&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
  module ResponseMapSubclassTitles&lt;br /&gt;
    ASSIGNMENT_SURVEY_RESPONSE_MAP_TITLE = 'Assignment Survey'&lt;br /&gt;
    BOOKMARK_RATING_RESPONSE_MAP_TITLE = 'Bookmark Review'&lt;br /&gt;
    COURSE_SURVEY_RESPONSE_MAP_TITLE = 'Course Survey'&lt;br /&gt;
    FEEDBACK_RESPONSE_MAP_TITLE = 'Feedback'&lt;br /&gt;
    GLOBAL_SURVEY_RESPONSE_MAP_TITLE = 'Global Survey'&lt;br /&gt;
    METAREVIEW_RESPONSE_MAP_TITLE = 'Metareview'&lt;br /&gt;
    QUIZ_RESPONSE_MAP_TITLE = 'Quiz'&lt;br /&gt;
    REVIEW_RESPONSE_MAP_TITLE = 'Review'&lt;br /&gt;
    TEAMMATE_REVIEW_RESPONSE_MAP_TITLE = 'Teammate Review' &lt;br /&gt;
  end&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
* concerns/response_map_subclass_titles.rb&lt;br /&gt;
&lt;br /&gt;
==Subclasses and Testing==&lt;br /&gt;
&lt;br /&gt;
===FeedbackResponseMap===&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
For integration testing, we will write tests to simulate real-world interactions between models. Furthermore, special attention will be provided to edge cases (i.e. missing data, interactions between multiple subclasses of ResponseMap, etc.) to ensure proper error handling. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, to ease the workflow process for further groups in later iterations, we will thoroughly document all test cases through comments, providing clear explanations of each test’s purpose and anticipated results.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164795</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164795"/>
		<updated>2025-04-22T22:42:31Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. It maps from two participants, the reviewer and the reviewee, and the relevant assignment to the response object that contains the actual responses to the questions. &lt;br /&gt;
&lt;br /&gt;
[[File:E2532-uml.png]]&lt;br /&gt;
&lt;br /&gt;
While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
Many of the subclasses are fairly similar with only slight changes in the values returned. An example of one of these is the FeedbackResponseMap:&lt;br /&gt;
&lt;br /&gt;
=====FeedbackResponseMap=====&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
It is not part of a sub-hierarchy so it inherits directly from ResponseMap and only has associations that are different from the parent ResponseMap model.&lt;br /&gt;
&lt;br /&gt;
====Removing Hardcoded Values====&lt;br /&gt;
&lt;br /&gt;
Each bottom level subclass contains a get_title method that returns a string representing the a formatted name of the class. We moved these all to one module that we could include in the parent class, then use the constants from in the subclass methods. We examined other approaches, but felt this would be more extendable if other classes needed to follow the same pattern:&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
module ResponseMapSubclassTitles&lt;br /&gt;
    ASSIGNMENT_SURVEY_RESPONSE_MAP_TITLE = 'Assignment Survey'&lt;br /&gt;
    BOOKMARK_RATING_RESPONSE_MAP_TITLE = 'Bookmark Review'&lt;br /&gt;
    COURSE_SURVEY_RESPONSE_MAP_TITLE = 'Course Survey'&lt;br /&gt;
    FEEDBACK_RESPONSE_MAP_TITLE = 'Feedback'&lt;br /&gt;
    GLOBAL_SURVEY_RESPONSE_MAP_TITLE = 'Global Survey'&lt;br /&gt;
    METAREVIEW_RESPONSE_MAP_TITLE = 'Metareview'&lt;br /&gt;
    QUIZ_RESPONSE_MAP_TITLE = 'Quiz'&lt;br /&gt;
    REVIEW_RESPONSE_MAP_TITLE = 'Review'&lt;br /&gt;
    TEAMMATE_REVIEW_RESPONSE_MAP_TITLE = 'Teammate Review' &lt;br /&gt;
end&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
* concerns/response_map_subclass_titles.rb&lt;br /&gt;
&lt;br /&gt;
==Subclasses and Testing==&lt;br /&gt;
&lt;br /&gt;
===FeedbackResponseMap===&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
For integration testing, we will write tests to simulate real-world interactions between models. Furthermore, special attention will be provided to edge cases (i.e. missing data, interactions between multiple subclasses of ResponseMap, etc.) to ensure proper error handling. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, to ease the workflow process for further groups in later iterations, we will thoroughly document all test cases through comments, providing clear explanations of each test’s purpose and anticipated results.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164784</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164784"/>
		<updated>2025-04-22T22:28:27Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
[[File:E2532-uml.png]]&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
==Subclasses and Testing==&lt;br /&gt;
&lt;br /&gt;
===FeedbackResponseMap===&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
For integration testing, we will write tests to simulate real-world interactions between models. Furthermore, special attention will be provided to edge cases (i.e. missing data, interactions between multiple subclasses of ResponseMap, etc.) to ensure proper error handling. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, to ease the workflow process for further groups in later iterations, we will thoroughly document all test cases through comments, providing clear explanations of each test’s purpose and anticipated results.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164779</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164779"/>
		<updated>2025-04-22T22:27:32Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
[[E2532-uml.png]]&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
==Subclasses and Testing==&lt;br /&gt;
&lt;br /&gt;
===FeedbackResponseMap===&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
For integration testing, we will write tests to simulate real-world interactions between models. Furthermore, special attention will be provided to edge cases (i.e. missing data, interactions between multiple subclasses of ResponseMap, etc.) to ensure proper error handling. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, to ease the workflow process for further groups in later iterations, we will thoroughly document all test cases through comments, providing clear explanations of each test’s purpose and anticipated results.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2532-uml.png&amp;diff=164776</id>
		<title>File:E2532-uml.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2532-uml.png&amp;diff=164776"/>
		<updated>2025-04-22T22:26:56Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164773</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164773"/>
		<updated>2025-04-22T22:25:40Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
==Subclasses and Testing==&lt;br /&gt;
&lt;br /&gt;
===FeedbackResponseMap===&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
For integration testing, we will write tests to simulate real-world interactions between models. Furthermore, special attention will be provided to edge cases (i.e. missing data, interactions between multiple subclasses of ResponseMap, etc.) to ensure proper error handling. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, to ease the workflow process for further groups in later iterations, we will thoroughly document all test cases through comments, providing clear explanations of each test’s purpose and anticipated results.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164760</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=164760"/>
		<updated>2025-04-22T22:10:28Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
====Reimplementing Subclasses====&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
* survey_response_map.rb&lt;br /&gt;
* assignment_survey_response_map.rb&lt;br /&gt;
* course_survey_response_map.rb&lt;br /&gt;
* global_survey_response_map.rb&lt;br /&gt;
* review_response_map.rb&lt;br /&gt;
* bookmark_rating_response_map.rb&lt;br /&gt;
* feedback_response_map.rb&lt;br /&gt;
* meta_review_response_map.rb&lt;br /&gt;
* quiz_response_map.rb&lt;br /&gt;
* self_review_response_map.rb&lt;br /&gt;
* teammate_review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
==Subclasses and Testing==&lt;br /&gt;
&lt;br /&gt;
===FeedbackResponseMap===&lt;br /&gt;
[[File:FeedbackResponseMap.png]]&lt;br /&gt;
&lt;br /&gt;
The FeedbackResponseMap class is a subclass of ResponseMap and represents feedback provided in response to a review. It establishes a belongs_to association with a Response object, referenced as review, using reviewed_object_id as the foreign key. The assignment method returns the assignment associated with the original review by accessing it through the review's map. The questionnaire method retrieves a questionnaire record that matches the reviewed_object_id. Lastly, the get_title method returns a predefined constant, FEEDBACK_RESPONSE_MAP_TITLE, that denotes a title for feedback response maps.&lt;br /&gt;
&lt;br /&gt;
[[File:FeedbackResponseMap Tests.png]]&lt;br /&gt;
&lt;br /&gt;
This RSpec test suite verifies the functionality of FeedbackResponseMap model by including tests for the three main methods. The assignment test ensures that the model correctly returns the assignment linked to the feedback through the associated review. The questionnaire test checks that it retrieves the appropriate questionnaire, specifically one of type AuthorFeedbackQuestionnaire, based on the reviewed_object_id. Lastly, the get_title test confirms that the method returns the expected title constant defined for feedback response maps. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Foremost, for Unit Testing, we will write tests to ensure that all validations are functioning as anticipated for each model. Furthermore, we will verify that all belongs_to and has_many associations are configured properly and ensure that no dangling records remain after creating or destroying records involved. Moreover, various testing measures will ensure that business logic operates correctly in the model, paying special attention will be given to methods shared across multiple subclasses. Lastly, any refactored code that incorporates environmental variables will be thoroughly tested to ensure that correct values appear in place of hardcoded ones.&lt;br /&gt;
&lt;br /&gt;
For integration testing, we will write tests to simulate real-world interactions between models. Furthermore, special attention will be provided to edge cases (i.e. missing data, interactions between multiple subclasses of ResponseMap, etc.) to ensure proper error handling. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, to ease the workflow process for further groups in later iterations, we will thoroughly document all test cases through comments, providing clear explanations of each test’s purpose and anticipated results.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=163058</id>
		<title>CSC/ECE 517 Spring 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=163058"/>
		<updated>2025-04-03T18:22:26Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2025 - E2503. Refactor the Team hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2504. Mentor-meeting management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2505. Testing Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2508. Reimplement bidding-algorithm web service]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2509. Reimplement feedback_response_map.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2519. Implement view for results of bidding]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2522. Enhancing UI Consistency in Expertiza 1]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2520. Reimplement heatgrid UI for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2517. Reimplement internationalization (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2523: Enhancing UI Consistency in Expertiza 2]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2515:  Reimplement student_teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2501:  Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2502:  Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2510. Reimplement grades_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2507. Reimplement back end for submission records]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2514. Reimplement student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2518. Reimplement password resets (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2516. Reimplement teams_users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2511. Reimplement participants_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2521. UI for View submissions/assign grades (except heatgrid)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2513. Reimplement sign_up_topic.rb as project_topic.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2506. Implement testing for new Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2527. Mentor-meeting management: assignments with topics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2539 Reimplement Student Task View (Frontend + Backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2521 UI for View submissions/assign grades (except heatgrid)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2530 Reimplement Grades Controller (Frontend + Backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2538 Reimplementing Questionnaire Page in Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2534 UI for Assign Reviewers]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2540 Integration of Assignment participant Frontend with participant controller Backend]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses]]&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163057</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163057"/>
		<updated>2025-04-03T18:15:27Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Testing Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163053</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163053"/>
		<updated>2025-04-03T17:01:13Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Implementation Plan===&lt;br /&gt;
Our plan will be to start at the top of the hierarchy and find code that is repeated in different places and consolidate to the highest point of the hierarchy where it makes sense, looking at associations, validations and methods. An example of this are the lines:&lt;br /&gt;
 belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'&lt;br /&gt;
 belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'&lt;br /&gt;
which appear in several different models, including the ResponseMap class itself. We will also identify methods such as the '''email''' method that appear in different subclasses that share much of the implementation and refactor the shared parts into a shared method.&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163052</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163052"/>
		<updated>2025-04-03T14:51:05Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163051</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163051"/>
		<updated>2025-04-03T14:50:03Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
The current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, and comprehensive testing. This results in maintainability issues, scalability problems, and poor integration with existing components. Additionally, while the current implementation is functional, it is poorly documented, making it difficult for someone new to the project to understand what the purpose of each subclass is.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163050</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163050"/>
		<updated>2025-04-03T14:48:20Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Design Goal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
Additionally, the current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, comprehensive testing, and clear documentation. This results in maintainability issues, scalability problems, and poor integration with existing components.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
We have several goals for this project:&lt;br /&gt;
*Utilize the existing hierarchy and ensure proper inheritance between models.&lt;br /&gt;
*Ensure that all business logic and validations are in the proper model. This includes both making sure that code is not unnecessarily repeated in a class and its subclasses and making sure that a class does not contain logic based on its subclasses.&lt;br /&gt;
*Move hardcoded values to an environment variables file, and replace instance of that value in the repo with the new environment variable.&lt;br /&gt;
*Develop extensive test coverage for each new model.&lt;br /&gt;
*Document each new model with clear comments on its use and methods.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163049</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163049"/>
		<updated>2025-04-03T14:25:57Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
*ResponseMap&lt;br /&gt;
**'''SurveyResponseMap'''&lt;br /&gt;
***'''AssignmentSurveyResponseMap'''&lt;br /&gt;
***'''CourseSurveyResponseMap'''&lt;br /&gt;
***'''GlobalSurveyResponseMap'''&lt;br /&gt;
**ReviewResponseMap&lt;br /&gt;
***'''BookmarkRatingResponseMap'''&lt;br /&gt;
**'''FeedbackResponseMap'''&lt;br /&gt;
**''MetareviewResponseMap''&lt;br /&gt;
**'''QuizResponseMap'''&lt;br /&gt;
**''SelfReviewResponseMap''&lt;br /&gt;
**'''TeammateReviewResponseMap'''&lt;br /&gt;
&lt;br /&gt;
Additionally, the current implementation lacks a clear hierarchical structure for models, encapsulation of business logic, flexibility due to hardcoded values, comprehensive testing, and clear documentation. This results in maintainability issues, scalability problems, and poor integration with existing components.&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163048</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=163048"/>
		<updated>2025-04-03T14:20:34Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The ResponseMap concept in Expertiza exists as a hierarchy of several different Rails models, that utilize Singe Table Inheritance to allow for the use of polymorphism across the different types of Assignments that different ResponseMaps may map to. While part of the ResponseMap hierarchy has been reimplemented in the the new Expertiza backend, most of it has not. Our team has been tasked with the reimplementation of several of these. Below is the full ResponseMap hierarchy. Class names in bold are ones we are tasked with reimplementing, those in italics are for future projects, and those in neither have already been reimplemented:&lt;br /&gt;
&lt;br /&gt;
ResponseMap&lt;br /&gt;
*'''Survey Response map'''&lt;br /&gt;
**'''Assignment_survey_response_map'''&lt;br /&gt;
**'''Course_survey_response_map'''&lt;br /&gt;
**'''Global_survey_response_map'''&lt;br /&gt;
*Review Response map&lt;br /&gt;
**'''Bookmark_rating_response_map'''&lt;br /&gt;
*'''Feedback_response_map'''&lt;br /&gt;
*''Metareview_response_map''&lt;br /&gt;
*'''Quiz_response_map'''&lt;br /&gt;
*''Self_review_response_map''&lt;br /&gt;
*'''Teammate_review_response_map'''&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=162919</id>
		<title>CSC/ECE 517 Spring 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=162919"/>
		<updated>2025-04-01T18:36:06Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2025 - E2503. Refactor the Team hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2504. Mentor-meeting management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2505. Testing Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2508. Reimplement bidding-algorithm web service]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2509. Reimplement feedback_response_map.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2519. Implement view for results of bidding]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2522. Enhancing UI Consistency in Expertiza 1]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2520. Reimplement heatgrid UI for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2517. Reimplement internationalization (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2523: Enhancing UI Consistency in Expertiza 2]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2515:  Reimplement student_teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2501:  Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2502:  Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2510. Reimplement grades_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2507. Reimplement back end for submission records]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2514. Reimplement student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2518. Reimplement password resets (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2516. Reimplement teams_users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2511. Reimplement participants_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2521. UI for View submissions/assign grades (except heatgrid)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2513. Reimplement sign_up_topic.rb as project_topic.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2506. Implement testing for new Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2527. Mentor-meeting management: assignments with topics]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses]]&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=162918</id>
		<title>CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2532._Reimplement_Missing_ResponseMap_Subclasses&amp;diff=162918"/>
		<updated>2025-04-01T18:35:30Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: Created page with &amp;quot;==Expertiza==  ==Team== =====Mentor=====  *Anish Toorpu  =====Members=====  *Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt; *Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt; *Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;  ==Problem Statement==  ==Design Goal==  ==Implementation==  ===Current Implementation===  ===Responses Controller===  ===Response Helper===  ===Other Methods===  ==Files Added/Modified==  ==Testing Plan== ===Responses Controller===  ===Response Helper===  ===Other Methods===&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=162917</id>
		<title>CSC/ECE 517 Spring 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=162917"/>
		<updated>2025-04-01T18:34:53Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2025 - E2503. Refactor the Team hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2504. Mentor-meeting management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2505. Testing Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2508. Reimplement bidding-algorithm web service]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2509. Reimplement feedback_response_map.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2519. Implement view for results of bidding]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2522. Enhancing UI Consistency in Expertiza 1]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2520. Reimplement heatgrid UI for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2517. Reimplement internationalization (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2523: Enhancing UI Consistency in Expertiza 2]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2515:  Reimplement student_teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2501:  Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2502:  Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2510. Reimplement grades_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2507. Reimplement back end for submission records]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2514. Reimplement student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2518. Reimplement password resets (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2516. Reimplement teams_users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2511. Reimplement participants_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2521. UI for View submissions/assign grades (except heatgrid)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2513. Reimplement sign_up_topic.rb as project_topic.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2506. Implement testing for new Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller (Phase 2)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2527. Mentor-meeting management: assignments with topics]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2532. Reimplement Missing ResponseMap Subclasses]]&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller_(Phase_2)&amp;diff=162912</id>
		<title>CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller_(Phase_2)&amp;diff=162912"/>
		<updated>2025-04-01T14:41:05Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmaye@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller_(Phase_2)&amp;diff=162911</id>
		<title>CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller_(Phase_2)&amp;diff=162911"/>
		<updated>2025-04-01T14:40:40Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: Created page with &amp;quot;==Expertiza==  ==Team== =====Mentor=====  *Anish Toorpu  =====Members=====  *Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt; *Eleanor Maye &amp;lt;edmay@ncsu.edu&amp;gt; *Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;  ==Problem Statement==  ==Design Goal==  ==Implementation==  ===Current Implementation===  ===Responses Controller===  ===Response Helper===  ===Other Methods===  ==Files Added/Modified==  ==Testing Plan== ===Responses Controller===  ===Response Helper===  ===Other Methods===&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Anish Toorpu&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Dennis Christman &amp;lt;dchrist2@ncsu.edu&amp;gt;&lt;br /&gt;
*Eleanor Maye &amp;lt;edmay@ncsu.edu&amp;gt;&lt;br /&gt;
*Ryan Gallagher &amp;lt;rtgalla2@ncsu.edu&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
==Design Goal==&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;br /&gt;
&lt;br /&gt;
==Files Added/Modified==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
===Responses Controller===&lt;br /&gt;
&lt;br /&gt;
===Response Helper===&lt;br /&gt;
&lt;br /&gt;
===Other Methods===&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=162910</id>
		<title>CSC/ECE 517 Spring 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025&amp;diff=162910"/>
		<updated>2025-04-01T14:30:39Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2025 - E2503. Refactor the Team hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2504. Mentor-meeting management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2505. Testing Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2508. Reimplement bidding-algorithm web service]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2509. Reimplement feedback_response_map.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2519. Implement view for results of bidding]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2522. Enhancing UI Consistency in Expertiza 1]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2520. Reimplement heatgrid UI for reviews]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2517. Reimplement internationalization (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2523: Enhancing UI Consistency in Expertiza 2]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2515:  Reimplement student_teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2501:  Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2502:  Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2510. Reimplement grades_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2507. Reimplement back end for submission records]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2514. Reimplement student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2518. Reimplement password resets (frontend + backend)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2516. Reimplement teams_users_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2511. Reimplement participants_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2521. UI for View submissions/assign grades (except heatgrid)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2513. Reimplement sign_up_topic.rb as project_topic.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2506. Implement testing for new Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller (Phase 2)]]&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162789</id>
		<title>CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162789"/>
		<updated>2025-03-25T03:43:32Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Future Improvements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
The ResponseController in Expertiza is responsible for handling responses to quizzes, peer reviews, and surveys. However, the current implementation has several design issues, including violations of Rails naming conventions, excessive responsibilities, and redundant logic. The goal of this project is to reimplement (not refactor) a new response_controller.rb as responses_controller.rb. This includes CRUD operations (create, read, update, delete) and the functionality previously found in the old controller, but done in a clean, modern, and conventional way&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The Responses controller currently does not follow modern idioms and the updated Expertiza style guide. It also contains too many extra pieces of logic and needs to move logic to other mailers/helpers/services/models.&lt;br /&gt;
&lt;br /&gt;
==Tasks Identified==&lt;br /&gt;
* Rename response_controller.rb to responses_controller.rb to adhere to Rails naming conventions.&lt;br /&gt;
* Limit the controller to CRUD operations, moving non-CRUD logic to models, helpers, or services.&lt;br /&gt;
* Ensure questions (items) are displayed in the correct sequence when rendering responses.&lt;br /&gt;
* Move the sorting logic from the edit method to the Response model for better organization.&lt;br /&gt;
* Rename sort_questions to sort_items for improved clarity.&lt;br /&gt;
* Use polymorphism to determine if the reviewer is a team, replacing existing if statements.&lt;br /&gt;
* Consolidate redundant parameter-setting methods (assign_action_parameters, set_content) into a single, more efficient method.&lt;br /&gt;
* Refactor questionnaire_from_response_map to simplify logic and support topic-based rubrics.&lt;br /&gt;
* Identify and remove unused (dead) methods to clean up the codebase.&lt;br /&gt;
* Extract email generation logic from the controller and move it to a dedicated helper.&lt;br /&gt;
&lt;br /&gt;
== Our Reimplementation ==&lt;br /&gt;
&lt;br /&gt;
=== Move Sorting Logic &amp;amp; Display In Correct Order ===&lt;br /&gt;
&lt;br /&gt;
Previously, the sorting logic was inside the update method of the Response controller:&lt;br /&gt;
  if @prev.present?&lt;br /&gt;
      @sorted = @review_scores.sort do |m1, m2|&lt;br /&gt;
        if m1.version_num.to_i &amp;amp;&amp;amp; m2.version_num.to_i&lt;br /&gt;
          m2.version_num.to_i &amp;lt;=&amp;gt; m1.version_num.to_i&lt;br /&gt;
        else&lt;br /&gt;
          m1.version_num ? -1 : 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @largest_version_num = @sorted[0]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the Response model:&lt;br /&gt;
&lt;br /&gt;
  # Sort responses by version number, descending&lt;br /&gt;
  def self.sort_by_version&lt;br /&gt;
    review_scores = Response.where(map_id: @map.id).to_a&lt;br /&gt;
    return [] if review_scores.empty?&lt;br /&gt;
    sorted = review_scores.sort_by { |response| response.version_num.to_i }.reverse&lt;br /&gt;
    sorted[0]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The new logic is very similar, but cleaner and available for use in other contexts.&lt;br /&gt;
&lt;br /&gt;
Similarly, sort_questions was re-implemented in ResponsesHelper:&lt;br /&gt;
  #Renamed to sort_items from sort_questions&lt;br /&gt;
  def sort_items(questions)&lt;br /&gt;
    questions.sort_by(&amp;amp;:seq)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Consolidate Parameter Setting Methods ===&lt;br /&gt;
&lt;br /&gt;
The old ResponseController had separate methods to set key Response parameters: assign_action_parameters and set_content. These methods are highly duplicative of each other and add more complexity to the code base. They are also non-CRUD methods in the controller, so we re-implemented them into one helper method: prepare_response_content&lt;br /&gt;
&lt;br /&gt;
def prepare_response_content(map, action_params = nil, new_response = false)&lt;br /&gt;
        # Set title and other initial content based on the map&lt;br /&gt;
        title = map.get_title&lt;br /&gt;
        survey_parent = nil&lt;br /&gt;
        assignment = nil&lt;br /&gt;
        participant = map.reviewer&lt;br /&gt;
        contributor = map.contributor&lt;br /&gt;
  &lt;br /&gt;
        if map.survey?&lt;br /&gt;
          survey_parent = map.survey_parent&lt;br /&gt;
        else&lt;br /&gt;
          assignment = map.assignment&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
        # Get the questionnaire and sort questions&lt;br /&gt;
        questionnaire = questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
        review_questions = Response.sort_by_version(questionnaire.questions)&lt;br /&gt;
        min = questionnaire.min_question_score&lt;br /&gt;
        max = questionnaire.max_question_score&lt;br /&gt;
&lt;br /&gt;
        # Initialize response if new_response is true&lt;br /&gt;
        response = nil&lt;br /&gt;
        if new_response&lt;br /&gt;
          response = Response.where(map_id: map.id).order(updated_at: :desc).first&lt;br /&gt;
          if response.nil?&lt;br /&gt;
            response = Response.create(map_id: map.id, additional_comment: '', is_submitted: 0)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        # Set up dropdowns or scales&lt;br /&gt;
        set_dropdown_or_scale(questionnaire, assignment)&lt;br /&gt;
        # Process the action parameters if provided&lt;br /&gt;
        if action_params&lt;br /&gt;
          case action_params[:action]&lt;br /&gt;
          when 'edit'&lt;br /&gt;
            header = 'Edit'&lt;br /&gt;
            next_action = 'update'&lt;br /&gt;
            response = Response.find(action_params[:id])&lt;br /&gt;
            contributor = map.contributor&lt;br /&gt;
          when 'new'&lt;br /&gt;
            header = 'New'&lt;br /&gt;
            next_action = 'create'&lt;br /&gt;
            feedback = action_params[:feedback]&lt;br /&gt;
            modified_object = map.id&lt;br /&gt;
          end&lt;br /&gt;
        end &lt;br /&gt;
&lt;br /&gt;
By using parameters to manage cases around the action being 'new', we were able to combine these methods into one method. This allows for one method to perform this singular function, and the final controller code can be simplified with this in mind.&lt;br /&gt;
&lt;br /&gt;
=== Refactor Questionnaire_from_response_map ===&lt;br /&gt;
&lt;br /&gt;
The old questionnaire_from_response_map method did not support topic based reviewing and resided in the controller:&lt;br /&gt;
  def questionnaire_from_response_map&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when 'ReviewResponseMap', 'SelfReviewResponseMap'&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      'MetareviewResponseMap',&lt;br /&gt;
      'TeammateReviewResponseMap',&lt;br /&gt;
      'FeedbackResponseMap',&lt;br /&gt;
      'CourseSurveyResponseMap',&lt;br /&gt;
      'AssignmentSurveyResponseMap',&lt;br /&gt;
      'GlobalSurveyResponseMap',&lt;br /&gt;
      'BookmarkRatingResponseMap'&lt;br /&gt;
      if @assignment.duty_based_assignment?&lt;br /&gt;
        # E2147 : gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        @questionnaire = @map.questionnaire_by_duty(@map.reviewee.duty_id)&lt;br /&gt;
      else&lt;br /&gt;
        @questionnaire = @map.questionnaire&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To remedy this, the method was re-implemented in the ResponsesHelper file, along with some helper methods :&lt;br /&gt;
  def questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
    if ['ReviewResponseMap', 'SelfReviewResponseMap'].include?(map.type)&lt;br /&gt;
      get_questionnaire_by_contributor(map, contributor, assignment)&lt;br /&gt;
    else&lt;br /&gt;
      get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
    end&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_contributor(map, contributor, assignment)       &lt;br /&gt;
      reviewees_topic = SignedUpTeam.find_by(team_id: contributor.id)&amp;amp;.sign_up_topic_id&lt;br /&gt;
      current_round = DueDate.next_due_date(reviewees_topic).round&lt;br /&gt;
      map.questionnaire(current_round, reviewees_topic)&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
      if assignment.duty_based_assignment?&lt;br /&gt;
        # Gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        map.questionnaire_by_duty(map.reviewee.duty_id)&lt;br /&gt;
    else&lt;br /&gt;
        map.questionnaire&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This logic is much more extendable to new implementations than the legacy logic, and easier to read and maintain than the legacy logic.&lt;br /&gt;
&lt;br /&gt;
=== Refactor toggle_permissions ===&lt;br /&gt;
toggle_permissions was updated to improve readability using the Single Responsibility principle. Below is the original code for toggle_permissions.&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    render nothing: true unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    # the response to be updated&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    # Error message placeholder&lt;br /&gt;
    error_msg = ''&lt;br /&gt;
&lt;br /&gt;
    begin&lt;br /&gt;
      @map = @response.map&lt;br /&gt;
&lt;br /&gt;
      # Updating visibility for the response object, by E2022 @SujalAhrodia --&amp;gt;&lt;br /&gt;
      visibility = params[:visibility]&lt;br /&gt;
      unless visibility.nil?&lt;br /&gt;
        @response.update_attribute('visibility', visibility)&lt;br /&gt;
      end&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      error_msg = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: @map.map_id, return: params[:return], msg: params[:msg], error_msg: error_msg&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
In the new iteration, the method was updated to use a helper method to update the visibility attribute.&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    return head :no_content unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    error = update_visibility(params[:visibility])&lt;br /&gt;
    if error == ''&lt;br /&gt;
      map_id = @response.map.map_id&lt;br /&gt;
    else&lt;br /&gt;
      map_id = nil&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: params[:msg], error_msg: error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # responses_helper.rb&lt;br /&gt;
  def update_visibility(visibility)&lt;br /&gt;
      error = &amp;quot;&amp;quot;&lt;br /&gt;
      begin&lt;br /&gt;
        unless visibility.nil?&lt;br /&gt;
          @response.update(visibility: visibility)&lt;br /&gt;
        end&lt;br /&gt;
      rescue StandardError&lt;br /&gt;
        error = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Refactor new_feedback ===&lt;br /&gt;
new_feedback was refactored using the prepare_response_content helper function to shorten the number of lines dedicated to instance assignments.&lt;br /&gt;
Previous method:&lt;br /&gt;
&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    review = Response.find(params[:id]) unless params[:id].nil?&lt;br /&gt;
    if review&lt;br /&gt;
      reviewer = AssignmentParticipant.where(user_id: session[:user].id, parent_id: review.map.assignment.id).first&lt;br /&gt;
      map = FeedbackResponseMap.where(reviewed_object_id: review.id, reviewer_id: reviewer.id).first&lt;br /&gt;
      if map.nil?&lt;br /&gt;
        # if no feedback exists by dat user den only create for dat particular response/review&lt;br /&gt;
        map = FeedbackResponseMap.create(reviewed_object_id: review.id, reviewer_id: reviewer.id, reviewee_id: review.map.reviewer.id)&lt;br /&gt;
      end&lt;br /&gt;
      redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New implementation:&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    if Response.find(params[:id])&lt;br /&gt;
      @map = Response.find(params[:id]).map&lt;br /&gt;
      response_content = prepare_response_content(@map)&lt;br /&gt;
&lt;br /&gt;
      # Assign variables from response_content hash&lt;br /&gt;
      response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
      if @response&lt;br /&gt;
        @reviewer = AssignmentParticipant.where(user_id: current_user.id, parent_id: @response.map.assignment.id).first&lt;br /&gt;
        map = find_or_create_feedback&lt;br /&gt;
        redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  #responses_helper.rb&lt;br /&gt;
  def find_or_create_feedback&lt;br /&gt;
    map = FeedbackResponseMap.where(reviewed_object_id: @response.id, reviewer_id: @reviewer.id).first&lt;br /&gt;
    if map.nil?&lt;br /&gt;
      map = FeedbackResponseMap.create(reviewed_object_id: @response.id, reviewer_id: @reviewer.id, reviewee_id: @response.map.reviewer.id)&lt;br /&gt;
    end&lt;br /&gt;
    map&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Extract email generation logic and move to model ===&lt;br /&gt;
&lt;br /&gt;
Previously, the email generation logic resided in the controller and was designed around one type of email:&lt;br /&gt;
  def send_email&lt;br /&gt;
    subject = params['send_email']['subject']&lt;br /&gt;
    body = params['send_email']['email_body']&lt;br /&gt;
    response = params['response']&lt;br /&gt;
    email = params['email']&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      if subject.blank? || body.blank?&lt;br /&gt;
        flash[:error] = 'Please fill in the subject and the email content.'&lt;br /&gt;
        format.html { redirect_to controller: 'response', action: 'author', response: response, email: email }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      else&lt;br /&gt;
        # make a call to method invoking the email process&lt;br /&gt;
        MailerHelper.send_mail_to_author_reviewers(subject, body, email)&lt;br /&gt;
        flash[:success] = 'Email sent to the author.'&lt;br /&gt;
        format.html { redirect_to controller: 'student_task', action: 'list' }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the ResponseMailer class:&lt;br /&gt;
    # Send an email to authors from a reviewer&lt;br /&gt;
    def send_response_email(response)&lt;br /&gt;
        @body = response.params[:send_email][:email_body]&lt;br /&gt;
        @subject = params[:send_email][:subject]&lt;br /&gt;
        Rails.env.development? || Rails.env.test? ? @email = 'expertiza.mailer@gmail.com' : @email = response.params[:email]&lt;br /&gt;
        mail(to: @email, body: @body, subject: @subject, content_type: 'text/html',)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
And sent in the Response model:&lt;br /&gt;
  # Send response email from reviewer to author&lt;br /&gt;
  def self.send_response_email&lt;br /&gt;
    ResponseMailer.with(response: self)&lt;br /&gt;
      .send_response_email&lt;br /&gt;
      .deliver_later&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This mailer implementation is idiomatic to modern Rails and also used in other places within the Expertiza backend re-implementation. This format makes it easy to manage the emails sent by Expertiza by isolating them and their content from the actual location in the codebase where they are sent, allowing for a clean division of responsibilities and easy future maintenance.&lt;br /&gt;
&lt;br /&gt;
=== Create Operation ===&lt;br /&gt;
&lt;br /&gt;
Using the helper methods implemented and already discussed, the code for the new and create methods is simplified:&lt;br /&gt;
  def new&lt;br /&gt;
    @map = ResponseMap.find(params[:id])&lt;br /&gt;
    attributes = prepare_response_content(map, 'New', true)&lt;br /&gt;
    attributes.each do |key, value|&lt;br /&gt;
      instance_variable_set(&amp;quot;@#{key}&amp;quot;, value)&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment&lt;br /&gt;
      @stage = @assignment.current_stage(SignedUpTeam.topic_id(@participant.parent_id, @participant.user_id))&lt;br /&gt;
    end&lt;br /&gt;
    questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    @total_score = total_cake_score&lt;br /&gt;
    init_answers(@response, questions)&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Read Operation ===&lt;br /&gt;
&lt;br /&gt;
Thanks to simplification in the new Responses controller, we were able to use the Rails scaffold methods for index and show in our re-implemented controller.&lt;br /&gt;
  &lt;br /&gt;
  # GET /api/v1/responses&lt;br /&gt;
  def index&lt;br /&gt;
    @responses = Response.all&lt;br /&gt;
&lt;br /&gt;
    render json: @responses&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /api/v1/responses/1&lt;br /&gt;
  def show&lt;br /&gt;
    if @response&lt;br /&gt;
      render json: @response, status: :ok&lt;br /&gt;
    else&lt;br /&gt;
      render json: { error: 'Response not found' }, status: :not_found&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Update Operation ===&lt;br /&gt;
&lt;br /&gt;
The update and edit methods had the most change, with simple code that makes heavy use of helper functions:&lt;br /&gt;
  def edit &lt;br /&gt;
    action_params = { action: 'edit', id: params[:id], return: params[:return] }&lt;br /&gt;
    response_content = prepare_response_content(@map, params[:round], action_params)&lt;br /&gt;
    # Assign variables from response_content hash&lt;br /&gt;
    response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
    @largest_version_num  = Response.sort_by_version(@review_questions)&lt;br /&gt;
    @review_scores = @review_questions.map do |question|&lt;br /&gt;
      Answer.where(response_id: @response.response_id, question_id: question.id).first&lt;br /&gt;
    end&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This is in contrast to the legacy implementation, which integrates sorting, locking, and display ordering or responses directly in the function.&lt;br /&gt;
&lt;br /&gt;
=== Destroy Operation ===&lt;br /&gt;
&lt;br /&gt;
As our team was told to not re-implement lock functionality, the new destory operation follows the pattern given in Rails scaffold&lt;br /&gt;
&lt;br /&gt;
New:&lt;br /&gt;
  def delete&lt;br /&gt;
    if @response.delete&lt;br /&gt;
      render json: @response, status: :deleted, location: @response&lt;br /&gt;
    else&lt;br /&gt;
      render json: @response.errors, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # DELETE /api/v1/responses/1&lt;br /&gt;
  def destroy&lt;br /&gt;
    @response.destroy!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Old:&lt;br /&gt;
  def delete&lt;br /&gt;
    # The locking was added for E1973, team-based reviewing. See lock.rb for details&lt;br /&gt;
    if @map.team_reviewing_enabled&lt;br /&gt;
      @response = Lock.get_lock(@response, current_user, Lock::DEFAULT_TIMEOUT)&lt;br /&gt;
      if @response.nil?&lt;br /&gt;
        response_lock_action&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # user cannot delete other people's responses. Needs to be authenticated.&lt;br /&gt;
    map_id = @response.map.id&lt;br /&gt;
    # The lock will be automatically destroyed when the response is destroyed&lt;br /&gt;
    @response.delete&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: 'The response was deleted.'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Impact Analysis ==&lt;br /&gt;
&lt;br /&gt;
The new ResponsesController is more streamlined, easier to read, and more extensible for system improvements than the old controller. By following modern Rails standards and Expertiza standards, the new code is implemented in a clean fashion that is easier to rigorously verify and less prone to failures in future operation as the use of Expertiza shifts and grows from the original use cases.&lt;br /&gt;
&lt;br /&gt;
== Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* Improve the redirect method. Our team was not able to improve this to a sufficient level within the initial time constraints, but this method would benefit from substantial re-implementation to allow for the easy implementation of new user types and map types. &lt;br /&gt;
&lt;br /&gt;
* One test is failing because there is not a root_path set in routes. Much of the app is unimplemented at this point, so we made the decision to leave that as is for when that is eventually set. If it will not be set, another value will need to be added.&lt;br /&gt;
&lt;br /&gt;
* We feel fairly confident that the controller works with the current implementation of authentication, but a deeper understanding of how authentication and authorization are implemented could lead to further improvements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
Changed existing classes&lt;br /&gt;
* controllers/responses_controller.rb&lt;br /&gt;
* models/responses.rb&lt;br /&gt;
* models/cake.rb&lt;br /&gt;
* models/lock.rb&lt;br /&gt;
New modules&lt;br /&gt;
* response_helper.rb&lt;br /&gt;
* response_mailer.rb&lt;br /&gt;
&lt;br /&gt;
== Pull Request == &lt;br /&gt;
&lt;br /&gt;
Here is our Pull Request: https://github.com/expertiza/reimplementation-back-end/pull/165.&lt;br /&gt;
&lt;br /&gt;
==Running the Project Locally==&lt;br /&gt;
The project could be run locally by cloning the Github repository [https://github.com/ellie-not-found/reimplementation-back-end Expertiza Reimplementation] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
 bundle install&lt;br /&gt;
 rake db:create:all&lt;br /&gt;
 rake db:migrate&lt;br /&gt;
 rails server&lt;br /&gt;
&lt;br /&gt;
Tests can be run with the following:&lt;br /&gt;
&lt;br /&gt;
 rspec test spec/controllers/api/v1/responses_controller_spec.rb&lt;br /&gt;
 rspec test spec/helpers/response_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162785</id>
		<title>CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162785"/>
		<updated>2025-03-25T03:42:36Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
The ResponseController in Expertiza is responsible for handling responses to quizzes, peer reviews, and surveys. However, the current implementation has several design issues, including violations of Rails naming conventions, excessive responsibilities, and redundant logic. The goal of this project is to reimplement (not refactor) a new response_controller.rb as responses_controller.rb. This includes CRUD operations (create, read, update, delete) and the functionality previously found in the old controller, but done in a clean, modern, and conventional way&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The Responses controller currently does not follow modern idioms and the updated Expertiza style guide. It also contains too many extra pieces of logic and needs to move logic to other mailers/helpers/services/models.&lt;br /&gt;
&lt;br /&gt;
==Tasks Identified==&lt;br /&gt;
* Rename response_controller.rb to responses_controller.rb to adhere to Rails naming conventions.&lt;br /&gt;
* Limit the controller to CRUD operations, moving non-CRUD logic to models, helpers, or services.&lt;br /&gt;
* Ensure questions (items) are displayed in the correct sequence when rendering responses.&lt;br /&gt;
* Move the sorting logic from the edit method to the Response model for better organization.&lt;br /&gt;
* Rename sort_questions to sort_items for improved clarity.&lt;br /&gt;
* Use polymorphism to determine if the reviewer is a team, replacing existing if statements.&lt;br /&gt;
* Consolidate redundant parameter-setting methods (assign_action_parameters, set_content) into a single, more efficient method.&lt;br /&gt;
* Refactor questionnaire_from_response_map to simplify logic and support topic-based rubrics.&lt;br /&gt;
* Identify and remove unused (dead) methods to clean up the codebase.&lt;br /&gt;
* Extract email generation logic from the controller and move it to a dedicated helper.&lt;br /&gt;
&lt;br /&gt;
== Our Reimplementation ==&lt;br /&gt;
&lt;br /&gt;
=== Move Sorting Logic &amp;amp; Display In Correct Order ===&lt;br /&gt;
&lt;br /&gt;
Previously, the sorting logic was inside the update method of the Response controller:&lt;br /&gt;
  if @prev.present?&lt;br /&gt;
      @sorted = @review_scores.sort do |m1, m2|&lt;br /&gt;
        if m1.version_num.to_i &amp;amp;&amp;amp; m2.version_num.to_i&lt;br /&gt;
          m2.version_num.to_i &amp;lt;=&amp;gt; m1.version_num.to_i&lt;br /&gt;
        else&lt;br /&gt;
          m1.version_num ? -1 : 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @largest_version_num = @sorted[0]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the Response model:&lt;br /&gt;
&lt;br /&gt;
  # Sort responses by version number, descending&lt;br /&gt;
  def self.sort_by_version&lt;br /&gt;
    review_scores = Response.where(map_id: @map.id).to_a&lt;br /&gt;
    return [] if review_scores.empty?&lt;br /&gt;
    sorted = review_scores.sort_by { |response| response.version_num.to_i }.reverse&lt;br /&gt;
    sorted[0]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The new logic is very similar, but cleaner and available for use in other contexts.&lt;br /&gt;
&lt;br /&gt;
Similarly, sort_questions was re-implemented in ResponsesHelper:&lt;br /&gt;
  #Renamed to sort_items from sort_questions&lt;br /&gt;
  def sort_items(questions)&lt;br /&gt;
    questions.sort_by(&amp;amp;:seq)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Consolidate Parameter Setting Methods ===&lt;br /&gt;
&lt;br /&gt;
The old ResponseController had separate methods to set key Response parameters: assign_action_parameters and set_content. These methods are highly duplicative of each other and add more complexity to the code base. They are also non-CRUD methods in the controller, so we re-implemented them into one helper method: prepare_response_content&lt;br /&gt;
&lt;br /&gt;
def prepare_response_content(map, action_params = nil, new_response = false)&lt;br /&gt;
        # Set title and other initial content based on the map&lt;br /&gt;
        title = map.get_title&lt;br /&gt;
        survey_parent = nil&lt;br /&gt;
        assignment = nil&lt;br /&gt;
        participant = map.reviewer&lt;br /&gt;
        contributor = map.contributor&lt;br /&gt;
  &lt;br /&gt;
        if map.survey?&lt;br /&gt;
          survey_parent = map.survey_parent&lt;br /&gt;
        else&lt;br /&gt;
          assignment = map.assignment&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
        # Get the questionnaire and sort questions&lt;br /&gt;
        questionnaire = questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
        review_questions = Response.sort_by_version(questionnaire.questions)&lt;br /&gt;
        min = questionnaire.min_question_score&lt;br /&gt;
        max = questionnaire.max_question_score&lt;br /&gt;
&lt;br /&gt;
        # Initialize response if new_response is true&lt;br /&gt;
        response = nil&lt;br /&gt;
        if new_response&lt;br /&gt;
          response = Response.where(map_id: map.id).order(updated_at: :desc).first&lt;br /&gt;
          if response.nil?&lt;br /&gt;
            response = Response.create(map_id: map.id, additional_comment: '', is_submitted: 0)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        # Set up dropdowns or scales&lt;br /&gt;
        set_dropdown_or_scale(questionnaire, assignment)&lt;br /&gt;
        # Process the action parameters if provided&lt;br /&gt;
        if action_params&lt;br /&gt;
          case action_params[:action]&lt;br /&gt;
          when 'edit'&lt;br /&gt;
            header = 'Edit'&lt;br /&gt;
            next_action = 'update'&lt;br /&gt;
            response = Response.find(action_params[:id])&lt;br /&gt;
            contributor = map.contributor&lt;br /&gt;
          when 'new'&lt;br /&gt;
            header = 'New'&lt;br /&gt;
            next_action = 'create'&lt;br /&gt;
            feedback = action_params[:feedback]&lt;br /&gt;
            modified_object = map.id&lt;br /&gt;
          end&lt;br /&gt;
        end &lt;br /&gt;
&lt;br /&gt;
By using parameters to manage cases around the action being 'new', we were able to combine these methods into one method. This allows for one method to perform this singular function, and the final controller code can be simplified with this in mind.&lt;br /&gt;
&lt;br /&gt;
=== Refactor Questionnaire_from_response_map ===&lt;br /&gt;
&lt;br /&gt;
The old questionnaire_from_response_map method did not support topic based reviewing and resided in the controller:&lt;br /&gt;
  def questionnaire_from_response_map&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when 'ReviewResponseMap', 'SelfReviewResponseMap'&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      'MetareviewResponseMap',&lt;br /&gt;
      'TeammateReviewResponseMap',&lt;br /&gt;
      'FeedbackResponseMap',&lt;br /&gt;
      'CourseSurveyResponseMap',&lt;br /&gt;
      'AssignmentSurveyResponseMap',&lt;br /&gt;
      'GlobalSurveyResponseMap',&lt;br /&gt;
      'BookmarkRatingResponseMap'&lt;br /&gt;
      if @assignment.duty_based_assignment?&lt;br /&gt;
        # E2147 : gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        @questionnaire = @map.questionnaire_by_duty(@map.reviewee.duty_id)&lt;br /&gt;
      else&lt;br /&gt;
        @questionnaire = @map.questionnaire&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To remedy this, the method was re-implemented in the ResponsesHelper file, along with some helper methods :&lt;br /&gt;
  def questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
    if ['ReviewResponseMap', 'SelfReviewResponseMap'].include?(map.type)&lt;br /&gt;
      get_questionnaire_by_contributor(map, contributor, assignment)&lt;br /&gt;
    else&lt;br /&gt;
      get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
    end&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_contributor(map, contributor, assignment)       &lt;br /&gt;
      reviewees_topic = SignedUpTeam.find_by(team_id: contributor.id)&amp;amp;.sign_up_topic_id&lt;br /&gt;
      current_round = DueDate.next_due_date(reviewees_topic).round&lt;br /&gt;
      map.questionnaire(current_round, reviewees_topic)&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
      if assignment.duty_based_assignment?&lt;br /&gt;
        # Gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        map.questionnaire_by_duty(map.reviewee.duty_id)&lt;br /&gt;
    else&lt;br /&gt;
        map.questionnaire&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This logic is much more extendable to new implementations than the legacy logic, and easier to read and maintain than the legacy logic.&lt;br /&gt;
&lt;br /&gt;
=== Refactor toggle_permissions ===&lt;br /&gt;
toggle_permissions was updated to improve readability using the Single Responsibility principle. Below is the original code for toggle_permissions.&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    render nothing: true unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    # the response to be updated&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    # Error message placeholder&lt;br /&gt;
    error_msg = ''&lt;br /&gt;
&lt;br /&gt;
    begin&lt;br /&gt;
      @map = @response.map&lt;br /&gt;
&lt;br /&gt;
      # Updating visibility for the response object, by E2022 @SujalAhrodia --&amp;gt;&lt;br /&gt;
      visibility = params[:visibility]&lt;br /&gt;
      unless visibility.nil?&lt;br /&gt;
        @response.update_attribute('visibility', visibility)&lt;br /&gt;
      end&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      error_msg = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: @map.map_id, return: params[:return], msg: params[:msg], error_msg: error_msg&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
In the new iteration, the method was updated to use a helper method to update the visibility attribute.&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    return head :no_content unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    error = update_visibility(params[:visibility])&lt;br /&gt;
    if error == ''&lt;br /&gt;
      map_id = @response.map.map_id&lt;br /&gt;
    else&lt;br /&gt;
      map_id = nil&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: params[:msg], error_msg: error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # responses_helper.rb&lt;br /&gt;
  def update_visibility(visibility)&lt;br /&gt;
      error = &amp;quot;&amp;quot;&lt;br /&gt;
      begin&lt;br /&gt;
        unless visibility.nil?&lt;br /&gt;
          @response.update(visibility: visibility)&lt;br /&gt;
        end&lt;br /&gt;
      rescue StandardError&lt;br /&gt;
        error = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Refactor new_feedback ===&lt;br /&gt;
new_feedback was refactored using the prepare_response_content helper function to shorten the number of lines dedicated to instance assignments.&lt;br /&gt;
Previous method:&lt;br /&gt;
&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    review = Response.find(params[:id]) unless params[:id].nil?&lt;br /&gt;
    if review&lt;br /&gt;
      reviewer = AssignmentParticipant.where(user_id: session[:user].id, parent_id: review.map.assignment.id).first&lt;br /&gt;
      map = FeedbackResponseMap.where(reviewed_object_id: review.id, reviewer_id: reviewer.id).first&lt;br /&gt;
      if map.nil?&lt;br /&gt;
        # if no feedback exists by dat user den only create for dat particular response/review&lt;br /&gt;
        map = FeedbackResponseMap.create(reviewed_object_id: review.id, reviewer_id: reviewer.id, reviewee_id: review.map.reviewer.id)&lt;br /&gt;
      end&lt;br /&gt;
      redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New implementation:&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    if Response.find(params[:id])&lt;br /&gt;
      @map = Response.find(params[:id]).map&lt;br /&gt;
      response_content = prepare_response_content(@map)&lt;br /&gt;
&lt;br /&gt;
      # Assign variables from response_content hash&lt;br /&gt;
      response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
      if @response&lt;br /&gt;
        @reviewer = AssignmentParticipant.where(user_id: current_user.id, parent_id: @response.map.assignment.id).first&lt;br /&gt;
        map = find_or_create_feedback&lt;br /&gt;
        redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  #responses_helper.rb&lt;br /&gt;
  def find_or_create_feedback&lt;br /&gt;
    map = FeedbackResponseMap.where(reviewed_object_id: @response.id, reviewer_id: @reviewer.id).first&lt;br /&gt;
    if map.nil?&lt;br /&gt;
      map = FeedbackResponseMap.create(reviewed_object_id: @response.id, reviewer_id: @reviewer.id, reviewee_id: @response.map.reviewer.id)&lt;br /&gt;
    end&lt;br /&gt;
    map&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Extract email generation logic and move to model ===&lt;br /&gt;
&lt;br /&gt;
Previously, the email generation logic resided in the controller and was designed around one type of email:&lt;br /&gt;
  def send_email&lt;br /&gt;
    subject = params['send_email']['subject']&lt;br /&gt;
    body = params['send_email']['email_body']&lt;br /&gt;
    response = params['response']&lt;br /&gt;
    email = params['email']&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      if subject.blank? || body.blank?&lt;br /&gt;
        flash[:error] = 'Please fill in the subject and the email content.'&lt;br /&gt;
        format.html { redirect_to controller: 'response', action: 'author', response: response, email: email }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      else&lt;br /&gt;
        # make a call to method invoking the email process&lt;br /&gt;
        MailerHelper.send_mail_to_author_reviewers(subject, body, email)&lt;br /&gt;
        flash[:success] = 'Email sent to the author.'&lt;br /&gt;
        format.html { redirect_to controller: 'student_task', action: 'list' }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the ResponseMailer class:&lt;br /&gt;
    # Send an email to authors from a reviewer&lt;br /&gt;
    def send_response_email(response)&lt;br /&gt;
        @body = response.params[:send_email][:email_body]&lt;br /&gt;
        @subject = params[:send_email][:subject]&lt;br /&gt;
        Rails.env.development? || Rails.env.test? ? @email = 'expertiza.mailer@gmail.com' : @email = response.params[:email]&lt;br /&gt;
        mail(to: @email, body: @body, subject: @subject, content_type: 'text/html',)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
And sent in the Response model:&lt;br /&gt;
  # Send response email from reviewer to author&lt;br /&gt;
  def self.send_response_email&lt;br /&gt;
    ResponseMailer.with(response: self)&lt;br /&gt;
      .send_response_email&lt;br /&gt;
      .deliver_later&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This mailer implementation is idiomatic to modern Rails and also used in other places within the Expertiza backend re-implementation. This format makes it easy to manage the emails sent by Expertiza by isolating them and their content from the actual location in the codebase where they are sent, allowing for a clean division of responsibilities and easy future maintenance.&lt;br /&gt;
&lt;br /&gt;
=== Create Operation ===&lt;br /&gt;
&lt;br /&gt;
Using the helper methods implemented and already discussed, the code for the new and create methods is simplified:&lt;br /&gt;
  def new&lt;br /&gt;
    @map = ResponseMap.find(params[:id])&lt;br /&gt;
    attributes = prepare_response_content(map, 'New', true)&lt;br /&gt;
    attributes.each do |key, value|&lt;br /&gt;
      instance_variable_set(&amp;quot;@#{key}&amp;quot;, value)&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment&lt;br /&gt;
      @stage = @assignment.current_stage(SignedUpTeam.topic_id(@participant.parent_id, @participant.user_id))&lt;br /&gt;
    end&lt;br /&gt;
    questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    @total_score = total_cake_score&lt;br /&gt;
    init_answers(@response, questions)&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Read Operation ===&lt;br /&gt;
&lt;br /&gt;
Thanks to simplification in the new Responses controller, we were able to use the Rails scaffold methods for index and show in our re-implemented controller.&lt;br /&gt;
  &lt;br /&gt;
  # GET /api/v1/responses&lt;br /&gt;
  def index&lt;br /&gt;
    @responses = Response.all&lt;br /&gt;
&lt;br /&gt;
    render json: @responses&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /api/v1/responses/1&lt;br /&gt;
  def show&lt;br /&gt;
    if @response&lt;br /&gt;
      render json: @response, status: :ok&lt;br /&gt;
    else&lt;br /&gt;
      render json: { error: 'Response not found' }, status: :not_found&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Update Operation ===&lt;br /&gt;
&lt;br /&gt;
The update and edit methods had the most change, with simple code that makes heavy use of helper functions:&lt;br /&gt;
  def edit &lt;br /&gt;
    action_params = { action: 'edit', id: params[:id], return: params[:return] }&lt;br /&gt;
    response_content = prepare_response_content(@map, params[:round], action_params)&lt;br /&gt;
    # Assign variables from response_content hash&lt;br /&gt;
    response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
    @largest_version_num  = Response.sort_by_version(@review_questions)&lt;br /&gt;
    @review_scores = @review_questions.map do |question|&lt;br /&gt;
      Answer.where(response_id: @response.response_id, question_id: question.id).first&lt;br /&gt;
    end&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This is in contrast to the legacy implementation, which integrates sorting, locking, and display ordering or responses directly in the function.&lt;br /&gt;
&lt;br /&gt;
=== Destroy Operation ===&lt;br /&gt;
&lt;br /&gt;
As our team was told to not re-implement lock functionality, the new destory operation follows the pattern given in Rails scaffold&lt;br /&gt;
&lt;br /&gt;
New:&lt;br /&gt;
  def delete&lt;br /&gt;
    if @response.delete&lt;br /&gt;
      render json: @response, status: :deleted, location: @response&lt;br /&gt;
    else&lt;br /&gt;
      render json: @response.errors, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # DELETE /api/v1/responses/1&lt;br /&gt;
  def destroy&lt;br /&gt;
    @response.destroy!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Old:&lt;br /&gt;
  def delete&lt;br /&gt;
    # The locking was added for E1973, team-based reviewing. See lock.rb for details&lt;br /&gt;
    if @map.team_reviewing_enabled&lt;br /&gt;
      @response = Lock.get_lock(@response, current_user, Lock::DEFAULT_TIMEOUT)&lt;br /&gt;
      if @response.nil?&lt;br /&gt;
        response_lock_action&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # user cannot delete other people's responses. Needs to be authenticated.&lt;br /&gt;
    map_id = @response.map.id&lt;br /&gt;
    # The lock will be automatically destroyed when the response is destroyed&lt;br /&gt;
    @response.delete&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: 'The response was deleted.'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Impact Analysis ==&lt;br /&gt;
&lt;br /&gt;
The new ResponsesController is more streamlined, easier to read, and more extensible for system improvements than the old controller. By following modern Rails standards and Expertiza standards, the new code is implemented in a clean fashion that is easier to rigorously verify and less prone to failures in future operation as the use of Expertiza shifts and grows from the original use cases.&lt;br /&gt;
&lt;br /&gt;
== Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* Improve the redirect method. Our team was not able to improve this to a sufficient level within the initial time constraints, but this method would benefit from substantial re-implementation to allow for the easy implementation of new user types and map types. &lt;br /&gt;
&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
Changed existing classes&lt;br /&gt;
* controllers/responses_controller.rb&lt;br /&gt;
* models/responses.rb&lt;br /&gt;
* models/cake.rb&lt;br /&gt;
* models/lock.rb&lt;br /&gt;
New modules&lt;br /&gt;
* response_helper.rb&lt;br /&gt;
* response_mailer.rb&lt;br /&gt;
&lt;br /&gt;
== Pull Request == &lt;br /&gt;
&lt;br /&gt;
Here is our Pull Request: https://github.com/expertiza/reimplementation-back-end/pull/165.&lt;br /&gt;
&lt;br /&gt;
==Running the Project Locally==&lt;br /&gt;
The project could be run locally by cloning the Github repository [https://github.com/ellie-not-found/reimplementation-back-end Expertiza Reimplementation] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
 bundle install&lt;br /&gt;
 rake db:create:all&lt;br /&gt;
 rake db:migrate&lt;br /&gt;
 rails server&lt;br /&gt;
&lt;br /&gt;
Tests can be run with the following:&lt;br /&gt;
&lt;br /&gt;
 rspec test spec/controllers/api/v1/responses_controller_spec.rb&lt;br /&gt;
 rspec test spec/helpers/response_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162784</id>
		<title>CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162784"/>
		<updated>2025-03-25T03:42:13Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
The ResponseController in Expertiza is responsible for handling responses to quizzes, peer reviews, and surveys. However, the current implementation has several design issues, including violations of Rails naming conventions, excessive responsibilities, and redundant logic. The goal of this project is to reimplement (not refactor) a new response_controller.rb as responses_controller.rb. This includes CRUD operations (create, read, update, delete) and the functionality previously found in the old controller, but done in a clean, modern, and conventional way&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The Responses controller currently does not follow modern idioms and the updated Expertiza style guide. It also contains too many extra pieces of logic and needs to move logic to other mailers/helpers/services/models.&lt;br /&gt;
&lt;br /&gt;
==Tasks Identified==&lt;br /&gt;
* Rename response_controller.rb to responses_controller.rb to adhere to Rails naming conventions.&lt;br /&gt;
* Limit the controller to CRUD operations, moving non-CRUD logic to models, helpers, or services.&lt;br /&gt;
* Ensure questions (items) are displayed in the correct sequence when rendering responses.&lt;br /&gt;
* Move the sorting logic from the edit method to the Response model for better organization.&lt;br /&gt;
* Rename sort_questions to sort_items for improved clarity.&lt;br /&gt;
* Use polymorphism to determine if the reviewer is a team, replacing existing if statements.&lt;br /&gt;
* Consolidate redundant parameter-setting methods (assign_action_parameters, set_content) into a single, more efficient method.&lt;br /&gt;
* Refactor questionnaire_from_response_map to simplify logic and support topic-based rubrics.&lt;br /&gt;
* Identify and remove unused (dead) methods to clean up the codebase.&lt;br /&gt;
* Extract email generation logic from the controller and move it to a dedicated helper.&lt;br /&gt;
&lt;br /&gt;
== Our Reimplementation ==&lt;br /&gt;
&lt;br /&gt;
=== Move Sorting Logic &amp;amp; Display In Correct Order ===&lt;br /&gt;
&lt;br /&gt;
Previously, the sorting logic was inside the update method of the Response controller:&lt;br /&gt;
  if @prev.present?&lt;br /&gt;
      @sorted = @review_scores.sort do |m1, m2|&lt;br /&gt;
        if m1.version_num.to_i &amp;amp;&amp;amp; m2.version_num.to_i&lt;br /&gt;
          m2.version_num.to_i &amp;lt;=&amp;gt; m1.version_num.to_i&lt;br /&gt;
        else&lt;br /&gt;
          m1.version_num ? -1 : 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @largest_version_num = @sorted[0]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the Response model:&lt;br /&gt;
&lt;br /&gt;
  # Sort responses by version number, descending&lt;br /&gt;
  def self.sort_by_version&lt;br /&gt;
    review_scores = Response.where(map_id: @map.id).to_a&lt;br /&gt;
    return [] if review_scores.empty?&lt;br /&gt;
    sorted = review_scores.sort_by { |response| response.version_num.to_i }.reverse&lt;br /&gt;
    sorted[0]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The new logic is very similar, but cleaner and available for use in other contexts.&lt;br /&gt;
&lt;br /&gt;
Similarly, sort_questions was re-implemented in ResponsesHelper:&lt;br /&gt;
  #Renamed to sort_items from sort_questions&lt;br /&gt;
  def sort_items(questions)&lt;br /&gt;
    questions.sort_by(&amp;amp;:seq)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Consolidate Parameter Setting Methods ===&lt;br /&gt;
&lt;br /&gt;
The old ResponseController had separate methods to set key Response parameters: assign_action_parameters and set_content. These methods are highly duplicative of each other and add more complexity to the code base. They are also non-CRUD methods in the controller, so we re-implemented them into one helper method: prepare_response_content&lt;br /&gt;
&lt;br /&gt;
def prepare_response_content(map, action_params = nil, new_response = false)&lt;br /&gt;
        # Set title and other initial content based on the map&lt;br /&gt;
        title = map.get_title&lt;br /&gt;
        survey_parent = nil&lt;br /&gt;
        assignment = nil&lt;br /&gt;
        participant = map.reviewer&lt;br /&gt;
        contributor = map.contributor&lt;br /&gt;
  &lt;br /&gt;
        if map.survey?&lt;br /&gt;
          survey_parent = map.survey_parent&lt;br /&gt;
        else&lt;br /&gt;
          assignment = map.assignment&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
        # Get the questionnaire and sort questions&lt;br /&gt;
        questionnaire = questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
        review_questions = Response.sort_by_version(questionnaire.questions)&lt;br /&gt;
        min = questionnaire.min_question_score&lt;br /&gt;
        max = questionnaire.max_question_score&lt;br /&gt;
&lt;br /&gt;
        # Initialize response if new_response is true&lt;br /&gt;
        response = nil&lt;br /&gt;
        if new_response&lt;br /&gt;
          response = Response.where(map_id: map.id).order(updated_at: :desc).first&lt;br /&gt;
          if response.nil?&lt;br /&gt;
            response = Response.create(map_id: map.id, additional_comment: '', is_submitted: 0)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        # Set up dropdowns or scales&lt;br /&gt;
        set_dropdown_or_scale(questionnaire, assignment)&lt;br /&gt;
        # Process the action parameters if provided&lt;br /&gt;
        if action_params&lt;br /&gt;
          case action_params[:action]&lt;br /&gt;
          when 'edit'&lt;br /&gt;
            header = 'Edit'&lt;br /&gt;
            next_action = 'update'&lt;br /&gt;
            response = Response.find(action_params[:id])&lt;br /&gt;
            contributor = map.contributor&lt;br /&gt;
          when 'new'&lt;br /&gt;
            header = 'New'&lt;br /&gt;
            next_action = 'create'&lt;br /&gt;
            feedback = action_params[:feedback]&lt;br /&gt;
            modified_object = map.id&lt;br /&gt;
          end&lt;br /&gt;
        end &lt;br /&gt;
&lt;br /&gt;
By using parameters to manage cases around the action being 'new', we were able to combine these methods into one method. This allows for one method to perform this singular function, and the final controller code can be simplified with this in mind.&lt;br /&gt;
&lt;br /&gt;
=== Refactor Questionnaire_from_response_map ===&lt;br /&gt;
&lt;br /&gt;
The old questionnaire_from_response_map method did not support topic based reviewing and resided in the controller:&lt;br /&gt;
  def questionnaire_from_response_map&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when 'ReviewResponseMap', 'SelfReviewResponseMap'&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      'MetareviewResponseMap',&lt;br /&gt;
      'TeammateReviewResponseMap',&lt;br /&gt;
      'FeedbackResponseMap',&lt;br /&gt;
      'CourseSurveyResponseMap',&lt;br /&gt;
      'AssignmentSurveyResponseMap',&lt;br /&gt;
      'GlobalSurveyResponseMap',&lt;br /&gt;
      'BookmarkRatingResponseMap'&lt;br /&gt;
      if @assignment.duty_based_assignment?&lt;br /&gt;
        # E2147 : gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        @questionnaire = @map.questionnaire_by_duty(@map.reviewee.duty_id)&lt;br /&gt;
      else&lt;br /&gt;
        @questionnaire = @map.questionnaire&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To remedy this, the method was re-implemented in the ResponsesHelper file, along with some helper methods :&lt;br /&gt;
  def questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
    if ['ReviewResponseMap', 'SelfReviewResponseMap'].include?(map.type)&lt;br /&gt;
      get_questionnaire_by_contributor(map, contributor, assignment)&lt;br /&gt;
    else&lt;br /&gt;
      get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
    end&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_contributor(map, contributor, assignment)       &lt;br /&gt;
      reviewees_topic = SignedUpTeam.find_by(team_id: contributor.id)&amp;amp;.sign_up_topic_id&lt;br /&gt;
      current_round = DueDate.next_due_date(reviewees_topic).round&lt;br /&gt;
      map.questionnaire(current_round, reviewees_topic)&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
      if assignment.duty_based_assignment?&lt;br /&gt;
        # Gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        map.questionnaire_by_duty(map.reviewee.duty_id)&lt;br /&gt;
    else&lt;br /&gt;
        map.questionnaire&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This logic is much more extendable to new implementations than the legacy logic, and easier to read and maintain than the legacy logic.&lt;br /&gt;
&lt;br /&gt;
=== Refactor toggle_permissions ===&lt;br /&gt;
toggle_permissions was updated to improve readability using the Single Responsibility principle. Below is the original code for toggle_permissions.&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    render nothing: true unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    # the response to be updated&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    # Error message placeholder&lt;br /&gt;
    error_msg = ''&lt;br /&gt;
&lt;br /&gt;
    begin&lt;br /&gt;
      @map = @response.map&lt;br /&gt;
&lt;br /&gt;
      # Updating visibility for the response object, by E2022 @SujalAhrodia --&amp;gt;&lt;br /&gt;
      visibility = params[:visibility]&lt;br /&gt;
      unless visibility.nil?&lt;br /&gt;
        @response.update_attribute('visibility', visibility)&lt;br /&gt;
      end&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      error_msg = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: @map.map_id, return: params[:return], msg: params[:msg], error_msg: error_msg&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
In the new iteration, the method was updated to use a helper method to update the visibility attribute.&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    return head :no_content unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    error = update_visibility(params[:visibility])&lt;br /&gt;
    if error == ''&lt;br /&gt;
      map_id = @response.map.map_id&lt;br /&gt;
    else&lt;br /&gt;
      map_id = nil&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: params[:msg], error_msg: error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # responses_helper.rb&lt;br /&gt;
  def update_visibility(visibility)&lt;br /&gt;
      error = &amp;quot;&amp;quot;&lt;br /&gt;
      begin&lt;br /&gt;
        unless visibility.nil?&lt;br /&gt;
          @response.update(visibility: visibility)&lt;br /&gt;
        end&lt;br /&gt;
      rescue StandardError&lt;br /&gt;
        error = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Refactor new_feedback ===&lt;br /&gt;
new_feedback was refactored using the prepare_response_content helper function to shorten the number of lines dedicated to instance assignments.&lt;br /&gt;
Previous method:&lt;br /&gt;
&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    review = Response.find(params[:id]) unless params[:id].nil?&lt;br /&gt;
    if review&lt;br /&gt;
      reviewer = AssignmentParticipant.where(user_id: session[:user].id, parent_id: review.map.assignment.id).first&lt;br /&gt;
      map = FeedbackResponseMap.where(reviewed_object_id: review.id, reviewer_id: reviewer.id).first&lt;br /&gt;
      if map.nil?&lt;br /&gt;
        # if no feedback exists by dat user den only create for dat particular response/review&lt;br /&gt;
        map = FeedbackResponseMap.create(reviewed_object_id: review.id, reviewer_id: reviewer.id, reviewee_id: review.map.reviewer.id)&lt;br /&gt;
      end&lt;br /&gt;
      redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New implementation:&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    if Response.find(params[:id])&lt;br /&gt;
      @map = Response.find(params[:id]).map&lt;br /&gt;
      response_content = prepare_response_content(@map)&lt;br /&gt;
&lt;br /&gt;
      # Assign variables from response_content hash&lt;br /&gt;
      response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
      if @response&lt;br /&gt;
        @reviewer = AssignmentParticipant.where(user_id: current_user.id, parent_id: @response.map.assignment.id).first&lt;br /&gt;
        map = find_or_create_feedback&lt;br /&gt;
        redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  #responses_helper.rb&lt;br /&gt;
  def find_or_create_feedback&lt;br /&gt;
    map = FeedbackResponseMap.where(reviewed_object_id: @response.id, reviewer_id: @reviewer.id).first&lt;br /&gt;
    if map.nil?&lt;br /&gt;
      map = FeedbackResponseMap.create(reviewed_object_id: @response.id, reviewer_id: @reviewer.id, reviewee_id: @response.map.reviewer.id)&lt;br /&gt;
    end&lt;br /&gt;
    map&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Extract email generation logic and move to model ===&lt;br /&gt;
&lt;br /&gt;
Previously, the email generation logic resided in the controller and was designed around one type of email:&lt;br /&gt;
  def send_email&lt;br /&gt;
    subject = params['send_email']['subject']&lt;br /&gt;
    body = params['send_email']['email_body']&lt;br /&gt;
    response = params['response']&lt;br /&gt;
    email = params['email']&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      if subject.blank? || body.blank?&lt;br /&gt;
        flash[:error] = 'Please fill in the subject and the email content.'&lt;br /&gt;
        format.html { redirect_to controller: 'response', action: 'author', response: response, email: email }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      else&lt;br /&gt;
        # make a call to method invoking the email process&lt;br /&gt;
        MailerHelper.send_mail_to_author_reviewers(subject, body, email)&lt;br /&gt;
        flash[:success] = 'Email sent to the author.'&lt;br /&gt;
        format.html { redirect_to controller: 'student_task', action: 'list' }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the ResponseMailer class:&lt;br /&gt;
    # Send an email to authors from a reviewer&lt;br /&gt;
    def send_response_email(response)&lt;br /&gt;
        @body = response.params[:send_email][:email_body]&lt;br /&gt;
        @subject = params[:send_email][:subject]&lt;br /&gt;
        Rails.env.development? || Rails.env.test? ? @email = 'expertiza.mailer@gmail.com' : @email = response.params[:email]&lt;br /&gt;
        mail(to: @email, body: @body, subject: @subject, content_type: 'text/html',)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
And sent in the Response model:&lt;br /&gt;
  # Send response email from reviewer to author&lt;br /&gt;
  def self.send_response_email&lt;br /&gt;
    ResponseMailer.with(response: self)&lt;br /&gt;
      .send_response_email&lt;br /&gt;
      .deliver_later&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This mailer implementation is idiomatic to modern Rails and also used in other places within the Expertiza backend re-implementation. This format makes it easy to manage the emails sent by Expertiza by isolating them and their content from the actual location in the codebase where they are sent, allowing for a clean division of responsibilities and easy future maintenance.&lt;br /&gt;
&lt;br /&gt;
=== Create Operation ===&lt;br /&gt;
&lt;br /&gt;
Using the helper methods implemented and already discussed, the code for the new and create methods is simplified:&lt;br /&gt;
  def new&lt;br /&gt;
    @map = ResponseMap.find(params[:id])&lt;br /&gt;
    attributes = prepare_response_content(map, 'New', true)&lt;br /&gt;
    attributes.each do |key, value|&lt;br /&gt;
      instance_variable_set(&amp;quot;@#{key}&amp;quot;, value)&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment&lt;br /&gt;
      @stage = @assignment.current_stage(SignedUpTeam.topic_id(@participant.parent_id, @participant.user_id))&lt;br /&gt;
    end&lt;br /&gt;
    questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    @total_score = total_cake_score&lt;br /&gt;
    init_answers(@response, questions)&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Read Operation ===&lt;br /&gt;
&lt;br /&gt;
Thanks to simplification in the new Responses controller, we were able to use the Rails scaffold methods for index and show in our re-implemented controller.&lt;br /&gt;
  &lt;br /&gt;
  # GET /api/v1/responses&lt;br /&gt;
  def index&lt;br /&gt;
    @responses = Response.all&lt;br /&gt;
&lt;br /&gt;
    render json: @responses&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /api/v1/responses/1&lt;br /&gt;
  def show&lt;br /&gt;
    if @response&lt;br /&gt;
      render json: @response, status: :ok&lt;br /&gt;
    else&lt;br /&gt;
      render json: { error: 'Response not found' }, status: :not_found&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Update Operation ===&lt;br /&gt;
&lt;br /&gt;
The update and edit methods had the most change, with simple code that makes heavy use of helper functions:&lt;br /&gt;
  def edit &lt;br /&gt;
    action_params = { action: 'edit', id: params[:id], return: params[:return] }&lt;br /&gt;
    response_content = prepare_response_content(@map, params[:round], action_params)&lt;br /&gt;
    # Assign variables from response_content hash&lt;br /&gt;
    response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
    @largest_version_num  = Response.sort_by_version(@review_questions)&lt;br /&gt;
    @review_scores = @review_questions.map do |question|&lt;br /&gt;
      Answer.where(response_id: @response.response_id, question_id: question.id).first&lt;br /&gt;
    end&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This is in contrast to the legacy implementation, which integrates sorting, locking, and display ordering or responses directly in the function.&lt;br /&gt;
&lt;br /&gt;
=== Destroy Operation ===&lt;br /&gt;
&lt;br /&gt;
As our team was told to not re-implement lock functionality, the new destory operation follows the pattern given in Rails scaffold&lt;br /&gt;
&lt;br /&gt;
New:&lt;br /&gt;
  def delete&lt;br /&gt;
    if @response.delete&lt;br /&gt;
      render json: @response, status: :deleted, location: @response&lt;br /&gt;
    else&lt;br /&gt;
      render json: @response.errors, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # DELETE /api/v1/responses/1&lt;br /&gt;
  def destroy&lt;br /&gt;
    @response.destroy!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Old:&lt;br /&gt;
  def delete&lt;br /&gt;
    # The locking was added for E1973, team-based reviewing. See lock.rb for details&lt;br /&gt;
    if @map.team_reviewing_enabled&lt;br /&gt;
      @response = Lock.get_lock(@response, current_user, Lock::DEFAULT_TIMEOUT)&lt;br /&gt;
      if @response.nil?&lt;br /&gt;
        response_lock_action&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # user cannot delete other people's responses. Needs to be authenticated.&lt;br /&gt;
    map_id = @response.map.id&lt;br /&gt;
    # The lock will be automatically destroyed when the response is destroyed&lt;br /&gt;
    @response.delete&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: 'The response was deleted.'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Impact Analysis ==&lt;br /&gt;
&lt;br /&gt;
The new ResponsesController is more streamlined, easier to read, and more extensible for system improvements than the old controller. By following modern Rails standards and Expertiza standards, the new code is implemented in a clean fashion that is easier to rigorously verify and less prone to failures in future operation as the use of Expertiza shifts and grows from the original use cases.&lt;br /&gt;
&lt;br /&gt;
== Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* Improve the redirect method. Our team was not able to improve this to a sufficient level within the initial time constraints, but this method would benefit from substantial re-implementation to allow for the easy implementation of new user types and map types. &lt;br /&gt;
&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
Changed existing classes&lt;br /&gt;
* controllers/responses_controller.rb&lt;br /&gt;
* models/responses.rb&lt;br /&gt;
* models/cake.rb&lt;br /&gt;
* models/lock.rb&lt;br /&gt;
New modules&lt;br /&gt;
* response_helper.rb&lt;br /&gt;
* response_mailer.rb&lt;br /&gt;
&lt;br /&gt;
== Pull Request == &lt;br /&gt;
&lt;br /&gt;
Here is our Pull Request: https://github.com/expertiza/reimplementation-back-end/pull/165.&lt;br /&gt;
&lt;br /&gt;
==Running the Project Locally==&lt;br /&gt;
The project could be run locally by cloning the Github repository [https://github.com/ellie-not-found/reimplementation-back-end Expertiza Reimplementation] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
 bundle install&lt;br /&gt;
 rake db:create:all&lt;br /&gt;
 rake db:migrate&lt;br /&gt;
 rails server&lt;br /&gt;
&lt;br /&gt;
Tests can be run with the following:&lt;br /&gt;
&lt;br /&gt;
 rspec test spec/controllers/api/v1/responses_controller_spec.rb&lt;br /&gt;
 rspec test spec/helpers/response_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;br /&gt;
&lt;br /&gt;
We were unable to get a working copy of the redirect method in time, so we included the existing. It is still written in the old style and can be rewritten using new helpers. Additionally, one test is failing because there is not a root_path set in routes. Much of the app is unimplemented at this point, so we made the decision to leave that as is for when that is eventually set. If it will not be set, another value will need to be added.&lt;br /&gt;
&lt;br /&gt;
We feel fairly confident that the controller works with the current implementation of authentication, but a deeper understanding of how authentication and authorization are implemented could lead to further improvements.&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162781</id>
		<title>CSC/ECE 517 Spring 2025 - E2512. Reimplement responses controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2512._Reimplement_responses_controller&amp;diff=162781"/>
		<updated>2025-03-25T03:39:00Z</updated>

		<summary type="html">&lt;p&gt;Dchrist2: /* Running the Project Locally */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
The ResponseController in Expertiza is responsible for handling responses to quizzes, peer reviews, and surveys. However, the current implementation has several design issues, including violations of Rails naming conventions, excessive responsibilities, and redundant logic. The goal of this project is to reimplement (not refactor) a new response_controller.rb as responses_controller.rb. This includes CRUD operations (create, read, update, delete) and the functionality previously found in the old controller, but done in a clean, modern, and conventional way&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
The Responses controller currently does not follow modern idioms and the updated Expertiza style guide. It also contains too many extra pieces of logic and needs to move logic to other mailers/helpers/services/models.&lt;br /&gt;
&lt;br /&gt;
==Tasks Identified==&lt;br /&gt;
* Rename response_controller.rb to responses_controller.rb to adhere to Rails naming conventions.&lt;br /&gt;
* Limit the controller to CRUD operations, moving non-CRUD logic to models, helpers, or services.&lt;br /&gt;
* Ensure questions (items) are displayed in the correct sequence when rendering responses.&lt;br /&gt;
* Move the sorting logic from the edit method to the Response model for better organization.&lt;br /&gt;
* Rename sort_questions to sort_items for improved clarity.&lt;br /&gt;
* Use polymorphism to determine if the reviewer is a team, replacing existing if statements.&lt;br /&gt;
* Consolidate redundant parameter-setting methods (assign_action_parameters, set_content) into a single, more efficient method.&lt;br /&gt;
* Refactor questionnaire_from_response_map to simplify logic and support topic-based rubrics.&lt;br /&gt;
* Identify and remove unused (dead) methods to clean up the codebase.&lt;br /&gt;
* Extract email generation logic from the controller and move it to a dedicated helper.&lt;br /&gt;
&lt;br /&gt;
== Our Reimplementation ==&lt;br /&gt;
&lt;br /&gt;
=== Move Sorting Logic &amp;amp; Display In Correct Order ===&lt;br /&gt;
&lt;br /&gt;
Previously, the sorting logic was inside the update method of the Response controller:&lt;br /&gt;
  if @prev.present?&lt;br /&gt;
      @sorted = @review_scores.sort do |m1, m2|&lt;br /&gt;
        if m1.version_num.to_i &amp;amp;&amp;amp; m2.version_num.to_i&lt;br /&gt;
          m2.version_num.to_i &amp;lt;=&amp;gt; m1.version_num.to_i&lt;br /&gt;
        else&lt;br /&gt;
          m1.version_num ? -1 : 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      @largest_version_num = @sorted[0]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the Response model:&lt;br /&gt;
&lt;br /&gt;
  # Sort responses by version number, descending&lt;br /&gt;
  def self.sort_by_version&lt;br /&gt;
    review_scores = Response.where(map_id: @map.id).to_a&lt;br /&gt;
    return [] if review_scores.empty?&lt;br /&gt;
    sorted = review_scores.sort_by { |response| response.version_num.to_i }.reverse&lt;br /&gt;
    sorted[0]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The new logic is very similar, but cleaner and available for use in other contexts.&lt;br /&gt;
&lt;br /&gt;
Similarly, sort_questions was re-implemented in ResponsesHelper:&lt;br /&gt;
  #Renamed to sort_items from sort_questions&lt;br /&gt;
  def sort_items(questions)&lt;br /&gt;
    questions.sort_by(&amp;amp;:seq)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Consolidate Parameter Setting Methods ===&lt;br /&gt;
&lt;br /&gt;
The old ResponseController had separate methods to set key Response parameters: assign_action_parameters and set_content. These methods are highly duplicative of each other and add more complexity to the code base. They are also non-CRUD methods in the controller, so we re-implemented them into one helper method: prepare_response_content&lt;br /&gt;
&lt;br /&gt;
def prepare_response_content(map, action_params = nil, new_response = false)&lt;br /&gt;
        # Set title and other initial content based on the map&lt;br /&gt;
        title = map.get_title&lt;br /&gt;
        survey_parent = nil&lt;br /&gt;
        assignment = nil&lt;br /&gt;
        participant = map.reviewer&lt;br /&gt;
        contributor = map.contributor&lt;br /&gt;
  &lt;br /&gt;
        if map.survey?&lt;br /&gt;
          survey_parent = map.survey_parent&lt;br /&gt;
        else&lt;br /&gt;
          assignment = map.assignment&lt;br /&gt;
        end&lt;br /&gt;
  &lt;br /&gt;
        # Get the questionnaire and sort questions&lt;br /&gt;
        questionnaire = questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
        review_questions = Response.sort_by_version(questionnaire.questions)&lt;br /&gt;
        min = questionnaire.min_question_score&lt;br /&gt;
        max = questionnaire.max_question_score&lt;br /&gt;
&lt;br /&gt;
        # Initialize response if new_response is true&lt;br /&gt;
        response = nil&lt;br /&gt;
        if new_response&lt;br /&gt;
          response = Response.where(map_id: map.id).order(updated_at: :desc).first&lt;br /&gt;
          if response.nil?&lt;br /&gt;
            response = Response.create(map_id: map.id, additional_comment: '', is_submitted: 0)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        # Set up dropdowns or scales&lt;br /&gt;
        set_dropdown_or_scale(questionnaire, assignment)&lt;br /&gt;
        # Process the action parameters if provided&lt;br /&gt;
        if action_params&lt;br /&gt;
          case action_params[:action]&lt;br /&gt;
          when 'edit'&lt;br /&gt;
            header = 'Edit'&lt;br /&gt;
            next_action = 'update'&lt;br /&gt;
            response = Response.find(action_params[:id])&lt;br /&gt;
            contributor = map.contributor&lt;br /&gt;
          when 'new'&lt;br /&gt;
            header = 'New'&lt;br /&gt;
            next_action = 'create'&lt;br /&gt;
            feedback = action_params[:feedback]&lt;br /&gt;
            modified_object = map.id&lt;br /&gt;
          end&lt;br /&gt;
        end &lt;br /&gt;
&lt;br /&gt;
By using parameters to manage cases around the action being 'new', we were able to combine these methods into one method. This allows for one method to perform this singular function, and the final controller code can be simplified with this in mind.&lt;br /&gt;
&lt;br /&gt;
=== Refactor Questionnaire_from_response_map ===&lt;br /&gt;
&lt;br /&gt;
The old questionnaire_from_response_map method did not support topic based reviewing and resided in the controller:&lt;br /&gt;
  def questionnaire_from_response_map&lt;br /&gt;
    case @map.type&lt;br /&gt;
    when 'ReviewResponseMap', 'SelfReviewResponseMap'&lt;br /&gt;
      reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
      @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
      @questionnaire = @map.questionnaire(@current_round, reviewees_topic)&lt;br /&gt;
    when&lt;br /&gt;
      'MetareviewResponseMap',&lt;br /&gt;
      'TeammateReviewResponseMap',&lt;br /&gt;
      'FeedbackResponseMap',&lt;br /&gt;
      'CourseSurveyResponseMap',&lt;br /&gt;
      'AssignmentSurveyResponseMap',&lt;br /&gt;
      'GlobalSurveyResponseMap',&lt;br /&gt;
      'BookmarkRatingResponseMap'&lt;br /&gt;
      if @assignment.duty_based_assignment?&lt;br /&gt;
        # E2147 : gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        @questionnaire = @map.questionnaire_by_duty(@map.reviewee.duty_id)&lt;br /&gt;
      else&lt;br /&gt;
        @questionnaire = @map.questionnaire&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
To remedy this, the method was re-implemented in the ResponsesHelper file, along with some helper methods :&lt;br /&gt;
  def questionnaire_from_response_map(map, contributor, assignment)&lt;br /&gt;
    if ['ReviewResponseMap', 'SelfReviewResponseMap'].include?(map.type)&lt;br /&gt;
      get_questionnaire_by_contributor(map, contributor, assignment)&lt;br /&gt;
    else&lt;br /&gt;
      get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
    end&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_contributor(map, contributor, assignment)       &lt;br /&gt;
      reviewees_topic = SignedUpTeam.find_by(team_id: contributor.id)&amp;amp;.sign_up_topic_id&lt;br /&gt;
      current_round = DueDate.next_due_date(reviewees_topic).round&lt;br /&gt;
      map.questionnaire(current_round, reviewees_topic)&lt;br /&gt;
    end&lt;br /&gt;
    def get_questionnaire_by_duty(map, assignment)&lt;br /&gt;
      if assignment.duty_based_assignment?&lt;br /&gt;
        # Gets questionnaire of a particular duty in that assignment rather than generic questionnaire&lt;br /&gt;
        map.questionnaire_by_duty(map.reviewee.duty_id)&lt;br /&gt;
    else&lt;br /&gt;
        map.questionnaire&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This logic is much more extendable to new implementations than the legacy logic, and easier to read and maintain than the legacy logic.&lt;br /&gt;
&lt;br /&gt;
=== Refactor toggle_permissions ===&lt;br /&gt;
toggle_permissions was updated to improve readability using the Single Responsibility principle. Below is the original code for toggle_permissions.&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    render nothing: true unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    # the response to be updated&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    # Error message placeholder&lt;br /&gt;
    error_msg = ''&lt;br /&gt;
&lt;br /&gt;
    begin&lt;br /&gt;
      @map = @response.map&lt;br /&gt;
&lt;br /&gt;
      # Updating visibility for the response object, by E2022 @SujalAhrodia --&amp;gt;&lt;br /&gt;
      visibility = params[:visibility]&lt;br /&gt;
      unless visibility.nil?&lt;br /&gt;
        @response.update_attribute('visibility', visibility)&lt;br /&gt;
      end&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      error_msg = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: @map.map_id, return: params[:return], msg: params[:msg], error_msg: error_msg&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
In the new iteration, the method was updated to use a helper method to update the visibility attribute.&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def toggle_permission&lt;br /&gt;
    return head :no_content unless action_allowed?&lt;br /&gt;
&lt;br /&gt;
    error = update_visibility(params[:visibility])&lt;br /&gt;
    if error == ''&lt;br /&gt;
      map_id = @response.map.map_id&lt;br /&gt;
    else&lt;br /&gt;
      map_id = nil&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: params[:msg], error_msg: error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # responses_helper.rb&lt;br /&gt;
  def update_visibility(visibility)&lt;br /&gt;
      error = &amp;quot;&amp;quot;&lt;br /&gt;
      begin&lt;br /&gt;
        unless visibility.nil?&lt;br /&gt;
          @response.update(visibility: visibility)&lt;br /&gt;
        end&lt;br /&gt;
      rescue StandardError&lt;br /&gt;
        error = &amp;quot;Your response was not saved. Cause:189 #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      error&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Refactor new_feedback ===&lt;br /&gt;
new_feedback was refactored using the prepare_response_content helper function to shorten the number of lines dedicated to instance assignments.&lt;br /&gt;
Previous method:&lt;br /&gt;
&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    review = Response.find(params[:id]) unless params[:id].nil?&lt;br /&gt;
    if review&lt;br /&gt;
      reviewer = AssignmentParticipant.where(user_id: session[:user].id, parent_id: review.map.assignment.id).first&lt;br /&gt;
      map = FeedbackResponseMap.where(reviewed_object_id: review.id, reviewer_id: reviewer.id).first&lt;br /&gt;
      if map.nil?&lt;br /&gt;
        # if no feedback exists by dat user den only create for dat particular response/review&lt;br /&gt;
        map = FeedbackResponseMap.create(reviewed_object_id: review.id, reviewer_id: reviewer.id, reviewee_id: review.map.reviewer.id)&lt;br /&gt;
      end&lt;br /&gt;
      redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
New implementation:&lt;br /&gt;
&lt;br /&gt;
  # responses_controller.rb&lt;br /&gt;
  def new_feedback&lt;br /&gt;
    if Response.find(params[:id])&lt;br /&gt;
      @map = Response.find(params[:id]).map&lt;br /&gt;
      response_content = prepare_response_content(@map)&lt;br /&gt;
&lt;br /&gt;
      # Assign variables from response_content hash&lt;br /&gt;
      response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
      if @response&lt;br /&gt;
        @reviewer = AssignmentParticipant.where(user_id: current_user.id, parent_id: @response.map.assignment.id).first&lt;br /&gt;
        map = find_or_create_feedback&lt;br /&gt;
        redirect_to action: 'new', id: map.id, return: 'feedback'&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      redirect_back fallback_location: root_path&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  #responses_helper.rb&lt;br /&gt;
  def find_or_create_feedback&lt;br /&gt;
    map = FeedbackResponseMap.where(reviewed_object_id: @response.id, reviewer_id: @reviewer.id).first&lt;br /&gt;
    if map.nil?&lt;br /&gt;
      map = FeedbackResponseMap.create(reviewed_object_id: @response.id, reviewer_id: @reviewer.id, reviewee_id: @response.map.reviewer.id)&lt;br /&gt;
    end&lt;br /&gt;
    map&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Extract email generation logic and move to model ===&lt;br /&gt;
&lt;br /&gt;
Previously, the email generation logic resided in the controller and was designed around one type of email:&lt;br /&gt;
  def send_email&lt;br /&gt;
    subject = params['send_email']['subject']&lt;br /&gt;
    body = params['send_email']['email_body']&lt;br /&gt;
    response = params['response']&lt;br /&gt;
    email = params['email']&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      if subject.blank? || body.blank?&lt;br /&gt;
        flash[:error] = 'Please fill in the subject and the email content.'&lt;br /&gt;
        format.html { redirect_to controller: 'response', action: 'author', response: response, email: email }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      else&lt;br /&gt;
        # make a call to method invoking the email process&lt;br /&gt;
        MailerHelper.send_mail_to_author_reviewers(subject, body, email)&lt;br /&gt;
        flash[:success] = 'Email sent to the author.'&lt;br /&gt;
        format.html { redirect_to controller: 'student_task', action: 'list' }&lt;br /&gt;
        format.json { head :no_content }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This was re-implemented in the ResponseMailer class:&lt;br /&gt;
    # Send an email to authors from a reviewer&lt;br /&gt;
    def send_response_email(response)&lt;br /&gt;
        @body = response.params[:send_email][:email_body]&lt;br /&gt;
        @subject = params[:send_email][:subject]&lt;br /&gt;
        Rails.env.development? || Rails.env.test? ? @email = 'expertiza.mailer@gmail.com' : @email = response.params[:email]&lt;br /&gt;
        mail(to: @email, body: @body, subject: @subject, content_type: 'text/html',)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
And sent in the Response model:&lt;br /&gt;
  # Send response email from reviewer to author&lt;br /&gt;
  def self.send_response_email&lt;br /&gt;
    ResponseMailer.with(response: self)&lt;br /&gt;
      .send_response_email&lt;br /&gt;
      .deliver_later&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This mailer implementation is idiomatic to modern Rails and also used in other places within the Expertiza backend re-implementation. This format makes it easy to manage the emails sent by Expertiza by isolating them and their content from the actual location in the codebase where they are sent, allowing for a clean division of responsibilities and easy future maintenance.&lt;br /&gt;
&lt;br /&gt;
=== Create Operation ===&lt;br /&gt;
&lt;br /&gt;
Using the helper methods implemented and already discussed, the code for the new and create methods is simplified:&lt;br /&gt;
  def new&lt;br /&gt;
    @map = ResponseMap.find(params[:id])&lt;br /&gt;
    attributes = prepare_response_content(map, 'New', true)&lt;br /&gt;
    attributes.each do |key, value|&lt;br /&gt;
      instance_variable_set(&amp;quot;@#{key}&amp;quot;, value)&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment&lt;br /&gt;
      @stage = @assignment.current_stage(SignedUpTeam.topic_id(@participant.parent_id, @participant.user_id))&lt;br /&gt;
    end&lt;br /&gt;
    questions = sort_questions(@questionnaire.questions)&lt;br /&gt;
    @total_score = total_cake_score&lt;br /&gt;
    init_answers(@response, questions)&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Read Operation ===&lt;br /&gt;
&lt;br /&gt;
Thanks to simplification in the new Responses controller, we were able to use the Rails scaffold methods for index and show in our re-implemented controller.&lt;br /&gt;
  &lt;br /&gt;
  # GET /api/v1/responses&lt;br /&gt;
  def index&lt;br /&gt;
    @responses = Response.all&lt;br /&gt;
&lt;br /&gt;
    render json: @responses&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /api/v1/responses/1&lt;br /&gt;
  def show&lt;br /&gt;
    if @response&lt;br /&gt;
      render json: @response, status: :ok&lt;br /&gt;
    else&lt;br /&gt;
      render json: { error: 'Response not found' }, status: :not_found&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Update Operation ===&lt;br /&gt;
&lt;br /&gt;
The update and edit methods had the most change, with simple code that makes heavy use of helper functions:&lt;br /&gt;
  def edit &lt;br /&gt;
    action_params = { action: 'edit', id: params[:id], return: params[:return] }&lt;br /&gt;
    response_content = prepare_response_content(@map, params[:round], action_params)&lt;br /&gt;
    # Assign variables from response_content hash&lt;br /&gt;
    response_content.each { |key, value| instance_variable_set(&amp;quot;@#{key}&amp;quot;, value) }&lt;br /&gt;
    @largest_version_num  = Response.sort_by_version(@review_questions)&lt;br /&gt;
    @review_scores = @review_questions.map do |question|&lt;br /&gt;
      Answer.where(response_id: @response.response_id, question_id: question.id).first&lt;br /&gt;
    end&lt;br /&gt;
    render action: 'response'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
This is in contrast to the legacy implementation, which integrates sorting, locking, and display ordering or responses directly in the function.&lt;br /&gt;
&lt;br /&gt;
=== Destroy Operation ===&lt;br /&gt;
&lt;br /&gt;
As our team was told to not re-implement lock functionality, the new destory operation follows the pattern given in Rails scaffold&lt;br /&gt;
&lt;br /&gt;
New:&lt;br /&gt;
  def delete&lt;br /&gt;
    if @response.delete&lt;br /&gt;
      render json: @response, status: :deleted, location: @response&lt;br /&gt;
    else&lt;br /&gt;
      render json: @response.errors, status: :unprocessable_entity&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # DELETE /api/v1/responses/1&lt;br /&gt;
  def destroy&lt;br /&gt;
    @response.destroy!&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Old:&lt;br /&gt;
  def delete&lt;br /&gt;
    # The locking was added for E1973, team-based reviewing. See lock.rb for details&lt;br /&gt;
    if @map.team_reviewing_enabled&lt;br /&gt;
      @response = Lock.get_lock(@response, current_user, Lock::DEFAULT_TIMEOUT)&lt;br /&gt;
      if @response.nil?&lt;br /&gt;
        response_lock_action&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # user cannot delete other people's responses. Needs to be authenticated.&lt;br /&gt;
    map_id = @response.map.id&lt;br /&gt;
    # The lock will be automatically destroyed when the response is destroyed&lt;br /&gt;
    @response.delete&lt;br /&gt;
    redirect_to action: 'redirect', id: map_id, return: params[:return], msg: 'The response was deleted.'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Impact Analysis ==&lt;br /&gt;
&lt;br /&gt;
The new ResponsesController is more streamlined, easier to read, and more extensible for system improvements than the old controller. By following modern Rails standards and Expertiza standards, the new code is implemented in a clean fashion that is easier to rigorously verify and less prone to failures in future operation as the use of Expertiza shifts and grows from the original use cases.&lt;br /&gt;
&lt;br /&gt;
== Future Improvements ==&lt;br /&gt;
&lt;br /&gt;
* Improve the redirect method. Our team was not able to improve this to a sufficient level within the initial time constraints, but this method would benefit from substantial re-implementation to allow for the easy implementation of new user types and map types. &lt;br /&gt;
&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Affected Classes===&lt;br /&gt;
Changed existing classes&lt;br /&gt;
* controllers/responses_controller.rb&lt;br /&gt;
* models/responses.rb&lt;br /&gt;
* models/cake.rb&lt;br /&gt;
* models/lock.rb&lt;br /&gt;
New modules&lt;br /&gt;
* response_helper.rb&lt;br /&gt;
* response_mailer.rb&lt;br /&gt;
&lt;br /&gt;
== Pull Request == &lt;br /&gt;
&lt;br /&gt;
Here is our Pull Request: https://github.com/expertiza/reimplementation-back-end/pull/165.&lt;br /&gt;
&lt;br /&gt;
==Running the Project Locally==&lt;br /&gt;
The project could be run locally by cloning the Github repository [https://github.com/ellie-not-found/reimplementation-back-end Expertiza Reimplementation] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
 bundle install&lt;br /&gt;
 rake db:create:all&lt;br /&gt;
 rake db:migrate&lt;br /&gt;
 rails server&lt;br /&gt;
&lt;br /&gt;
Tests can be run with the following:&lt;br /&gt;
&lt;br /&gt;
 rspec test spec/controllers/api/v1/responses_controller_spec.rb&lt;br /&gt;
 rspec test spec/helpers/response_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
==Future Work==&lt;/div&gt;</summary>
		<author><name>Dchrist2</name></author>
	</entry>
</feed>