<?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=Cpalang</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=Cpalang"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Cpalang"/>
	<updated>2026-07-21T05:55:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152026</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152026"/>
		<updated>2023-12-03T18:21:52Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Relevant Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of '''review_mapping_controller''' is to map the reviewer to an assignment. Basically, the controller handles the assignment of reviews to different teams or individual student users, covering scenarios like peer reviews and self-reviews. Additionally, the controller plays a crucial role in handling requests from student users, facilitating extra bonus reviews in alignment with the assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Fix two identified major bugs.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
*Add Tests as provided in test skeletons.&lt;br /&gt;
&lt;br /&gt;
We have worked rigorously in Phase 1 on refactoring the same controller. Documentation for the same can be found [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb here].&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
During the code refactoring process, we conscientiously followed various design patterns to enhance the overall structure. One of the most common ones is the “Extract Method.” There were several instances where certain methods became overly lengthy and intricate. By extracting specific functionalities into separate methods, we significantly improved the code's readability and comprehension. This way, it became easier and clearer to understand what the method achieved. Furthermore, we tackled the issue of excessive conditional statements by employing the &amp;quot;Refactoring Conditionals&amp;quot; design pattern. This approach involves isolating the block of code within a conditional statement into a distinct method and subsequently invoking that method. This strategic refactoring not only streamlined our code but also contributed to a more readable and maintainable codebase.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2. &amp;lt;code&amp;gt;review_mapping_controller_spec.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Changes can be seen in the pull request created [https://github.com/expertiza/expertiza/pull/2657/files here].&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Refactor &amp;lt;code&amp;gt;peer_review_strategy&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; file'''&lt;br /&gt;
&lt;br /&gt;
The method was split into smaller functions specifically isolating the code for handling strategy for the last team in the list.&lt;br /&gt;
&lt;br /&gt;
[[File:Peer_review_last_team.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Bug fix regarding in-progress reviews for a participant'''&lt;br /&gt;
&lt;br /&gt;
Changes made to &amp;lt;code&amp;gt;check_outstanding_reviews &amp;lt;/code&amp;gt; method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:Check_outstanding_bug_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Bug fix regarding Assign Reviewer Button'''&lt;br /&gt;
&lt;br /&gt;
Bug Description:&lt;br /&gt;
When a user tries to click on the 'Assign Reviewers' button without having completed the creation of assignment the following error occurs - &lt;br /&gt;
&lt;br /&gt;
[[File:BugDesc.png|500px]]&lt;br /&gt;
[[File:BugError.png|500px]]&lt;br /&gt;
&lt;br /&gt;
This error indicates that an assignment needs to be instantiated and only then can reviewers be added to this assignment.&lt;br /&gt;
The &amp;lt;code&amp;gt;list_mapping&amp;lt;/code&amp;gt; method displays all participants eligible as reviewers for a particular assignment. To this method we added a check to confirm if an assignment existed.  &lt;br /&gt;
&lt;br /&gt;
[[File:List mapping bug 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
If not, the user is redirected to the assignment creation page with the following error message -&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix.png|750px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Test Cases Addition'''&lt;br /&gt;
&lt;br /&gt;
The major focus during this phase was on adding tests and making the &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; controller fail-proof. By the end of this phase we were able to incorporate the majority of tests provided in the Test Skeleton.&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
=== Test Plan, Testing Strategy and Results===&lt;br /&gt;
In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to '''utilize Mustafa Olmez's meticulously crafted test skeletons'''. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. '''By incorporating 48 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.''' This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&lt;br /&gt;
The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have '''increased the overall coverage from 47.65% to 47.86%'''.&lt;br /&gt;
The changes made passed all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Plan_Coverage_result.png|750px]]&lt;br /&gt;
&lt;br /&gt;
===SimpleCov Coverage Detail Report of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Tests prior to the changes covered 69.65 % of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Old_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After adding tests, the tests covered 69.76 % of refactored &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;. It improved slightly to be an even better coverage.&lt;br /&gt;
[[File:New_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/amit-99/NCSU_OODD_expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2657&lt;br /&gt;
* '''VCL Server:''' http://152.7.177.207:8080/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152021</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152021"/>
		<updated>2023-12-03T17:39:00Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of '''review_mapping_controller''' is to map the reviewer to an assignment. Basically, the controller handles the assignment of reviews to different teams or individual student users, covering scenarios like peer reviews and self-reviews. Additionally, the controller plays a crucial role in handling requests from student users, facilitating extra bonus reviews in alignment with the assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Fix two identified major bugs.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
*Add Tests as provided in test skeletons.&lt;br /&gt;
&lt;br /&gt;
We have worked rigorously in Phase 1 on refactoring the same controller. Documentation for the same can be found [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb here].&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
During the code refactoring process, we conscientiously followed various design patterns to enhance the overall structure. One of the most common ones is the “Extract Method.” There were several instances where certain methods became overly lengthy and intricate. By extracting specific functionalities into separate methods, we significantly improved the code's readability and comprehension. This way, it became easier and clearer to understand what the method achieved. Furthermore, we tackled the issue of excessive conditional statements by employing the &amp;quot;Refactoring Conditionals&amp;quot; design pattern. This approach involves isolating the block of code within a conditional statement into a distinct method and subsequently invoking that method. This strategic refactoring not only streamlined our code but also contributed to a more readable and maintainable codebase.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2. &amp;lt;code&amp;gt;review_mapping_controller_spec.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Changes can be seen in the pull request created [https://github.com/expertiza/expertiza/pull/2657/files here].&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Refactor &amp;lt;code&amp;gt;peer_review_strategy&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; file'''&lt;br /&gt;
&lt;br /&gt;
The method was split into smaller functions specifically isolating the code for handling strategy for the last team in the list.&lt;br /&gt;
&lt;br /&gt;
[[File:Peer_review_last_team.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Bug fix regarding in-progress reviews for a participant'''&lt;br /&gt;
&lt;br /&gt;
Changes made to &amp;lt;code&amp;gt;check_outstanding_reviews &amp;lt;/code&amp;gt; method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:Check_outstanding_bug_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Bug fix regarding Assign Reviewer Button'''&lt;br /&gt;
&lt;br /&gt;
Bug Description:&lt;br /&gt;
When a user tries to click on the 'Assign Reviewers' button without having completed the creation of assignment the following error occurs - &lt;br /&gt;
&lt;br /&gt;
[[File:BugDesc.png|500px]]&lt;br /&gt;
[[File:BugError.png|500px]]&lt;br /&gt;
&lt;br /&gt;
This error indicates that an assignment needs to be instantiated and only then can reviewers be added to this assignment.&lt;br /&gt;
The &amp;lt;code&amp;gt;list_mapping&amp;lt;/code&amp;gt; method displays all participants eligible as reviewers for a particular assignment. To this method we added a check to confirm if an assignment existed.  &lt;br /&gt;
&lt;br /&gt;
[[File:List mapping bug 2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
If not, the user is redirected to the assignment creation page with the following error message -&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix.png|750px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Test Cases Addition'''&lt;br /&gt;
&lt;br /&gt;
The major focus during this phase was on adding tests and making the &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; controller fail-proof. By the end of this phase we were able to incorporate the majority of tests provided in the Test Skeleton.&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
=== Test Plan, Testing Strategy and Results===&lt;br /&gt;
In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to '''utilize Mustafa Olmez's meticulously crafted test skeletons'''. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. '''By incorporating 48 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.''' This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&lt;br /&gt;
The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have '''increased the overall coverage from 47.65% to 47.86%'''.&lt;br /&gt;
The changes made passed all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Plan_Coverage_result.png|750px]]&lt;br /&gt;
&lt;br /&gt;
===SimpleCov Coverage Detail Report of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Tests prior to the changes covered 69.65 % of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Old_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After adding tests, the tests covered 69.76 % of refactored &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;. It improved slightly to be an even better coverage.&lt;br /&gt;
[[File:New_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/amit-99/NCSU_OODD_expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2657&lt;br /&gt;
* '''VCL Server:''' http://152.7.178.252:8080/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152020</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152020"/>
		<updated>2023-12-03T17:35:36Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of '''review_mapping_controller''' is to map the reviewer to an assignment. Basically, the controller handles the assignment of reviews to different teams or individual student users, covering scenarios like peer reviews and self-reviews. Additionally, the controller plays a crucial role in handling requests from student users, facilitating extra bonus reviews in alignment with the assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Fix two identified major bugs.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
*Add Tests as provided in test skeletons.&lt;br /&gt;
&lt;br /&gt;
We have worked rigorously in Phase 1 on refactoring the same controller. Documentation for the same can be found [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb here].&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
During the code refactoring process, we conscientiously followed various design patterns to enhance the overall structure. One of the most common ones is the “Extract Method.” There were several instances where certain methods became overly lengthy and intricate. By extracting specific functionalities into separate methods, we significantly improved the code's readability and comprehension. This way, it became easier and clearer to understand what the method achieved. Furthermore, we tackled the issue of excessive conditional statements by employing the &amp;quot;Refactoring Conditionals&amp;quot; design pattern. This approach involves isolating the block of code within a conditional statement into a distinct method and subsequently invoking that method. This strategic refactoring not only streamlined our code but also contributed to a more readable and maintainable codebase.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2. &amp;lt;code&amp;gt;review_mapping_controller_spec.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Changes can be seen in the pull request created [https://github.com/expertiza/expertiza/pull/2657/files here].&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Refactor &amp;lt;code&amp;gt;peer_review_strategy&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; file'''&lt;br /&gt;
&lt;br /&gt;
The method was split into smaller functions specifically isolating the code for handling strategy for the last team in the list.&lt;br /&gt;
&lt;br /&gt;
[[File:Peer_review_last_team.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Bug fix regarding in-progress reviews for a participant'''&lt;br /&gt;
&lt;br /&gt;
Changes made to &amp;lt;code&amp;gt;check_outstanding_reviews &amp;lt;/code&amp;gt; method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:Check_outstanding_bug_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Bug fix regarding Assign Reviewer Button'''&lt;br /&gt;
&lt;br /&gt;
Bug Description:&lt;br /&gt;
When a user tries to click on the 'Assign Reviewers' button without having completed the creation of assignment the following error occurs - &lt;br /&gt;
[[File:BugDesc.png|1000px]]&lt;br /&gt;
[[File:BugError.png|1000px]]&lt;br /&gt;
This error indicates that an assignment needs to be instantiated and only then can reviewers be added to this assignment.&lt;br /&gt;
The &amp;lt;code&amp;gt;list_mapping&amp;lt;/code&amp;gt; method displays all participants eligible as reviewers for a particular assignment. To this method we added a check to confirm if an assignment existed.  &lt;br /&gt;
[[File:List mapping bug 2.png|1000px]]&lt;br /&gt;
If not, the user is redirected to the assignment creation page with the following message -&lt;br /&gt;
[[File:BugFix.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Test Cases Addition'''&lt;br /&gt;
&lt;br /&gt;
The major focus during this phase was on adding tests and making the &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; controller fail-proof. By the end of this phase we were able to incorporate the majority of tests provided in the Test Skeleton.&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
=== Test Plan, Testing Strategy and Results===&lt;br /&gt;
In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to '''utilize Mustafa Olmez's meticulously crafted test skeletons'''. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. '''By incorporating 48 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.''' This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&lt;br /&gt;
The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have '''increased the overall coverage from 47.65% to 47.86%'''.&lt;br /&gt;
The changes made passed all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Plan_Coverage_result.png|750px]]&lt;br /&gt;
&lt;br /&gt;
===SimpleCov Coverage Detail Report of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Tests prior to the changes covered 69.65 % of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Old_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After adding tests, the tests covered 69.76 % of refactored &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;. It improved slightly to be an even better coverage.&lt;br /&gt;
[[File:New_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/amit-99/NCSU_OODD_expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2657&lt;br /&gt;
* '''VCL Server:''' http://152.7.178.252:8080/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:BugFix.png&amp;diff=152019</id>
		<title>File:BugFix.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:BugFix.png&amp;diff=152019"/>
		<updated>2023-12-03T17:34:59Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:BugError.png&amp;diff=152018</id>
		<title>File:BugError.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:BugError.png&amp;diff=152018"/>
		<updated>2023-12-03T17:31:03Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:BugDesc.png&amp;diff=152017</id>
		<title>File:BugDesc.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:BugDesc.png&amp;diff=152017"/>
		<updated>2023-12-03T17:30:18Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152016</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb_(Phase_2)&amp;diff=152016"/>
		<updated>2023-12-03T17:28:51Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of '''review_mapping_controller''' is to map the reviewer to an assignment. Basically, the controller handles the assignment of reviews to different teams or individual student users, covering scenarios like peer reviews and self-reviews. Additionally, the controller plays a crucial role in handling requests from student users, facilitating extra bonus reviews in alignment with the assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Fix two identified major bugs.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
*Add Tests as provided in test skeletons.&lt;br /&gt;
&lt;br /&gt;
We have worked rigorously in Phase 1 on refactoring the same controller. Documentation for the same can be found [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb here].&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
During the code refactoring process, we conscientiously followed various design patterns to enhance the overall structure. One of the most common ones is the “Extract Method.” There were several instances where certain methods became overly lengthy and intricate. By extracting specific functionalities into separate methods, we significantly improved the code's readability and comprehension. This way, it became easier and clearer to understand what the method achieved. Furthermore, we tackled the issue of excessive conditional statements by employing the &amp;quot;Refactoring Conditionals&amp;quot; design pattern. This approach involves isolating the block of code within a conditional statement into a distinct method and subsequently invoking that method. This strategic refactoring not only streamlined our code but also contributed to a more readable and maintainable codebase.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2. &amp;lt;code&amp;gt;review_mapping_controller_spec.rb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Changes can be seen in the pull request created [https://github.com/expertiza/expertiza/pull/2657/files here].&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Refactor &amp;lt;code&amp;gt;peer_review_strategy&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; file'''&lt;br /&gt;
&lt;br /&gt;
The method was split into smaller functions specifically isolating the code for handling strategy for the last team in the list.&lt;br /&gt;
&lt;br /&gt;
[[File:Peer_review_last_team.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Bug fix regarding in-progress reviews for a participant'''&lt;br /&gt;
&lt;br /&gt;
Changes made to &amp;lt;code&amp;gt;check_outstanding_reviews &amp;lt;/code&amp;gt; method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:Check_outstanding_bug_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Bug fix regarding Assign Reviewer Button'''&lt;br /&gt;
&lt;br /&gt;
Bug Description:&lt;br /&gt;
&amp;lt;insert getbug image&amp;gt;&lt;br /&gt;
When a user tries to click on the 'Assign Reviewers' button without having completed the creation of assignment the following error occurs - &lt;br /&gt;
&amp;lt;insert errorimage&amp;gt;&lt;br /&gt;
This error indicates that an assignment needs to be instantiated and only then can reviewers be added to this assignment.&lt;br /&gt;
The list_mapping method displays all participants eligible as reviewers for a particular assignment. To this method we added a check to confirm if an assignment existed.  &lt;br /&gt;
[[File:List mapping bug 2.png|1000px]]&lt;br /&gt;
If not, the user is redirected to the assignment creation page with the following message -&lt;br /&gt;
&amp;lt;insert fixedimage&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''4. Test Cases Addition'''&lt;br /&gt;
&lt;br /&gt;
The major focus during this phase was on adding tests and making the &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt; controller fail-proof. By the end of this phase we were able to incorporate the majority of tests provided in the Test Skeleton.&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
=== Test Plan, Testing Strategy and Results===&lt;br /&gt;
In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to '''utilize Mustafa Olmez's meticulously crafted test skeletons'''. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. '''By incorporating 48 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.''' This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:&lt;br /&gt;
&lt;br /&gt;
https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&lt;br /&gt;
The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have '''increased the overall coverage from 47.65% to 47.86%'''.&lt;br /&gt;
The changes made passed all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Plan_Coverage_result.png|750px]]&lt;br /&gt;
&lt;br /&gt;
===SimpleCov Coverage Detail Report of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Tests prior to the changes covered 69.65 % of &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Old_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After adding tests, the tests covered 69.76 % of refactored &amp;lt;code&amp;gt;review_mapping_controller.rb&amp;lt;/code&amp;gt;. It improved slightly to be an even better coverage.&lt;br /&gt;
[[File:New_coverage_report_simplecov.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/amit-99/NCSU_OODD_expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2657&lt;br /&gt;
* '''VCL Server:''' http://152.7.178.252:8080/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151185</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151185"/>
		<updated>2023-11-06T21:48:22Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. '''By incorporating 20 of these meticulously designed test skeletons into our work''' , we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test1ReviewMapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151166</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151166"/>
		<updated>2023-11-06T15:38:42Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test1ReviewMapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151165</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151165"/>
		<updated>2023-11-06T15:38:16Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test1ReviewMapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151164</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151164"/>
		<updated>2023-11-06T15:37:27Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[Test1ReviewMapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test1ReviewMapping.png&amp;diff=151163</id>
		<title>File:Test1ReviewMapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test1ReviewMapping.png&amp;diff=151163"/>
		<updated>2023-11-06T15:37:12Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151162</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151162"/>
		<updated>2023-11-06T15:33:29Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151161</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151161"/>
		<updated>2023-11-06T15:32:54Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151160</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151160"/>
		<updated>2023-11-06T15:30:08Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Bug Fixes'''&lt;br /&gt;
Changes made to '''check_outstanding_reviews''' method to return the correct results. Previously if all the reviews were completed by a participant, the method returned true (num_reviews_in_progress = 0), which would not be the right output. This is fixed by ensuring a return value of true only if num_reviews_in_progress &amp;gt; 0.&lt;br /&gt;
[[File:BugFix1ReviewMapingController.png]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:BugFix1ReviewMapingController.png&amp;diff=151159</id>
		<title>File:BugFix1ReviewMapingController.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:BugFix1ReviewMapingController.png&amp;diff=151159"/>
		<updated>2023-11-06T15:27:05Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151158</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151158"/>
		<updated>2023-11-06T15:25:49Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis CI/CD Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151157</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151157"/>
		<updated>2023-11-06T15:25:31Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151156</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151156"/>
		<updated>2023-11-06T15:25:19Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary Travis Pipeline tests.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151155</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151155"/>
		<updated>2023-11-06T15:24:40Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151154</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151154"/>
		<updated>2023-11-06T15:21:25Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necessary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151153</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151153"/>
		<updated>2023-11-06T15:19:14Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151152</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151152"/>
		<updated>2023-11-06T15:07:08Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|750px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151151</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151151"/>
		<updated>2023-11-06T15:05:17Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151150</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151150"/>
		<updated>2023-11-06T15:02:52Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
Elaborate commenting has been performed for every method present in the review_mapping_comtroller. A few examples include:&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
v) Describe functionality of '''delete_reviewer''', '''delete_metareviewer''', '''delete_metareview''', and several other functions.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan==&lt;br /&gt;
&amp;lt;nowiki&amp;gt;In the realm of Test-Driven Development (TDD) research, our team made the strategic decision to utilize Mustafa Olmez's meticulously crafted test skeletons. These skeletons provided us with invaluable guidance, outlining the essential tests required for our unit. By incorporating 20 of these meticulously designed test skeletons into our work, we were able to conduct rigorous testing of our controller module.&lt;br /&gt;
&lt;br /&gt;
This approach allowed us to delve deeply into the functionality of our controller, ensuring thorough examination and validation of its behavior. The integration of these test skeletons not only provided a robust framework for our unit tests but also enhanced the overall quality and reliability of our codebase.&lt;br /&gt;
&lt;br /&gt;
For a detailed view of the changes made, please refer to the complete file at the following link:  &amp;lt;/nowiki&amp;gt; &amp;lt;br&amp;gt;https://github.com/expertiza/expertiza/pull/2657/files#diff-bccc23eb7ba2a55b74837eed3f4c85aa1d8c55d356ce0e0bc7de7afd50121b13&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;The additional tests ensure every method of review_mapping_controller is tested. By adopting this approach we have increased the coverage from 47.65% to 47.8%. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Comment3_review_mapping.png&amp;diff=151149</id>
		<title>File:Comment3 review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Comment3_review_mapping.png&amp;diff=151149"/>
		<updated>2023-11-06T15:02:34Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Comment1_review_mapping.png&amp;diff=151148</id>
		<title>File:Comment1 review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Comment1_review_mapping.png&amp;diff=151148"/>
		<updated>2023-11-06T15:00:48Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Comment4_review_mapping.png&amp;diff=151147</id>
		<title>File:Comment4 review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Comment4_review_mapping.png&amp;diff=151147"/>
		<updated>2023-11-06T14:59:35Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151031</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151031"/>
		<updated>2023-10-31T04:19:04Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
viii) Dividing long peer_review_strategy method in smaller modular functions&lt;br /&gt;
[[File:3_Peer_Review_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_2.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_3.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:3_Peer_Review_4.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
Making changes in peer_review_strategy method to make the code look inline with other parts&lt;br /&gt;
[[File:4_1.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|200px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151022</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151022"/>
		<updated>2023-10-31T04:11:37Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151021</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151021"/>
		<updated>2023-10-31T04:11:17Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151020</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151020"/>
		<updated>2023-10-31T04:09:24Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the '''automatic_review_mapping''' method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called '''handle_review_assignment''' which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declarations for the '''automatic_review_mapping''' are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151018</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151018"/>
		<updated>2023-10-31T04:06:24Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
'''1. Changes to variable names to make them reflect what they actually do.'''&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''2. Added/Edited comments to improve the readability of code and make commenting proper.'''&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.'''&lt;br /&gt;
&lt;br /&gt;
Changes were made to the automatic_review_mapping method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called handle_review_assignment which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''4. Reshuffling parts of code to make the method look consistent and easy to read and understand'''&lt;br /&gt;
&lt;br /&gt;
The declaration of the automatic_review_mapping are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
'''5. Test Report'''&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151016</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=151016"/>
		<updated>2023-10-31T04:05:46Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from '''mmappings''' to '''meta_review_mappings''' to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Used '''assignment_id''' which is declared before, instead of hardcoding '''params[:id].to_i&lt;br /&gt;
'''&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of '''add_calibration''' method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of '''automatic_review_mapping'''&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of '''assign_reviewer_dynamically''' in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function '''review_allowed?''' better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
&lt;br /&gt;
Changes were made to the automatic_review_mapping method, keeping the single responsibilty principle in mind.&lt;br /&gt;
&lt;br /&gt;
i) Modularized the functionality of previous version in a private method called handle_review_assignment which checks conditions to proceed with assigning reviewers to artifacts. &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
ii) Different components of the method are now encapsulated in their respective private functions &lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
''NOTE:'' Private functions are used to increase maintainability of the codebase since these do not break already existing test suites.&lt;br /&gt;
&lt;br /&gt;
vi)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_with_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
vii)&lt;br /&gt;
&lt;br /&gt;
[[File:Assign_reviewer_without_topic.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
The declaration of the automatic_review_mapping are grouped together for better readability.&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
5. Test Report&lt;br /&gt;
&lt;br /&gt;
The changes made pass all the necsaary RSpec test scripts&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150972</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150972"/>
		<updated>2023-10-31T03:32:27Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from mmappings to meta_review_mappings to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Used assignment_id which is declared before, instead of hardcoding params[:id].to_i&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of add_calibration method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of automatic_review_mapping&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of assign_reviewer_dynamically in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function review_allowed? better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
&lt;br /&gt;
i) &lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii)&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iii)&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iv)&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
v)&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
5. Test Report&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The naming inconsistency issue has already been fixed by the previous version of the project. It has been verified by us.&lt;br /&gt;
&lt;br /&gt;
2. Refactoring the Update method&lt;br /&gt;
&lt;br /&gt;
'''Before refactoring'''&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After refactoring'''&lt;br /&gt;
 def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.update_attributes(topic_identifier: params[:topic][:topic_identifier], category: params[:topic][:category],&lt;br /&gt;
      topic_name: params[:topic][:topic_name], micropayment: params[:topic][:micropayment], description: params[:topic][:description],link:params[:topic][:link] )&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
      flash[:success] = 'The topic has been updated.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. &lt;br /&gt;
&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
5. signup_as_instructor_action is used to sign up a student for a particular topic for an assignment as an instructor. signup_as_instructor function does nothing. It is an empty function. The function is not being called anywhere in the code. The method is not needed and hence removed.&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor_action '''&lt;br /&gt;
&lt;br /&gt;
  def signup_as_instructor_action&lt;br /&gt;
    user = User.find_by(name: params[:username])&lt;br /&gt;
    if user.nil? # validate invalid user&lt;br /&gt;
      flash[:error] = 'That student does not exist!'&lt;br /&gt;
    else&lt;br /&gt;
      if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]&lt;br /&gt;
        if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])&lt;br /&gt;
          flash[:success] = 'You have successfully signed up the student for the topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor signed up student for topic: ' + params[:topic_id].to_s)&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = 'The student has already signed up for a topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor is signing up a student who already has a topic')&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = 'The student is not registered for the assignment!'&lt;br /&gt;
        ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'The student is not registered for the assignment: ' &amp;lt;&amp;lt; user.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor function'''&lt;br /&gt;
&lt;br /&gt;
 def signup_as_instructor; end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6.&lt;br /&gt;
&lt;br /&gt;
7.&lt;br /&gt;
&lt;br /&gt;
8.&lt;br /&gt;
&lt;br /&gt;
9. Delete_signup and delete_signup_as_instructor violate the DRY principle. Refactored this. Created a new private function handle_signup_deletion to handle deletion for both instructor as well as student. A new function, check_signup_eligibility, generates the error message that the topic cannot be dropped. The redirect_path function is used to redirect the user.&lt;br /&gt;
&lt;br /&gt;
'''Before Refactoring Delete_signup and delete_signup_as_instructor'''&lt;br /&gt;
&lt;br /&gt;
 def delete_signup&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    # A student who has already submitted work should not be allowed to drop his/her topic!&lt;br /&gt;
    # (A student/team has submitted if participant directory_num is non-null or submitted_hyperlinks is non-null.)&lt;br /&gt;
    # If there is no drop topic deadline, student can drop topic at any time (if all the submissions are deleted)&lt;br /&gt;
    # If there is a drop topic deadline, student cannot drop topic after this deadline.&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for already submitted a work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], session[:user].id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped your topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].id, 'Student has dropped the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    # find participant using assignment using team and topic ids&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'The student has already submitted their work, so you are not allowed to remove them.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for already submitted work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop a student after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the student from the topic!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Student has been dropped from the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After Refactoring Delete_signup and delete_signup_as_instructor'''    &lt;br /&gt;
  def delete_signup&lt;br /&gt;
    handle_signup_deletion(params[:id], session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    handle_signup_deletion(user.id, session[:user].id, assignment.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private def handle_signup_deletion(participant_id, user_id, assignment_id = nil)&lt;br /&gt;
    participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    assignment ||= participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    error_message = check_signup_eligibility(participant.team, drop_topic_deadline, user_id, params[:topic_id])&lt;br /&gt;
    if error_message&lt;br /&gt;
      flash[:error] = error_message&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, &amp;quot;Drop failed for #{error_message}: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, user_id, &amp;quot;Student has dropped the topic: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to redirect_path(participant_id, assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def check_signup_eligibility(team, drop_topic_deadline, user_id, topic_id)&lt;br /&gt;
    if !team.submitted_files.empty? || !team.hyperlinks.empty?&lt;br /&gt;
      'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def redirect_path(participant_id, assignment_id)&lt;br /&gt;
    if assignment_id&lt;br /&gt;
      controller: 'assignments', action: 'edit', id: assignment_id&lt;br /&gt;
    else&lt;br /&gt;
      action: 'list', id: participant_id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
10.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150969</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150969"/>
		<updated>2023-10-31T03:30:47Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from mmappings to meta_review_mappings to provide more context.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Used assignment_id which is declared before, instead of hardcoding params[:id].to_i&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
&lt;br /&gt;
a) Adding comments&lt;br /&gt;
&lt;br /&gt;
i) Explains the functionality of add_calibration method in a simple manner.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Inform that an assignment can have multiple topics which need to be taken care of.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iii) Explains the functionality of automatic_review_mapping&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iv) Describes an error encountered in the stable version of Expertiza, and suggests potential fix.&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
&lt;br /&gt;
i) Describes the working of assign_reviewer_dynamically in a concise manner &lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Explains the function review_allowed? better, the previous comment was too repetitive.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
iii) Precisely mentions the criteria for requesting reviews by the user.&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
&lt;br /&gt;
Comments about previous teams progress and other redundant comments were removed to improve readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png]]&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png]]&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png]]&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
5. Test Report&lt;br /&gt;
&lt;br /&gt;
[[File:Test_report_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The naming inconsistency issue has already been fixed by the previous version of the project. It has been verified by us.&lt;br /&gt;
&lt;br /&gt;
2. Refactoring the Update method&lt;br /&gt;
&lt;br /&gt;
'''Before refactoring'''&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After refactoring'''&lt;br /&gt;
 def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.update_attributes(topic_identifier: params[:topic][:topic_identifier], category: params[:topic][:category],&lt;br /&gt;
      topic_name: params[:topic][:topic_name], micropayment: params[:topic][:micropayment], description: params[:topic][:description],link:params[:topic][:link] )&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
      flash[:success] = 'The topic has been updated.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. &lt;br /&gt;
&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
5. signup_as_instructor_action is used to sign up a student for a particular topic for an assignment as an instructor. signup_as_instructor function does nothing. It is an empty function. The function is not being called anywhere in the code. The method is not needed and hence removed.&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor_action '''&lt;br /&gt;
&lt;br /&gt;
  def signup_as_instructor_action&lt;br /&gt;
    user = User.find_by(name: params[:username])&lt;br /&gt;
    if user.nil? # validate invalid user&lt;br /&gt;
      flash[:error] = 'That student does not exist!'&lt;br /&gt;
    else&lt;br /&gt;
      if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]&lt;br /&gt;
        if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])&lt;br /&gt;
          flash[:success] = 'You have successfully signed up the student for the topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor signed up student for topic: ' + params[:topic_id].to_s)&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = 'The student has already signed up for a topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor is signing up a student who already has a topic')&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = 'The student is not registered for the assignment!'&lt;br /&gt;
        ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'The student is not registered for the assignment: ' &amp;lt;&amp;lt; user.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor function'''&lt;br /&gt;
&lt;br /&gt;
 def signup_as_instructor; end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6.&lt;br /&gt;
&lt;br /&gt;
7.&lt;br /&gt;
&lt;br /&gt;
8.&lt;br /&gt;
&lt;br /&gt;
9. Delete_signup and delete_signup_as_instructor violate the DRY principle. Refactored this. Created a new private function handle_signup_deletion to handle deletion for both instructor as well as student. A new function, check_signup_eligibility, generates the error message that the topic cannot be dropped. The redirect_path function is used to redirect the user.&lt;br /&gt;
&lt;br /&gt;
'''Before Refactoring Delete_signup and delete_signup_as_instructor'''&lt;br /&gt;
&lt;br /&gt;
 def delete_signup&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    # A student who has already submitted work should not be allowed to drop his/her topic!&lt;br /&gt;
    # (A student/team has submitted if participant directory_num is non-null or submitted_hyperlinks is non-null.)&lt;br /&gt;
    # If there is no drop topic deadline, student can drop topic at any time (if all the submissions are deleted)&lt;br /&gt;
    # If there is a drop topic deadline, student cannot drop topic after this deadline.&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for already submitted a work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], session[:user].id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped your topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].id, 'Student has dropped the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    # find participant using assignment using team and topic ids&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'The student has already submitted their work, so you are not allowed to remove them.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for already submitted work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop a student after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the student from the topic!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Student has been dropped from the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After Refactoring Delete_signup and delete_signup_as_instructor'''    &lt;br /&gt;
  def delete_signup&lt;br /&gt;
    handle_signup_deletion(params[:id], session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    handle_signup_deletion(user.id, session[:user].id, assignment.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private def handle_signup_deletion(participant_id, user_id, assignment_id = nil)&lt;br /&gt;
    participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    assignment ||= participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    error_message = check_signup_eligibility(participant.team, drop_topic_deadline, user_id, params[:topic_id])&lt;br /&gt;
    if error_message&lt;br /&gt;
      flash[:error] = error_message&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, &amp;quot;Drop failed for #{error_message}: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, user_id, &amp;quot;Student has dropped the topic: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to redirect_path(participant_id, assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def check_signup_eligibility(team, drop_topic_deadline, user_id, topic_id)&lt;br /&gt;
    if !team.submitted_files.empty? || !team.hyperlinks.empty?&lt;br /&gt;
      'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def redirect_path(participant_id, assignment_id)&lt;br /&gt;
    if assignment_id&lt;br /&gt;
      controller: 'assignments', action: 'edit', id: assignment_id&lt;br /&gt;
    else&lt;br /&gt;
      action: 'list', id: participant_id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
10.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150939</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150939"/>
		<updated>2023-10-31T03:18:44Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
i) Changed variable name from mmappings to meta_review_mappings to provide more context.&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
ii) Used assignment_id which is declared before, instead of hardcoding params[:id].to_i&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
a) Adding comments&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
5. Test Report&lt;br /&gt;
[[File:Test_report_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The naming inconsistency issue has already been fixed by the previous version of the project. It has been verified by us.&lt;br /&gt;
&lt;br /&gt;
2. Refactoring the Update method&lt;br /&gt;
&lt;br /&gt;
'''Before refactoring'''&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After refactoring'''&lt;br /&gt;
 def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.update_attributes(topic_identifier: params[:topic][:topic_identifier], category: params[:topic][:category],&lt;br /&gt;
      topic_name: params[:topic][:topic_name], micropayment: params[:topic][:micropayment], description: params[:topic][:description],link:params[:topic][:link] )&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
      flash[:success] = 'The topic has been updated.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. &lt;br /&gt;
&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
5. signup_as_instructor_action is used to sign up a student for a particular topic for an assignment as an instructor. signup_as_instructor function does nothing. It is an empty function. The function is not being called anywhere in the code. The method is not needed and hence removed.&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor_action '''&lt;br /&gt;
&lt;br /&gt;
  def signup_as_instructor_action&lt;br /&gt;
    user = User.find_by(name: params[:username])&lt;br /&gt;
    if user.nil? # validate invalid user&lt;br /&gt;
      flash[:error] = 'That student does not exist!'&lt;br /&gt;
    else&lt;br /&gt;
      if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]&lt;br /&gt;
        if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])&lt;br /&gt;
          flash[:success] = 'You have successfully signed up the student for the topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor signed up student for topic: ' + params[:topic_id].to_s)&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = 'The student has already signed up for a topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor is signing up a student who already has a topic')&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = 'The student is not registered for the assignment!'&lt;br /&gt;
        ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'The student is not registered for the assignment: ' &amp;lt;&amp;lt; user.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor function'''&lt;br /&gt;
&lt;br /&gt;
 def signup_as_instructor; end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6.&lt;br /&gt;
&lt;br /&gt;
7.&lt;br /&gt;
&lt;br /&gt;
8.&lt;br /&gt;
&lt;br /&gt;
9. Delete_signup and delete_signup_as_instructor violate the DRY principle. Refactored this. Created a new private function handle_signup_deletion to handle deletion for both instructor as well as student. A new function, check_signup_eligibility, generates the error message that the topic cannot be dropped. The redirect_path function is used to redirect the user.&lt;br /&gt;
&lt;br /&gt;
'''Before Refactoring Delete_signup and delete_signup_as_instructor'''&lt;br /&gt;
&lt;br /&gt;
 def delete_signup&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    # A student who has already submitted work should not be allowed to drop his/her topic!&lt;br /&gt;
    # (A student/team has submitted if participant directory_num is non-null or submitted_hyperlinks is non-null.)&lt;br /&gt;
    # If there is no drop topic deadline, student can drop topic at any time (if all the submissions are deleted)&lt;br /&gt;
    # If there is a drop topic deadline, student cannot drop topic after this deadline.&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for already submitted a work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], session[:user].id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped your topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].id, 'Student has dropped the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    # find participant using assignment using team and topic ids&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'The student has already submitted their work, so you are not allowed to remove them.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for already submitted work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop a student after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the student from the topic!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Student has been dropped from the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After Refactoring Delete_signup and delete_signup_as_instructor'''    &lt;br /&gt;
  def delete_signup&lt;br /&gt;
    handle_signup_deletion(params[:id], session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    handle_signup_deletion(user.id, session[:user].id, assignment.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private def handle_signup_deletion(participant_id, user_id, assignment_id = nil)&lt;br /&gt;
    participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    assignment ||= participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    error_message = check_signup_eligibility(participant.team, drop_topic_deadline, user_id, params[:topic_id])&lt;br /&gt;
    if error_message&lt;br /&gt;
      flash[:error] = error_message&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, &amp;quot;Drop failed for #{error_message}: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, user_id, &amp;quot;Student has dropped the topic: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to redirect_path(participant_id, assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def check_signup_eligibility(team, drop_topic_deadline, user_id, topic_id)&lt;br /&gt;
    if !team.submitted_files.empty? || !team.hyperlinks.empty?&lt;br /&gt;
      'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def redirect_path(participant_id, assignment_id)&lt;br /&gt;
    if assignment_id&lt;br /&gt;
      controller: 'assignments', action: 'edit', id: assignment_id&lt;br /&gt;
    else&lt;br /&gt;
      action: 'list', id: participant_id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
10.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150925</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150925"/>
		<updated>2023-10-31T03:14:07Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
a) Adding comments&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
5. Test Report&lt;br /&gt;
[[File:Test_report_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The naming inconsistency issue has already been fixed by the previous version of the project. It has been verified by us.&lt;br /&gt;
&lt;br /&gt;
2. Refactoring the Update method&lt;br /&gt;
&lt;br /&gt;
'''Before refactoring'''&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After refactoring'''&lt;br /&gt;
 def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.update_attributes(topic_identifier: params[:topic][:topic_identifier], category: params[:topic][:category],&lt;br /&gt;
      topic_name: params[:topic][:topic_name], micropayment: params[:topic][:micropayment], description: params[:topic][:description],link:params[:topic][:link] )&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
      flash[:success] = 'The topic has been updated.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. &lt;br /&gt;
&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
5. signup_as_instructor_action is used to sign up a student for a particular topic for an assignment as an instructor. signup_as_instructor function does nothing. It is an empty function. The function is not being called anywhere in the code. The method is not needed and hence removed.&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor_action '''&lt;br /&gt;
&lt;br /&gt;
  def signup_as_instructor_action&lt;br /&gt;
    user = User.find_by(name: params[:username])&lt;br /&gt;
    if user.nil? # validate invalid user&lt;br /&gt;
      flash[:error] = 'That student does not exist!'&lt;br /&gt;
    else&lt;br /&gt;
      if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]&lt;br /&gt;
        if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])&lt;br /&gt;
          flash[:success] = 'You have successfully signed up the student for the topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor signed up student for topic: ' + params[:topic_id].to_s)&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = 'The student has already signed up for a topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor is signing up a student who already has a topic')&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = 'The student is not registered for the assignment!'&lt;br /&gt;
        ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'The student is not registered for the assignment: ' &amp;lt;&amp;lt; user.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor function'''&lt;br /&gt;
&lt;br /&gt;
 def signup_as_instructor; end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6.&lt;br /&gt;
&lt;br /&gt;
7.&lt;br /&gt;
&lt;br /&gt;
8.&lt;br /&gt;
&lt;br /&gt;
9. Delete_signup and delete_signup_as_instructor violate the DRY principle. Refactored this. Created a new private function handle_signup_deletion to handle deletion for both instructor as well as student. A new function, check_signup_eligibility, generates the error message that the topic cannot be dropped. The redirect_path function is used to redirect the user.&lt;br /&gt;
&lt;br /&gt;
'''Before Refactoring Delete_signup and delete_signup_as_instructor'''&lt;br /&gt;
&lt;br /&gt;
 def delete_signup&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    # A student who has already submitted work should not be allowed to drop his/her topic!&lt;br /&gt;
    # (A student/team has submitted if participant directory_num is non-null or submitted_hyperlinks is non-null.)&lt;br /&gt;
    # If there is no drop topic deadline, student can drop topic at any time (if all the submissions are deleted)&lt;br /&gt;
    # If there is a drop topic deadline, student cannot drop topic after this deadline.&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for already submitted a work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], session[:user].id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped your topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].id, 'Student has dropped the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    # find participant using assignment using team and topic ids&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'The student has already submitted their work, so you are not allowed to remove them.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for already submitted work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop a student after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the student from the topic!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Student has been dropped from the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After Refactoring Delete_signup and delete_signup_as_instructor'''    &lt;br /&gt;
  def delete_signup&lt;br /&gt;
    handle_signup_deletion(params[:id], session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    handle_signup_deletion(user.id, session[:user].id, assignment.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private def handle_signup_deletion(participant_id, user_id, assignment_id = nil)&lt;br /&gt;
    participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    assignment ||= participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    error_message = check_signup_eligibility(participant.team, drop_topic_deadline, user_id, params[:topic_id])&lt;br /&gt;
    if error_message&lt;br /&gt;
      flash[:error] = error_message&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, &amp;quot;Drop failed for #{error_message}: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, user_id, &amp;quot;Student has dropped the topic: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to redirect_path(participant_id, assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def check_signup_eligibility(team, drop_topic_deadline, user_id, topic_id)&lt;br /&gt;
    if !team.submitted_files.empty? || !team.hyperlinks.empty?&lt;br /&gt;
      'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def redirect_path(participant_id, assignment_id)&lt;br /&gt;
    if assignment_id&lt;br /&gt;
      controller: 'assignments', action: 'edit', id: assignment_id&lt;br /&gt;
    else&lt;br /&gt;
      action: 'list', id: participant_id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
10.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test_report_review_mapping.png&amp;diff=150922</id>
		<title>File:Test report review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test_report_review_mapping.png&amp;diff=150922"/>
		<updated>2023-10-31T03:13:25Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150916</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150916"/>
		<updated>2023-10-31T03:08:59Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
a) Adding comments&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
[[File:Refactor1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Refactor4.2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The naming inconsistency issue has already been fixed by the previous version of the project. It has been verified by us.&lt;br /&gt;
&lt;br /&gt;
2. Refactoring the Update method&lt;br /&gt;
&lt;br /&gt;
'''Before refactoring'''&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After refactoring'''&lt;br /&gt;
 def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.update_attributes(topic_identifier: params[:topic][:topic_identifier], category: params[:topic][:category],&lt;br /&gt;
      topic_name: params[:topic][:topic_name], micropayment: params[:topic][:micropayment], description: params[:topic][:description],link:params[:topic][:link] )&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
      flash[:success] = 'The topic has been updated.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. &lt;br /&gt;
&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
5. signup_as_instructor_action is used to sign up a student for a particular topic for an assignment as an instructor. signup_as_instructor function does nothing. It is an empty function. The function is not being called anywhere in the code. The method is not needed and hence removed.&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor_action '''&lt;br /&gt;
&lt;br /&gt;
  def signup_as_instructor_action&lt;br /&gt;
    user = User.find_by(name: params[:username])&lt;br /&gt;
    if user.nil? # validate invalid user&lt;br /&gt;
      flash[:error] = 'That student does not exist!'&lt;br /&gt;
    else&lt;br /&gt;
      if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]&lt;br /&gt;
        if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])&lt;br /&gt;
          flash[:success] = 'You have successfully signed up the student for the topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor signed up student for topic: ' + params[:topic_id].to_s)&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = 'The student has already signed up for a topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor is signing up a student who already has a topic')&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = 'The student is not registered for the assignment!'&lt;br /&gt;
        ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'The student is not registered for the assignment: ' &amp;lt;&amp;lt; user.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor function'''&lt;br /&gt;
&lt;br /&gt;
 def signup_as_instructor; end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6.&lt;br /&gt;
&lt;br /&gt;
7.&lt;br /&gt;
&lt;br /&gt;
8.&lt;br /&gt;
&lt;br /&gt;
9. Delete_signup and delete_signup_as_instructor violate the DRY principle. Refactored this. Created a new private function handle_signup_deletion to handle deletion for both instructor as well as student. A new function, check_signup_eligibility, generates the error message that the topic cannot be dropped. The redirect_path function is used to redirect the user.&lt;br /&gt;
&lt;br /&gt;
'''Before Refactoring Delete_signup and delete_signup_as_instructor'''&lt;br /&gt;
&lt;br /&gt;
 def delete_signup&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    # A student who has already submitted work should not be allowed to drop his/her topic!&lt;br /&gt;
    # (A student/team has submitted if participant directory_num is non-null or submitted_hyperlinks is non-null.)&lt;br /&gt;
    # If there is no drop topic deadline, student can drop topic at any time (if all the submissions are deleted)&lt;br /&gt;
    # If there is a drop topic deadline, student cannot drop topic after this deadline.&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for already submitted a work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], session[:user].id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped your topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].id, 'Student has dropped the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    # find participant using assignment using team and topic ids&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'The student has already submitted their work, so you are not allowed to remove them.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for already submitted work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop a student after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the student from the topic!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Student has been dropped from the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After Refactoring Delete_signup and delete_signup_as_instructor'''    &lt;br /&gt;
  def delete_signup&lt;br /&gt;
    handle_signup_deletion(params[:id], session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    handle_signup_deletion(user.id, session[:user].id, assignment.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private def handle_signup_deletion(participant_id, user_id, assignment_id = nil)&lt;br /&gt;
    participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    assignment ||= participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    error_message = check_signup_eligibility(participant.team, drop_topic_deadline, user_id, params[:topic_id])&lt;br /&gt;
    if error_message&lt;br /&gt;
      flash[:error] = error_message&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, &amp;quot;Drop failed for #{error_message}: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, user_id, &amp;quot;Student has dropped the topic: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to redirect_path(participant_id, assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def check_signup_eligibility(team, drop_topic_deadline, user_id, topic_id)&lt;br /&gt;
    if !team.submitted_files.empty? || !team.hyperlinks.empty?&lt;br /&gt;
      'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def redirect_path(participant_id, assignment_id)&lt;br /&gt;
    if assignment_id&lt;br /&gt;
      controller: 'assignments', action: 'edit', id: assignment_id&lt;br /&gt;
    else&lt;br /&gt;
      action: 'list', id: participant_id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
10.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor4.2_commit_review_mapping.png&amp;diff=150911</id>
		<title>File:Refactor4.2 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor4.2_commit_review_mapping.png&amp;diff=150911"/>
		<updated>2023-10-31T03:05:55Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor4.1_commit_review_mapping.png&amp;diff=150910</id>
		<title>File:Refactor4.1 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor4.1_commit_review_mapping.png&amp;diff=150910"/>
		<updated>2023-10-31T03:05:29Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor3_commit_review_mapping.png&amp;diff=150909</id>
		<title>File:Refactor3 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor3_commit_review_mapping.png&amp;diff=150909"/>
		<updated>2023-10-31T03:05:12Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor2_commit_review_mapping.png&amp;diff=150908</id>
		<title>File:Refactor2 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor2_commit_review_mapping.png&amp;diff=150908"/>
		<updated>2023-10-31T03:04:54Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor1_commit_review_mapping.png&amp;diff=150907</id>
		<title>File:Refactor1 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Refactor1_commit_review_mapping.png&amp;diff=150907"/>
		<updated>2023-10-31T03:04:35Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment1_commit_review_mapping.png&amp;diff=150904</id>
		<title>File:Delete comment1 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment1_commit_review_mapping.png&amp;diff=150904"/>
		<updated>2023-10-31T02:54:00Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150903</id>
		<title>CSC/ECE 517 Fall 2023 - E2356. Refactor review mapping controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2356._Refactor_review_mapping_controller.rb&amp;diff=150903"/>
		<updated>2023-10-31T02:53:24Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: /* Solutions/Details of Changes Made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for information regarding the changes made for the E2356 Refactor review_mapping_controller.rb OSS assignment for Fall 2023, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is an open-source project developed on Ruby on Rails. This web application is maintained by the students and faculty at NC State. This application gives complete control to the instructor to maintain the assignments in their class. With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well-developed application that can handle all types of assignments. To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== About Controller ==&lt;br /&gt;
The functionality of review_mapping_controller is to provide mapping for the reviewer and assignment. Basically, the controller handles the assignment of reviews to different teams or single student users, such as the event of peer review and self-review. Also, this controller is responsible to respond student user requests for extra bonus reviews based on assignment policy.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement==&lt;br /&gt;
*Refactor the long methods in review_mapping_controller.rb like assign_reviewer_dynamically, add_reviewer, automatic_review_mapping,peer_review_strategy etc.&lt;br /&gt;
*Some variables in review_mapping_controller.rb are not named properly. Rename variable names to convey what they are used for.&lt;br /&gt;
*Functions are lengthy and difficult to read. Replace switch statements with subclasses methods, if any.&lt;br /&gt;
*Create subclasses and models wherever necessary.&lt;br /&gt;
*Add meaningful comments and edit/remove unnecessary comments.&lt;br /&gt;
*Ensure that code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
We followed several design patterns while refactoring our code. One of the most common ones is the “Extract Method.” There were several instances where the method was too long and complex. We moved some of the functionality to a different method to make it more readable. This way, it became easier and clearer to understand what the method achieved. &lt;br /&gt;
Another issue we observed with the code was that it had too many conditional statements. We used the “Refactoring conditionals” design pattern, which aims to place the block of code in the conditional statement in a different method and call that method. This improves the readability of our code.&lt;br /&gt;
[[File:flow_Diagram_review_mapping_controller.png]]&lt;br /&gt;
&lt;br /&gt;
== File(s) Modified ==&lt;br /&gt;
1. review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
==Solutions/Details of Changes Made==&lt;br /&gt;
1. Changes to variable names to make them reflect what they actually do.&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit1_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Variable_commit2_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
2. Added/Edited comments to improve the readability of code and make commenting proper.&lt;br /&gt;
a) Adding comments&lt;br /&gt;
[[File:Comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
b) Edit Comments&lt;br /&gt;
[[File:Edit_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
c) Deleting Comments&lt;br /&gt;
[[File:Delete_comment1_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment2_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment3_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Delete_comment4_commit_review_mapping.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Reducing cyclomatic complexity of functions by dividing them into smaller methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Reshuffling parts of code to make the method look consistent and easy to read and understand&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. The naming inconsistency issue has already been fixed by the previous version of the project. It has been verified by us.&lt;br /&gt;
&lt;br /&gt;
2. Refactoring the Update method&lt;br /&gt;
&lt;br /&gt;
'''Before refactoring'''&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After refactoring'''&lt;br /&gt;
 def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.update_attributes(topic_identifier: params[:topic][:topic_identifier], category: params[:topic][:category],&lt;br /&gt;
      topic_name: params[:topic][:topic_name], micropayment: params[:topic][:micropayment], description: params[:topic][:description],link:params[:topic][:link] )&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
      flash[:success] = 'The topic has been updated.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. &lt;br /&gt;
&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
5. signup_as_instructor_action is used to sign up a student for a particular topic for an assignment as an instructor. signup_as_instructor function does nothing. It is an empty function. The function is not being called anywhere in the code. The method is not needed and hence removed.&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor_action '''&lt;br /&gt;
&lt;br /&gt;
  def signup_as_instructor_action&lt;br /&gt;
    user = User.find_by(name: params[:username])&lt;br /&gt;
    if user.nil? # validate invalid user&lt;br /&gt;
      flash[:error] = 'That student does not exist!'&lt;br /&gt;
    else&lt;br /&gt;
      if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]&lt;br /&gt;
        if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])&lt;br /&gt;
          flash[:success] = 'You have successfully signed up the student for the topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor signed up student for topic: ' + params[:topic_id].to_s)&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = 'The student has already signed up for a topic!'&lt;br /&gt;
          ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Instructor is signing up a student who already has a topic')&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = 'The student is not registered for the assignment!'&lt;br /&gt;
        ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'The student is not registered for the assignment: ' &amp;lt;&amp;lt; user.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
''' signup_as_instructor function'''&lt;br /&gt;
&lt;br /&gt;
 def signup_as_instructor; end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6.&lt;br /&gt;
&lt;br /&gt;
7.&lt;br /&gt;
&lt;br /&gt;
8.&lt;br /&gt;
&lt;br /&gt;
9. Delete_signup and delete_signup_as_instructor violate the DRY principle. Refactored this. Created a new private function handle_signup_deletion to handle deletion for both instructor as well as student. A new function, check_signup_eligibility, generates the error message that the topic cannot be dropped. The redirect_path function is used to redirect the user.&lt;br /&gt;
&lt;br /&gt;
'''Before Refactoring Delete_signup and delete_signup_as_instructor'''&lt;br /&gt;
&lt;br /&gt;
 def delete_signup&lt;br /&gt;
    participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    assignment = participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    # A student who has already submitted work should not be allowed to drop his/her topic!&lt;br /&gt;
    # (A student/team has submitted if participant directory_num is non-null or submitted_hyperlinks is non-null.)&lt;br /&gt;
    # If there is no drop topic deadline, student can drop topic at any time (if all the submissions are deleted)&lt;br /&gt;
    # If there is a drop topic deadline, student cannot drop topic after this deadline.&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for already submitted a work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Dropping topic for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], session[:user].id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped your topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].id, 'Student has dropped the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'list', id: params[:id]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    # find participant using assignment using team and topic ids&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    if !participant.team.submitted_files.empty? || !participant.team.hyperlinks.empty?&lt;br /&gt;
      flash[:error] = 'The student has already submitted their work, so you are not allowed to remove them.'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for already submitted work: ' + params[:topic_id].to_s)&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      flash[:error] = 'You cannot drop a student after the drop topic deadline!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Drop failed for ended work: ' + params[:topic_id].to_s)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the student from the topic!'&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, 'Student has been dropped from the topic: ' + params[:topic_id].to_s)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'assignments', action: 'edit', id: assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''After Refactoring Delete_signup and delete_signup_as_instructor'''    &lt;br /&gt;
  def delete_signup&lt;br /&gt;
    handle_signup_deletion(params[:id], session[:user].id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def delete_signup_as_instructor&lt;br /&gt;
    team = Team.find(params[:id])&lt;br /&gt;
    user = TeamsUser.find_by(team_id: team.id).user&lt;br /&gt;
    assignment = Assignment.find(team.parent_id)&lt;br /&gt;
    handle_signup_deletion(user.id, session[:user].id, assignment.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private def handle_signup_deletion(participant_id, user_id, assignment_id = nil)&lt;br /&gt;
    participant = AssignmentParticipant.find(participant_id)&lt;br /&gt;
    assignment ||= participant.assignment&lt;br /&gt;
    drop_topic_deadline = assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    error_message = check_signup_eligibility(participant.team, drop_topic_deadline, user_id, params[:topic_id])&lt;br /&gt;
    if error_message&lt;br /&gt;
      flash[:error] = error_message&lt;br /&gt;
      ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].id, &amp;quot;Drop failed for #{error_message}: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      delete_signup_for_topic(assignment.id, params[:topic_id], user_id)&lt;br /&gt;
      flash[:success] = 'You have successfully dropped the topic!'&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, user_id, &amp;quot;Student has dropped the topic: #{params[:topic_id]}&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to redirect_path(participant_id, assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def check_signup_eligibility(team, drop_topic_deadline, user_id, topic_id)&lt;br /&gt;
    if !team.submitted_files.empty? || !team.hyperlinks.empty?&lt;br /&gt;
      'You have already submitted your work, so you are not allowed to drop your topic.'&lt;br /&gt;
    elsif !drop_topic_deadline.nil? &amp;amp;&amp;amp; (Time.now &amp;gt; drop_topic_deadline.due_at)&lt;br /&gt;
      'You cannot drop your topic after the drop topic deadline!'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def redirect_path(participant_id, assignment_id)&lt;br /&gt;
    if assignment_id&lt;br /&gt;
      controller: 'assignments', action: 'edit', id: assignment_id&lt;br /&gt;
    else&lt;br /&gt;
      action: 'list', id: participant_id&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
10.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ameya Vaichalikar (agvaicha)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Chirag Bheemaiah Palanganda Karumbaiah (cpalang)&lt;br /&gt;
* Shanmukh Pawan Moparthi (smopart2)&lt;br /&gt;
* Amit Bhujbal (abhujba)&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment4_commit_review_mapping.png&amp;diff=150901</id>
		<title>File:Delete comment4 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment4_commit_review_mapping.png&amp;diff=150901"/>
		<updated>2023-10-31T02:52:49Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment3_commit_review_mapping.png&amp;diff=150900</id>
		<title>File:Delete comment3 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment3_commit_review_mapping.png&amp;diff=150900"/>
		<updated>2023-10-31T02:52:29Z</updated>

		<summary type="html">&lt;p&gt;Cpalang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cpalang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment2_commit_review_mapping.png&amp;diff=150899</id>
		<title>File:Delete comment2 commit review mapping.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Delete_comment2_commit_review_mapping.png&amp;diff=150899"/>
		<updated>2023-10-31T02:51:55Z</updated>

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