<?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=Ysoodin</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=Ysoodin"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ysoodin"/>
	<updated>2026-09-12T18:49:39Z</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_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129631</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129631"/>
		<updated>2019-11-18T17:52:33Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Links for Demo Videos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing its observable behavior. This can be achieved through refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here and since it is intertwined with a lot of other parts in the code base, it is quite imperative that this code needs to be refactored.&lt;br /&gt;
&lt;br /&gt;
Link to the Pull Request Submitted: [https://github.com/expertiza/expertiza/pull/1538]&lt;br /&gt;
&lt;br /&gt;
Link to the Repository [https://github.com/VivekReddy98/expertiza/]&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
'''assign_quiz_dynamically''' (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assign_quiz_dynamically_assign_quiz_index POST   /assign_quiz/assign_quiz_dynamically(.:format)  assign_quiz#assign_quiz_dynamically&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
==== Modified View Files: ====&lt;br /&gt;
app/views/student_quizzes/_set_dynamic_quiz.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
app/views/assignments/edit/_calibration.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Links for Demo Videos ==&lt;br /&gt;
&lt;br /&gt;
Assign Reviewer Manually Demo[https://drive.google.com/file/d/1o9vJQ7fCwk0hwHJdErwpg1z_XjsN_XRT/view?usp=sharing]&lt;br /&gt;
&lt;br /&gt;
Regression and Unit Testing of Controllers Demo[https://youtu.be/XejKHQKtpuA]&lt;br /&gt;
&lt;br /&gt;
Automatic Assignment of Reviewer Demo [https://drive.google.com/file/d/17wpo7mTDenLvEcgubVflLtF_vmLb623a/view?usp=sharing]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129465</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129465"/>
		<updated>2019-11-16T04:03:41Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
[[File:Math_eq2.png]]&lt;br /&gt;
&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
[[File:eq2.png]]&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
[[File:eq1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
* Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
* Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129464</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129464"/>
		<updated>2019-11-16T04:03:12Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
[[File:Math_eq2.png]]&lt;br /&gt;
&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
[[File:eq2.png]]&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
[[File:eq1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129463</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129463"/>
		<updated>2019-11-16T04:02:25Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
[[File:eq2.png]]&lt;br /&gt;
&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
[[File:Math_eq2.png]]&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
[[File:eq1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129461</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129461"/>
		<updated>2019-11-16T04:01:24Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
[[File:Math_eq3.png]]&lt;br /&gt;
&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
[[File:Math_eq2]]&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
[[File:eq1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129460</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129460"/>
		<updated>2019-11-16T03:58:47Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
[[File:eq1.png]]&lt;br /&gt;
&lt;br /&gt;
{{math| ''k'' {{=}} {{sfrac|''n''''q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt;'' |''m'}} }}&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
p|nqsmp|&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
p| = ⌊nqSm⌋ ℕ&lt;br /&gt;
&lt;br /&gt;
p| = ⌈nqSm⌉ ℕ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Math_eq2.png&amp;diff=129457</id>
		<title>File:Math eq2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Math_eq2.png&amp;diff=129457"/>
		<updated>2019-11-16T03:56:18Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Eq2.png&amp;diff=129456</id>
		<title>File:Eq2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Eq2.png&amp;diff=129456"/>
		<updated>2019-11-16T03:55:01Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: uploaded a new version of &amp;amp;quot;File:Eq2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Eq1.png&amp;diff=129455</id>
		<title>File:Eq1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Eq1.png&amp;diff=129455"/>
		<updated>2019-11-16T03:54:37Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129453</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129453"/>
		<updated>2019-11-16T03:49:17Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Approach for matching students with topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{math| ''k'' {{=}} {{sfrac|''n''''q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt;'' |''m'}} }}&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
p|nqsmp|&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
p| = ⌊nqSm⌋ ℕ&lt;br /&gt;
&lt;br /&gt;
p| = ⌈nqSm⌉ ℕ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129452</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129452"/>
		<updated>2019-11-16T03:42:04Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Approach for matching students with topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; k = \frac {n times q_S}{m}&amp;lt;/math&amp;gt;&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
p|nqsmp|&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
p| = ⌊nqSm⌋ ℕ&lt;br /&gt;
&lt;br /&gt;
p| = ⌈nqSm⌉ ℕ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129451</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129451"/>
		<updated>2019-11-16T03:41:45Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
We have a set of students S = {S&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., S&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;}, and a set of topics T = {T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., T&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;}. Each student must get exactly q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; topics (The threshold in our case is q&amp;lt;sub&amp;gt;S&amp;lt;/sub&amp;gt; = 4, it’s up to the student to decide how many of these they want to actually review.), while each topic must be assigned to at least q&amp;lt;sub&amp;gt;T&amp;lt;/sub&amp;gt; reviewers. Students will submit a list of preferences over the set of topics in linear order. If they submit the preferences for only a certain topics, the rest of the topics will be appended to their preference list in a random order. The topics shall have (possibly different) linear order preference over the set of students according to the timestamps of their time of bid and the total number of topics they have bid for. Students with lower timestamps and who bid for lower number of topics will be given higher preference.&lt;br /&gt;
&lt;br /&gt;
To begin, we will try to obtain a matching with an approximately equal number of students reviewing each topic, which we call uniform distribution. If no uniform stable matching exists, our mechanism will nonetheless return a stable matching, provided one exists for a given profile of preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average number of reviewers assigned to each course will be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; k = \frac {n times q_S}{m}&lt;br /&gt;
where n is the number of students, and m is the number of courses.&lt;br /&gt;
&lt;br /&gt;
Clearly, this number is not necessarily an integer. Let us assume that&lt;br /&gt;
&lt;br /&gt;
p|nqsmp|&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
p| = ⌊nqSm⌋ ℕ&lt;br /&gt;
&lt;br /&gt;
p| = ⌈nqSm⌉ ℕ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matching 𝝁 is a mapping which assigns exactly qS different topics to each student in Sand at least qT different students to each topic in T. We denote the set of topics assigned by matching 𝜇 to the student si and the set of students who were assigned the topic tj as 𝜇(si) and 𝜇(tj),respectively.&lt;br /&gt;
&lt;br /&gt;
Blocking Pair (Defined according to our problem): A pair (s, t) is called a blocking pair, if the student is associated with the topic (If he/she is in the group which works on topic t). A Matching Set M is considered Stable if it does not have any blocking pairs.&lt;br /&gt;
&lt;br /&gt;
The matching is (pairwise) stable if there are no blocking pairs.&lt;br /&gt;
&lt;br /&gt;
Mechanism:&lt;br /&gt;
&lt;br /&gt;
First we calculate k, p|, and p|. The goal is for each topic to be assigned to either p| and p| students, and to assign exactly qS courses.&lt;br /&gt;
&lt;br /&gt;
The algorithm:&lt;br /&gt;
&lt;br /&gt;
Step 1: &lt;br /&gt;
Each topic proposes to accept the first pI students in its preference list. Each student accepts no more than qS proposals according to his/her preferences, rejecting the rest.&lt;br /&gt;
Step k: &lt;br /&gt;
Each course that has z &amp;lt; pI students proposes to accept pI - z students it has not yet proposed to. Each student accepts no more than qS proposals according to his/her preferences, rejecting the others. &lt;br /&gt;
&lt;br /&gt;
The algorithm stops when every topic that has not reached the maximum quota pI has proposed acceptance to every student.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129450</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129450"/>
		<updated>2019-11-16T03:33:42Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;q_S&amp;lt;/math&amp;gt;Gale-Shapely is Proven to be a stable solution in one-to-one and one-to-many scenarios. While the literature on using Gale-Shapely for Many-to-Many scenarios is not very well defined as a generalized framework, they are a few resources similar to our case.&lt;br /&gt;
&lt;br /&gt;
* The assignment topics each have a quota 10 of reviewers the topic can be assigned to at maximum. Each of the students have a quota 4 of topics they can be assigned at maximum. Gale and Shapely have proposed a mechanism called the Deferred Acceptance (DA) algorithm for finding a stable solution for one-to-one and many-to-one matching problems. The generalization of the DA algorithm other case of many-to-many matching with different preferences and quotas proposed by Freer et al. can be used as our bidding algorithm. Details can be found in the reference below.&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf '''Use Case on applying Gale-Shapely to a Many-to-Many scenario''']&lt;br /&gt;
&lt;br /&gt;
* Although, we were asked to implement Gale-Shapely as a part of this project, the liberty of using any other alternative and a suitable algorithm is in discussion.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129449</id>
		<title>CSC/ECE 517 Fall 2019 - E1986. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review&amp;diff=129449"/>
		<updated>2019-11-16T03:25:11Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Why Should a Student bid for Reviewing Submissions?''' ==&lt;br /&gt;
&lt;br /&gt;
If the choice of which submission to review is left to student itself, he/she would choose to review those topics which are related to their project or whatever they are highly interested in. This would benefit both the reviewer and reviewer because &lt;br /&gt;
&lt;br /&gt;
From a Student's Perspective:&lt;br /&gt;
&lt;br /&gt;
*Because he/she does not have to spend a lot of time understanding what is going on.&lt;br /&gt;
*The Student would be more focused on giving the review and hence judgment made tend to be more objective than subjective.  &lt;br /&gt;
*This would improve the quality of reviews and will also be helpful for the reviewer.&lt;br /&gt;
*By implementing the color-coding feature, the student at any point knows which topic/s are more likely to get and he/she optimizes between &amp;quot;what they want&amp;quot; and &amp;quot;what they can get&amp;quot;   &lt;br /&gt;
*Also, Bidding in Fun !!!!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the Instructor's Standpoint:&lt;br /&gt;
&lt;br /&gt;
*Because opinions expressed in the reviews are a result of informed decisions, the inference made from the Machine Learning models trained on these data sets would make more sense.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
=== Currently Deployed Implementation ===&lt;br /&gt;
&lt;br /&gt;
When an assignment participant wants to review others’ work, they will be asked to choose an assignment topic. The participant will be allowed to choose from among those assignment topics that have not been already assigned to 10 other participants. If they choose the ‘I do not care about the topic I review’ option, a random topic will be chosen from all the available topics and will be assigned to them. That is, the reviews are being allocated on a First Come First Serve basis.&lt;br /&gt;
&lt;br /&gt;
=== Previous Work on this issue ===&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review '''E1856''']&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review '''E1928''']&lt;br /&gt;
&lt;br /&gt;
=== What’s Deeply wrong in those implementations? ===&lt;br /&gt;
&lt;br /&gt;
To understand what's wrong, first consider the differences between Teams Bidding for Assignments and Students Bidding for Reviews. Both of these are Matching or resource Allocation Problems. &lt;br /&gt;
&lt;br /&gt;
The former can be modelled as a one-to-one matching problem. (i.e team and assignment has one-to-one correspondence).&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_2.png |center|]]&lt;br /&gt;
&lt;br /&gt;
However, Students and Reviews have many-to-many relationship (a student can choose multiple submissions for review and a submission can be given to multiple students for review)&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments.png |center|]]&lt;br /&gt;
&lt;br /&gt;
The Mathematical formulation is itself wrong in E1856 and E1928 and they have used the below shown diagram to represent the relationship.&lt;br /&gt;
&lt;br /&gt;
[[File:Teams_Assignments_3.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== Why does the difference is the representation matter? ===&lt;br /&gt;
&lt;br /&gt;
Since they have modeled the problem on the same lines, they have used the same version of the Gale-Shapley or Top Trading Cycles Algorithm used for one-to-many or one-to-one approach.&lt;br /&gt;
Famous Problems Dealt on these lines.&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Stable_marriage_problem '''Stable Marriage Problem'''] (One-to-One)&lt;br /&gt;
&lt;br /&gt;
[https://www.jstor.org/stable/3132114?seq=1&amp;amp;cid=pdf-reference#references_tab_content '''School Choice Problem'''] (One-to-Many)&lt;br /&gt;
&lt;br /&gt;
=== Other Implementation pitfalls observed ===&lt;br /&gt;
&lt;br /&gt;
'''E1928'''&lt;br /&gt;
&lt;br /&gt;
*Once the bidding for review topics is done, the selections need to be saved to the database which is not happening and when the page is refreshed, the UI does not retain the bids.&lt;br /&gt;
*The button responsible for running the algorithm cannot be checked and it is a hunk-like icon.&lt;br /&gt;
*The button appears multiple times on the page.&lt;br /&gt;
*The algorithm needs to be implemented in the web service which should be ideally be used from the lottery controller which is not they have tried to implement. The entire code is written in Ruby.&lt;br /&gt;
*The algorithm needs to skip the review topic that the user has worked on. This Code already exists for topic and again written in the new implementation that needs to be integrated into the existing one and hence needs refactoring.&lt;br /&gt;
*Proper tests need to be written.&lt;br /&gt;
&lt;br /&gt;
== '''What needs to be done?''' ==&lt;br /&gt;
&lt;br /&gt;
The participants should be able to bid for topics to review in the same way they bid for topics to work on. &lt;br /&gt;
&lt;br /&gt;
=== Approach for matching students with topics === &lt;br /&gt;
&lt;br /&gt;
*Gale-Shapely is Proven to be a stable solution in one-to-one and one-to-many scenarios. While the literature on using Gale-Shapely for Many-to-Many scenarios is not very well defined as a generalized framework, they are a few resources similar to our case.&lt;br /&gt;
&lt;br /&gt;
* The assignment topics each have a quota 10 of reviewers the topic can be assigned to at maximum. Each of the students have a quota 4 of topics they can be assigned at maximum. Gale and Shapely have proposed a mechanism called the Deferred Acceptance (DA) algorithm for finding a stable solution for one-to-one and many-to-one matching problems. The generalization of the DA algorithm other case of many-to-many matching with different preferences and quotas proposed by Freer et al. can be used as our bidding algorithm. Details can be found in the reference below.&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf '''Use Case on applying Gale-Shapely to a Many-to-Many scenario''']&lt;br /&gt;
&lt;br /&gt;
* Although, we were asked to implement Gale-Shapely as a part of this project, the liberty of using any other alternative and a suitable algorithm is in discussion.&lt;br /&gt;
&lt;br /&gt;
=== Functional Requirements===&lt;br /&gt;
*Each participant should be able to submit a list of preferences in decreasing preference order for the topics they would like to review. The list may contain any number of topics.&lt;br /&gt;
*During bidding, the topics should be color-coded according to the number of participants who are contending for each topic. The colors should range from green to red with green representing a topic with a low number of bids and red representing a topic with a high number of bids.&lt;br /&gt;
*There should be a deadline before which all participants must submit their list of preferences.&lt;br /&gt;
*After the deadline, the course instructor should be able to run the bidding algorithm after which each participant will be assigned a list of topics to review. The number of topics assigned to a participant should be minimum(4,k) where ‘k’ is the number of topics in their preference list.&lt;br /&gt;
*Once the topics to review have been assigned, the participants should be able to see those topics they have been assigned and give feedback to the submission for each topic.&lt;br /&gt;
*If a participant has given feedback to less than 4 topics and chooses to review a submission, the topic with the minimum number of current reviewers will be assigned to that participant.&lt;br /&gt;
&lt;br /&gt;
=== Non-functional Requirements ===&lt;br /&gt;
&lt;br /&gt;
*There must exist a web service that takes the participants and their respective preference lists as input runs a bidding algorithm like top trading cycles and returns a map of the participants and the list of topics assigned to each participant. &lt;br /&gt;
*This web service must either be called from the LotteryController or a new controller can be created on the same (if Lottery Controller becomes too complex).&lt;br /&gt;
&lt;br /&gt;
=== Implementing the Web Service ===&lt;br /&gt;
*1) Python&lt;br /&gt;
*2) Flask (Minimal MVC Framework for Python Backend) &lt;br /&gt;
*3) JSON as the Data Serialization Format.&lt;br /&gt;
*4) Deployment (AWS or VCL)&lt;br /&gt;
*5) Apache Web Server or GUnicorn or Default Flask Server.&lt;br /&gt;
&lt;br /&gt;
=== (Potential) Addition/Modification of files in expertiza ===&lt;br /&gt;
*1) Lottery Controller &lt;br /&gt;
*2) Review Mapping Controller &lt;br /&gt;
*3) A New model to store the bidding information entered by the student.&lt;br /&gt;
*4) Unit Test Files Associated&lt;br /&gt;
*5) Views/Routes Associated&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
*Ensuring that the algorithm results in stable matchings. The concept of stability is defined above.&lt;br /&gt;
*Check whether the UI reflects the bids made by the user.&lt;br /&gt;
*Testing that the color-coding feature is working and appropriate. &lt;br /&gt;
*Check if a user is assigned 4 topics for review, even though he might have bid for any number of topics.&lt;br /&gt;
*Regression testing if the code is added in the lottery controller. If new model/controller is added then relevant tests will be included based on the proposal acceptance.&lt;br /&gt;
*Tests to ensure that each review topic gets minimum number of reviews.&lt;br /&gt;
*Tests to check whether the web service works as expected.&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Sai Shruthi Madhuri Kara (skara2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Ayushi Rungta (arungta@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Important references ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peerlogic/IntelligentAssignment/blob/master/app/app.py InteligentAssignment]&lt;br /&gt;
&lt;br /&gt;
[http://ices.gmu.edu/wp-content/uploads/2015/02/Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova.pdf Many-to-Many-Matching-Problem-with-Quotas-by-Freer-and-Titova]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2019_-_Project_E1928._Allow_reviewers_to_bid_on_what_to_review Project_E1928._Allow_reviewers_to_bid_on_what_to_review]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review E1856_Allow_reviewers_to_bid_on_what_to_review]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129279</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129279"/>
		<updated>2019-11-12T20:26:05Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Links for Demo Videos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing its observable behavior. This can be achieved through refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here and since it is intertwined with a lot of other parts in the code base, it is quite imperative that this code needs to be refactored.&lt;br /&gt;
&lt;br /&gt;
Link to the Pull Request Submitted: [https://github.com/expertiza/expertiza/pull/1538]&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
'''assign_quiz_dynamically''' (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assign_quiz_dynamically_assign_quiz_index POST   /assign_quiz/assign_quiz_dynamically(.:format)  assign_quiz#assign_quiz_dynamically&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
==== Modified View Files: ====&lt;br /&gt;
app/views/student_quizzes/_set_dynamic_quiz.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
app/views/assignments/edit/_calibration.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Links for Demo Videos ==&lt;br /&gt;
&lt;br /&gt;
Assign Reviewer Demo[https://drive.google.com/file/d/1o9vJQ7fCwk0hwHJdErwpg1z_XjsN_XRT/view?usp=sharing]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129278</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129278"/>
		<updated>2019-11-12T20:25:40Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Links for Demo Videos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing its observable behavior. This can be achieved through refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here and since it is intertwined with a lot of other parts in the code base, it is quite imperative that this code needs to be refactored.&lt;br /&gt;
&lt;br /&gt;
Link to the Pull Request Submitted: [https://github.com/expertiza/expertiza/pull/1538]&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
'''assign_quiz_dynamically''' (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assign_quiz_dynamically_assign_quiz_index POST   /assign_quiz/assign_quiz_dynamically(.:format)  assign_quiz#assign_quiz_dynamically&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
==== Modified View Files: ====&lt;br /&gt;
app/views/student_quizzes/_set_dynamic_quiz.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
app/views/assignments/edit/_calibration.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Links for Demo Videos ==&lt;br /&gt;
&lt;br /&gt;
[Assign Reviewer Demo]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129277</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=129277"/>
		<updated>2019-11-12T20:24:43Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing its observable behavior. This can be achieved through refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
The number of routes directed to review_mapping_controller is illustrated here and since it is intertwined with a lot of other parts in the code base, it is quite imperative that this code needs to be refactored.&lt;br /&gt;
&lt;br /&gt;
Link to the Pull Request Submitted: [https://github.com/expertiza/expertiza/pull/1538]&lt;br /&gt;
&lt;br /&gt;
[[File:complexity.png]]&lt;br /&gt;
&lt;br /&gt;
== Work-Plan Followed ==&lt;br /&gt;
[[File:FlowchartOODD.jpg]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We were tasked to refactor the review_mapping_controller.rb and solve any cascading issues or bugs we could find. We followed the above work plan to complete this task. There were many times when all the Rspec and Cucumber tests passed locally but ran into an issue when we uploaded the changes on GitHub. Prompt feedback from the TRAVIS CI helped us recognize the issue. Then we went on local machine and followed the whole process of refactoring again. In this way, we covered every refactoring we did and ensured that the TRAVIS CI get passed with minimum issues on the code-climate.&lt;br /&gt;
&lt;br /&gt;
== Files modified/created in the current project ==&lt;br /&gt;
&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of '''long''' and '''complex methods''' such as '''peer_review_strategy''' and '''automatic_review_mapping''' were refactored from this controller along with the '''removal''' of some '''non-related methods''' such as '''add_calibration''' and '''assign_quiz_dynamically'''. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
After refactoring the '''Review_Mapping_Controller.rb''', there were some tests still present in the spec file of this controller. So, we '''removed such tests''' from the '''review_mapping_controller_spec.rb''' to the appropriate spec file.&lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
'''assign_quiz_dynamically''' (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
'''Add_Calibration''' is a nuanced method and has seemingly '''different functionality''' than '''Review Mapping''' Controller. Methods having a different purpose than review_mapping or helping review_mapping should not be present in this controller. So we '''moved''' this method '''into''' a '''separate controller'''.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
assign_quiz_dynamically_assign_quiz_index POST   /assign_quiz/assign_quiz_dynamically(.:format)  assign_quiz#assign_quiz_dynamically&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
==== Modified View Files: ====&lt;br /&gt;
app/views/student_quizzes/_set_dynamic_quiz.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
app/views/assignments/edit/_calibration.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;before:&amp;lt;br/&amp;gt; [[File:3bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:3aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&lt;br /&gt;
before:&amp;lt;br/&amp;gt; [[File:4bef.jpg]] &amp;lt;br/&amp;gt;after: &amp;lt;br/&amp;gt;[[File:4aft.jpg]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ## Helper Method for generating a random participant which is to be used in peer_review_strategy method.&lt;br /&gt;
  def gen_random_participant_id(iterator, participants_hash, num_participants, participants)&lt;br /&gt;
    if iterator.zero?&lt;br /&gt;
        rand_num = rand(0..num_participants - 1)&lt;br /&gt;
    else&lt;br /&gt;
        min_value = participants_hash.values.min&lt;br /&gt;
        # get the temp array including indices of participants, each participant has minimum review number in hash table.&lt;br /&gt;
        participants_with_min_assigned_reviews = []&lt;br /&gt;
        participants.each do |participant|&lt;br /&gt;
          participants_with_min_assigned_reviews &amp;lt;&amp;lt; participants.index(participant) if participants_hash[participant.id] == min_value&lt;br /&gt;
        end&lt;br /&gt;
    # if participants_with_min_assigned_reviews is blank&lt;br /&gt;
    no_particpants = participants_with_min_assigned_reviews.empty?&lt;br /&gt;
    # or only one element in participants_with_min_assigned_reviews, prohibit one student to review his/her own artifact&lt;br /&gt;
    participant_is_owner = (participants_with_min_assigned_reviews.size == 1 and TeamsUser.exists?(team_id: team.id, user_id: participants[participants_with_min_assigned_reviews[0]].user_id))&lt;br /&gt;
    rand_num = if no_particpants or participant_is_owner&lt;br /&gt;
                 # use original method to get random number&lt;br /&gt;
                 rand(0..num_participants - 1)&lt;br /&gt;
               else&lt;br /&gt;
                 # rand_num should be the position of this participant in original array&lt;br /&gt;
                 participants_with_min_assigned_reviews[rand(0..participants_with_min_assigned_reviews.size - 1)]&lt;br /&gt;
               end&lt;br /&gt;
    end&lt;br /&gt;
    return rand_num&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Helper Method to check num_reviews_per_student and num_reviews_per_submission arguments passed in by params hash.&lt;br /&gt;
  def check_num_reviews_args(num_reviews_per_student, num_reviews_per_submission, teams)&lt;br /&gt;
    has_error_not_raised = true&lt;br /&gt;
    # check for exit paths first&lt;br /&gt;
    if num_reviews_per_student == 0 and num_reviews_per_submission == 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student).&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student != 0 and num_reviews_per_submission != 0&lt;br /&gt;
      flash[:error] = &amp;quot;Please choose either the number of reviews per student or the number of reviewers per team (student), not both.&amp;quot;&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    elsif num_reviews_per_student &amp;gt;= teams.size&lt;br /&gt;
      # Exception detection: If instructor want to assign too many reviews done&lt;br /&gt;
      # by each student, there will be an error msg.&lt;br /&gt;
      flash[:error] = 'You cannot set the number of reviews done ' \&lt;br /&gt;
                       'by each student to be greater than or equal to total number of teams ' \&lt;br /&gt;
                       '[or &amp;quot;participants&amp;quot; if it is an individual assignment].'&lt;br /&gt;
      has_error_not_raised = false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
7. Modularized helper methods into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Before Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
    512 Lines &amp;amp; 25 Methods Defined (After moving a few methods into separate controllers)&lt;br /&gt;
    ...................&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After Modularization&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  module Helper_methods&lt;br /&gt;
  ...................&lt;br /&gt;
  5 Methods and 170 lines&lt;br /&gt;
  ...................&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  class ReviewMappingController &amp;lt; ApplicationController&lt;br /&gt;
    include Helper_methods&lt;br /&gt;
    ...................&lt;br /&gt;
    340 Lines &amp;amp; 20 Methods (All of those are used elsewhere directly in the application)&lt;br /&gt;
    ...................&lt;br /&gt;
  end  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View File Affected by the creation of AssinQuizController&lt;br /&gt;
[[File:View.png]]&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Rspec Unit Tests === &lt;br /&gt;
&lt;br /&gt;
Since this is a Refactoring Project, We made sure that the changes made did not break any functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:testplan.png]]  &lt;br /&gt;
&lt;br /&gt;
Note: Tests have been run for three controllers (one existing and two new). &lt;br /&gt;
&lt;br /&gt;
=== Capybara Integration and Functional Tests === &lt;br /&gt;
&lt;br /&gt;
As the controller routes have been modified in the routes.rb and the other view files, there are potential chances of failures in Integration tests.&lt;br /&gt;
&lt;br /&gt;
However, no such failure has been reported by Travis build.&lt;br /&gt;
&lt;br /&gt;
[[File:Travis CI.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:FeaturesCI.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Coverage == &lt;br /&gt;
&lt;br /&gt;
Code Coverage for Controllers section climbed up. &lt;br /&gt;
&lt;br /&gt;
[https://coveralls.io/builds/26607665] # Link for the COVERALLS stats of our pull request.&lt;br /&gt;
&lt;br /&gt;
[[File:CCC1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Mentor ==&lt;br /&gt;
&lt;br /&gt;
Ramya Vijayakumar (rvijaya4@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Team Members ==&lt;br /&gt;
&lt;br /&gt;
Yaswanth Soodini (ysoodin@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Saurabh Shingte (svshingt@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Vivek Karri (vkarri@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== Links for Demo Videos ==&lt;br /&gt;
&lt;br /&gt;
[https://drive.google.com/file/d/1o9vJQ7fCwk0hwHJdErwpg1z_XjsN_XRT/view?usp=sharing]&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126855</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126855"/>
		<updated>2019-11-02T19:16:19Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Description of the project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is on a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126854</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126854"/>
		<updated>2019-11-02T19:16:00Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Description of the current project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the project ==&lt;br /&gt;
&lt;br /&gt;
The focus of the project is a controller named ReviewMappingController and the primary goal is to make changes to the internal structure of the controller to make it easier to read and cheaper to maintain without changing it's observable behaviour. This can be achieved though refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code, etc.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126853</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126853"/>
		<updated>2019-11-02T19:06:12Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== About Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126852</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126852"/>
		<updated>2019-11-02T19:04:59Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126851</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126851"/>
		<updated>2019-11-02T19:04:05Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126850</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126850"/>
		<updated>2019-11-02T19:03:18Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:wiki.png|alt=Puzzle globe logo]]This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126849</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126849"/>
		<updated>2019-11-02T19:02:46Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:wiki.jpg]]This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
sd&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126848</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126848"/>
		<updated>2019-11-02T18:58:48Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Example.jpg]]This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of the changes made==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' to ‘@instructor = build(:instructor, id: 1)’. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Removed code redundancy from review_mapping_controller_spec.rb. Two variables were being initialized containing the same value. One was in the before(:each) loop and other was being called in first three test cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Replaced the one in the before(:each) loop by @instructor = build(:instructor, id: 1) and used @instructor class variable, wherever required. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Changed :i_dont_care to :no_particular_topic&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *:i_dont_care was used in the /app/views/student_review/_set_dynamic_review.html.erb as a flag to store if student is interested in any particular topic or doesn't care which topic to review.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *It was also used in review_mapping_controller.rb to check if student has selected any particular topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Since, name :i_dont_care was very difficult to understand, we replaced it with something logical such as :no_particular_topic. It gives hint about what the symbol stores.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Removed cascading effects of above change from features spec&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Above changes caused ./spec/features/review_assignment_spec.rb this feature test to fail.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This spec has used the above symbol to check if the list of available topics collapse or not after selecting the I don't care option.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Switch case in above method from review_mapping_controller.rb contained all the actions having the same output for around 70% of cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Hence, replaced the switch statements and initialized a list with those switch cases.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Even the space complexity increased, the tradeoff got balanced because if someone has to change some actions, he will have to just add or remove the action name from the allowed_actions list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *A random participant_id is generated from the possible pool of candidates but the code block for that is kind of a query, i.e. it does not change or set anything.  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *And it is equally complex enough to confuse the reader. So this has been put into a helper method with an expressive name to increase readability. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Parameters such as num_reviews_per_student, num_calibrated_artifacts etc passed are first verified to check if they are in acceptable range or pattern  &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *To increase readability, the not-so good looking sets of if-else statements have been moved into check_num_reviews_args method.  &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Only some of the  methods written in the class have external usage i.e called by another controllers, views etc. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The other methods are just helpers and as such moved into a Helper method module and mixed in the class &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing and did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Internally used methods were not tested &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *Tests for newly created controllers have been moved into a separate spec files. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method assigns a quiz(Stored as an assignment object) to the participant. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *This method is not related to ReviewMapping functionality, so it was made into a new controller. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths present in the views/partials have to be changed to not to break the functionality &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; *The controller paths in views/partials/routes have been changed for the newly created controller of AssignQuizDynamically &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126617</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126617"/>
		<updated>2019-10-29T04:52:39Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Details of changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' ‘@instructor = build(:instructor, id: 1)’ it was being called in first three test cases and in above loop too.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Changed params[:i_dont_care] to params[:no_particular_topic]&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Removed cascading effects of above change from features (CSS)&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing specified in wand did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student. &amp;lt;br/&amp;gt;&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&amp;lt;br/&amp;gt;&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&amp;lt;br/&amp;gt;&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&amp;lt;br/&amp;gt;&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&amp;lt;br/&amp;gt;&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126616</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126616"/>
		<updated>2019-10-29T04:51:05Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Details of changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1944 OSS assignment for Fall 2019, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NC State University. It’s an open-source project developed on Ruby on Rails platform and its codebase is available on Github. It facilitates peer review among the students allowing them to improve their work from the feedback. It also assists the faculty in customizing the specifications for the projects and Assignments.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with a controller namely review_mapping_controller.rb. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing redundant code etc among the other things. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in the current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. review_mapping_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. review_mapping_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. assign_quiz_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
4. assign_quiz_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
5. review_response_map_controller.rb  &amp;lt;br/&amp;gt;&lt;br /&gt;
6. review_response_map_controller_spec.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
7. routes.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Other views &amp;amp; partials associated affected by these changes &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ReviewMappingController ===&lt;br /&gt;
 &lt;br /&gt;
This controller will map the submissions made by the teams to the students for facilitating peer-reviewing. A couple of long and complex methods such as peer_review_strategy and automatic_review_mapping were refactored from this controller along with the removal of some non-related methods such as add_calibration and assign_quiz_dynamically. Variable names have been changed and code has been modularized and helper methods were separated from the important methods into a module and were included in the class.&lt;br /&gt;
&lt;br /&gt;
Test Cases were created for the newly created controllers such as assign_quiz_controller etc.&lt;br /&gt;
&lt;br /&gt;
=== review_mapping_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests were removed from this file which belongs to the isolated methods. &lt;br /&gt;
&lt;br /&gt;
=== AssignQuizController ===&lt;br /&gt;
 &lt;br /&gt;
Assigning Quizzes (Quizzes are also stored in the Assignment table) is not a seemingly/semantically related task to review mapping. Hence this was moved into a separate controller. &lt;br /&gt;
&lt;br /&gt;
=== assign_quiz_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to assign_quiz_controller were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== ReviewResponseMapController.rb ===&lt;br /&gt;
 &lt;br /&gt;
Add Calibration is a nuanced method that has seemingly different functionality than Review Mapping Controller and hence moved into a separate controller.&lt;br /&gt;
&lt;br /&gt;
=== review_response_map_controller_spec.rb ===&lt;br /&gt;
 &lt;br /&gt;
Tests related to review_response_map were moved into this file.&lt;br /&gt;
&lt;br /&gt;
=== routes.rb ===&lt;br /&gt;
&lt;br /&gt;
New routes were added to newly created controllers.&lt;br /&gt;
&lt;br /&gt;
=== views/partials ===&lt;br /&gt;
&lt;br /&gt;
Routes were changed in the views and partials.&lt;br /&gt;
&lt;br /&gt;
== Details of changes ==&lt;br /&gt;
1. Changed 'instructor = build(:instructor)' ‘@instructor = build(:instructor, id: 1)’ it was being called in first three test cases and in above loop too.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Changed params[:i_dont_care] to params[:no_particular_topic]&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Removed cascading effects of above change from features (CSS)&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Created a variable named ‘allowed_actions’ in method choose_case(action_in_params) &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Refactored Peer_review_strategy by using a helper method gen_random_participant_id &amp;lt;br/&amp;gt;&lt;br /&gt;
6. Refactored automatic_review_mapping by using a helper method check_num_reviews_args &amp;lt;br/&amp;gt;&lt;br /&gt;
7. Modularized helper methods (which are not accessed by any other functionality outside the review_mapping_controller) into a module and was mixed in the ReviewMappingController Class. &amp;lt;br/&amp;gt;&lt;br /&gt;
8. Abided to the principles of Magic Tricks of testing specified in wand did not test any internally used methods, The other tests are written were already following this principle. &amp;lt;br/&amp;gt;&lt;br /&gt;
9. Isolated AssignQuizDynamically method into a separate controller as the functionality was not related to ReviewMappingController. &amp;lt;br/&amp;gt;&lt;br /&gt;
10. Associated Specs/routes/views/partials have been modified to adapt the change in controllers. &amp;lt;br/&amp;gt;&lt;br /&gt;
11. student_review_num sounds like a number or an id associated with a student review, while it actually stores the number of reviews that a student can perform. So it is renamed num_reviews_per_student.&lt;br /&gt;
12. submission_review_num sounds like a number or an id associated with a submission review, while it actually stores the total number of reviews that can be performed on a single submission. So it is renamed num_reviews_per_submission.&lt;br /&gt;
13. calibrated_artifacts_num sounds like a number or an id associated with the calibrated artifacts, while it actually stores the number of calibrated artifacts. So it is renamed num_calibrated_artifacts. Similarly, uncalibrated_artifacts_num is renamed num_uncalibrated_artifacts.&lt;br /&gt;
14. participants_hash is not an appropriate name for a hash whose keys are participant ids and values are number of reviews performed by corresponding participants. So it is renamed num_reviews_by_participant_hash.&lt;br /&gt;
15. Extracted a method make_review_strategy (from automatic_review_mapping_strategy) that returns a review_strategy based on the values of num_reviews_per_submission and num_reviews_per_submission.&lt;br /&gt;
16. add_calibration is a method that changes the attribute of a ReviewResponseMap and has little to do with Review Mapping. So it is now put in a separate controller named ReviewResponseMapController.&lt;br /&gt;
17. The name add_reviewer may lead the reader to think that the method adds a reviewer to a collection of reviewers (e.g. a list of reviewers). Changing the name to assign_reviewer_manually informs the reader that the method assigns a reviewer (to a submission) and hence improves the readability of the code.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126389</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126389"/>
		<updated>2019-10-29T02:27:09Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Description of the current project */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and  the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with the ReviewMappingController. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2. GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GradesController ===&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
=== GradesHelper ===&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
*Refactoring calculate_all_penalties method&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
&lt;br /&gt;
The following changes were made:&lt;br /&gt;
&lt;br /&gt;
1. This method was very complex, performing too many functions within a single method and had to be broken into 3 smaller methods each having a more well defined function.&lt;br /&gt;
2. The following 3 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
   i.  calculate_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
   ii. calculate_penatly_attributes&amp;lt;br&amp;gt;&lt;br /&gt;
   iii. assign_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
3. Changes were also made to make the code follow ruby style.The language was made more ruby friendly.&lt;br /&gt;
4. Finally some redundant code was commented out as it was non-functional.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
[[File:Change6_new.png]]&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
[[File:Change5_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Move the redundant piece of code from conflict_notification &amp;amp; edit methods to a new method list_questions &lt;br /&gt;
&lt;br /&gt;
The conflict_notification method is used to help the instructors decide if one of the reviews are unfair or inaccurate.&lt;br /&gt;
This was again split into 2 methods with some part of the code which is repeated in another method  refactored into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
  &lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
edit method:&lt;br /&gt;
&lt;br /&gt;
This method is used to edit the questionnaires. This method again has code which is repeated in the conflict_notification method and thus the repeated section was split into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change2_new.png]]&lt;br /&gt;
&lt;br /&gt;
New method:&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
&lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
Similar refactoring was performed to obtain the retrieve_questions method:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest1.png]]&lt;br /&gt;
&lt;br /&gt;
This is the new method created after the above refactoring:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest2.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
There were no existing test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method. The specs were run on the previous and current files and they return the same results implying that the refactored code does not break anything.&lt;br /&gt;
As the model was not changed, no test cases were added for the model.&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Following steps needs to be performed to test this code from UI:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Login as instructor. Create a course and an assignment under that course.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Keep the has team checkbox checked while creating the assignment. Add a grading rubric to it. Add at least two students as participants to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Create topics for the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Sign in as one of the students who were added to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Go to the assignment and sign up for a topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
6. Submit student's work by clicking 'Your work' under that assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
7. Sign in as a different student which is participant of the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
8. Go to Assignments--&amp;gt;&amp;lt;assignment name&amp;gt;--&amp;gt;Others' work (If the link is disabled, login as instructor and change the due date of the assignment to current time).&amp;lt;br/&amp;gt;&lt;br /&gt;
9. Give reviews on first student's work.&amp;lt;br/&amp;gt;&lt;br /&gt;
10. Login as instructor or first student to look at the review grades.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
1. The construct_table method in GradesHelper is not used anywhere. It has no reference in the project. So we feel it can be safely removed.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. The has_team_and_metareview? method in GradesHelper can be broken down into separate methods, one each for team and metareview. This will provide improved flexibility. It needs some analysis though, as both the entities(team &amp;amp; metareview) are currently checked in conjuction from all the views they are referenced from.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126388</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126388"/>
		<updated>2019-10-29T02:26:29Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: /* Peer Review Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and  the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2. GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GradesController ===&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
=== GradesHelper ===&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
*Refactoring calculate_all_penalties method&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
&lt;br /&gt;
The following changes were made:&lt;br /&gt;
&lt;br /&gt;
1. This method was very complex, performing too many functions within a single method and had to be broken into 3 smaller methods each having a more well defined function.&lt;br /&gt;
2. The following 3 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
   i.  calculate_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
   ii. calculate_penatly_attributes&amp;lt;br&amp;gt;&lt;br /&gt;
   iii. assign_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
3. Changes were also made to make the code follow ruby style.The language was made more ruby friendly.&lt;br /&gt;
4. Finally some redundant code was commented out as it was non-functional.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
[[File:Change6_new.png]]&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
[[File:Change5_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Move the redundant piece of code from conflict_notification &amp;amp; edit methods to a new method list_questions &lt;br /&gt;
&lt;br /&gt;
The conflict_notification method is used to help the instructors decide if one of the reviews are unfair or inaccurate.&lt;br /&gt;
This was again split into 2 methods with some part of the code which is repeated in another method  refactored into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
  &lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
edit method:&lt;br /&gt;
&lt;br /&gt;
This method is used to edit the questionnaires. This method again has code which is repeated in the conflict_notification method and thus the repeated section was split into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change2_new.png]]&lt;br /&gt;
&lt;br /&gt;
New method:&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
&lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
Similar refactoring was performed to obtain the retrieve_questions method:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest1.png]]&lt;br /&gt;
&lt;br /&gt;
This is the new method created after the above refactoring:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest2.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
There were no existing test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method. The specs were run on the previous and current files and they return the same results implying that the refactored code does not break anything.&lt;br /&gt;
As the model was not changed, no test cases were added for the model.&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Following steps needs to be performed to test this code from UI:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Login as instructor. Create a course and an assignment under that course.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Keep the has team checkbox checked while creating the assignment. Add a grading rubric to it. Add at least two students as participants to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Create topics for the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Sign in as one of the students who were added to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Go to the assignment and sign up for a topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
6. Submit student's work by clicking 'Your work' under that assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
7. Sign in as a different student which is participant of the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
8. Go to Assignments--&amp;gt;&amp;lt;assignment name&amp;gt;--&amp;gt;Others' work (If the link is disabled, login as instructor and change the due date of the assignment to current time).&amp;lt;br/&amp;gt;&lt;br /&gt;
9. Give reviews on first student's work.&amp;lt;br/&amp;gt;&lt;br /&gt;
10. Login as instructor or first student to look at the review grades.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
1. The construct_table method in GradesHelper is not used anywhere. It has no reference in the project. So we feel it can be safely removed.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. The has_team_and_metareview? method in GradesHelper can be broken down into separate methods, one each for team and metareview. This will provide improved flexibility. It needs some analysis though, as both the entities(team &amp;amp; metareview) are currently checked in conjuction from all the views they are referenced from.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126387</id>
		<title>CSC/ECE 517 Fall 2019 - E1944. Refactor review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1944._Refactor_review_mapping_controller&amp;diff=126387"/>
		<updated>2019-10-29T02:26:09Z</updated>

		<summary type="html">&lt;p&gt;Ysoodin: Created page with &amp;quot;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.  == Peer Review Information ==  For users intending to view the deplo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1555 OSS assignment for Fall 2015, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and  the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with the GradesController and GradesHelper. It focusses on refactoring some of the more complex methods, modifying some of the language to make it more Ruby friendly, removing some redundant code. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A controller and a helper file were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. GradesController &amp;lt;br/&amp;gt;&lt;br /&gt;
2. GradesHelper &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GradesController ===&lt;br /&gt;
 &lt;br /&gt;
This is a controller that helps students and instructors view grades and reviews, update scores, check for grading conflicts and calculate penalties. A couple of long and complex methods were refactored from this controller along with removal of some non-functional code and a few language changes to make it Ruby style.&lt;br /&gt;
Three methods in particular, namely conflict_notification ,calculate_all_penalties and edit were found to be too long and were in need of refactoring into smaller, easier to manage methods. Few more  compact methods were created for this purpose.&lt;br /&gt;
&lt;br /&gt;
There were no existing test cases for the controller. We have added a spec file named 'grades_spec.rb' under the spec folder. As no changes were done for the model, no tests for the model were included.&lt;br /&gt;
&lt;br /&gt;
=== GradesHelper ===&lt;br /&gt;
&lt;br /&gt;
This is a helper class which contains methods for constructing a table(construct_table) and to check whether an assignment has a team and metareveiw(has_team_and_metareview)&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor calculate_all_penalties method into smaller methods&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Move the repeated code in conflict_notification &amp;amp; edit methods to a separate method list_questions.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor the code as per the Ruby style guidelines and incorporate the good practices&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Test the conflict_notification method to test the changes made.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Move the repeated code in view and view_my_scores methods to a separate method retrieve_questions&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
*Refactoring calculate_all_penalties method&lt;br /&gt;
&lt;br /&gt;
This is used to calculate various penalty values for each assignment if penalty is applicable.&lt;br /&gt;
&lt;br /&gt;
The following changes were made:&lt;br /&gt;
&lt;br /&gt;
1. This method was very complex, performing too many functions within a single method and had to be broken into 3 smaller methods each having a more well defined function.&lt;br /&gt;
2. The following 3 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
   i.  calculate_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
   ii. calculate_penatly_attributes&amp;lt;br&amp;gt;&lt;br /&gt;
   iii. assign_all_penalties&amp;lt;br&amp;gt;&lt;br /&gt;
3. Changes were also made to make the code follow ruby style.The language was made more ruby friendly.&lt;br /&gt;
4. Finally some redundant code was commented out as it was non-functional.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Refactoring into smaller more specific methods:&lt;br /&gt;
&lt;br /&gt;
[[File:Change6_new.png]]&lt;br /&gt;
&lt;br /&gt;
Removal of non-functional code :&lt;br /&gt;
&lt;br /&gt;
[[File:Change5_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change of language to make it more Ruby friendly:&lt;br /&gt;
&lt;br /&gt;
[[File:Change1_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Move the redundant piece of code from conflict_notification &amp;amp; edit methods to a new method list_questions &lt;br /&gt;
&lt;br /&gt;
The conflict_notification method is used to help the instructors decide if one of the reviews are unfair or inaccurate.&lt;br /&gt;
This was again split into 2 methods with some part of the code which is repeated in another method  refactored into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
  &lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
edit method:&lt;br /&gt;
&lt;br /&gt;
This method is used to edit the questionnaires. This method again has code which is repeated in the conflict_notification method and thus the repeated section was split into a new method.&lt;br /&gt;
&lt;br /&gt;
[[File:Change2_new.png]]&lt;br /&gt;
&lt;br /&gt;
New method:&lt;br /&gt;
Refactored #Created a method which was a duplicate in conflict_notification and edit methods&lt;br /&gt;
&lt;br /&gt;
[[File:Change4_new.png]]&lt;br /&gt;
&lt;br /&gt;
Similar refactoring was performed to obtain the retrieve_questions method:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest1.png]]&lt;br /&gt;
&lt;br /&gt;
This is the new method created after the above refactoring:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest2.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
There were no existing test cases for the GradesController. We have added a new spec file 'grades_spec.rb' which covers testing scenario for the newly added method. The specs were run on the previous and current files and they return the same results implying that the refactored code does not break anything.&lt;br /&gt;
As the model was not changed, no test cases were added for the model.&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Following steps needs to be performed to test this code from UI:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Login as instructor. Create a course and an assignment under that course.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Keep the has team checkbox checked while creating the assignment. Add a grading rubric to it. Add at least two students as participants to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. Create topics for the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Sign in as one of the students who were added to the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Go to the assignment and sign up for a topic.&amp;lt;br/&amp;gt;&lt;br /&gt;
6. Submit student's work by clicking 'Your work' under that assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
7. Sign in as a different student which is participant of the assignment.&amp;lt;br/&amp;gt;&lt;br /&gt;
8. Go to Assignments--&amp;gt;&amp;lt;assignment name&amp;gt;--&amp;gt;Others' work (If the link is disabled, login as instructor and change the due date of the assignment to current time).&amp;lt;br/&amp;gt;&lt;br /&gt;
9. Give reviews on first student's work.&amp;lt;br/&amp;gt;&lt;br /&gt;
10. Login as instructor or first student to look at the review grades.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
1. The construct_table method in GradesHelper is not used anywhere. It has no reference in the project. So we feel it can be safely removed.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. The has_team_and_metareview? method in GradesHelper can be broken down into separate methods, one each for team and metareview. This will provide improved flexibility. It needs some analysis though, as both the entities(team &amp;amp; metareview) are currently checked in conjuction from all the views they are referenced from.&lt;/div&gt;</summary>
		<author><name>Ysoodin</name></author>
	</entry>
</feed>