<?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=Wchen37</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=Wchen37"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Wchen37"/>
	<updated>2026-09-07T10:19:05Z</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_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=147178</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=147178"/>
		<updated>2022-12-06T01:44:47Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Code Modifications ( Work Completed) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This attribute is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the attribute.&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb &lt;br /&gt;
&lt;br /&gt;
* The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller. It is also indicative of poor class design and violation of the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to create/delete new topics for an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Remove violations of Single Responsibility principle by refactoring the design of the controller.&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''Controller Re-design'''&lt;br /&gt;
&lt;br /&gt;
The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller.Upon analysis, we found that signup_sheet controller has methods related to creating/updating and deleting topics as well as methods to create and delete a sign-up for those topics in an assignment. This is certainly a violation of the Single Responsibility principle as this controller handles responsibilties of both topic CRUD and signup CRUD operations. To fix this, we have proposed to split this controller and create a new controller for Topics to manage its responsibilities. We plan to split up the methods as per below Class Diagram -&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASS.PNG|300px|Image: 300 pixels]]&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASSNEW.PNG|500px|Image: 500 pixels]]&lt;br /&gt;
&lt;br /&gt;
The new design follows '''Single Responsibility''', and the methods were split up on the basis of '''Information Expert''' pattern. Using the principle of Information Expert, a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfill it, and then determine where that information is stored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by the current rspec. Further, new tests will have to added/ old tests will have to be repurposed to check the newly designed Topic controller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper modules:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Verify setting up staggered deadlines of signup topics in assignments&lt;br /&gt;
# Login as instructor&lt;br /&gt;
# Hover on &amp;quot;Manage&amp;quot; Tab&lt;br /&gt;
# Click on &amp;quot;Assignments&amp;quot; Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;Wikipedia contribution&amp;quot; assignment&lt;br /&gt;
# Select &amp;quot;Staggered deadline assignnment?&amp;quot; checkbox&lt;br /&gt;
# Click &amp;quot;OK&amp;quot; at the popping up dialog&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# Click on &amp;quot;Topics&amp;quot; Tab&lt;br /&gt;
# Scroll down to the bottom and click &amp;quot;Show start/due date&amp;quot;&lt;br /&gt;
# Find out 2 topics, which are selected by at least 1 student, respectively&lt;br /&gt;
# Setup different deadlines for them and make sure one topic is in submission stage and the other one is in review stage&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# The updates should be saved without any error&lt;br /&gt;
# Sign in as one of the students for each topic, you should see different stages of the assignment &amp;quot;Wikipedia contribution&amp;quot; in the assignment list&lt;br /&gt;
&lt;br /&gt;
== Code Modifications ( Work Completed) ==&lt;br /&gt;
&lt;br /&gt;
* '''Is_intelligent (Swetha)'''&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
* '''Participants variable'''&lt;br /&gt;
References to participants (plural) have been replaced with @team_members for clarity, consistency as team_members was used in a similar fashion elsewhere in the controller and to avoid clashing with @participant (singular), which is used in many areas.&lt;br /&gt;
&lt;br /&gt;
Example Old:&lt;br /&gt;
 &amp;lt;% @participants = SignedUpTeam.find_team_participants(@assignment.id, session[:ip])  %&amp;gt;&lt;br /&gt;
Example New:&lt;br /&gt;
 &amp;lt;% @team_members = SignedUpTeam.find_team_participants(@assignment.id, session[:ip])  %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Commit : https://github.com/weichic-ncsu/expertiza/commit/7b8a230f8d0ddb3953ec3a9db8506caa2bb691e4&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
* '''Staggered Deadlines of Topics in Assignment'''&lt;br /&gt;
&lt;br /&gt;
:* Added back views rendered for staggered deadlines in the signup sheet&lt;br /&gt;
&lt;br /&gt;
:* Fixed controller error of this feature&lt;br /&gt;
&lt;br /&gt;
:* Tested this feature with demo video&lt;br /&gt;
&lt;br /&gt;
Example Old:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= form_tag controller: 'assignment', action: 'edit', assignment_id: @assignment.id do %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example New:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= form_tag controller: 'assignments', action: 'edit', assignment_id: @assignment.id do %&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Commits:&lt;br /&gt;
&lt;br /&gt;
# https://github.com/weichic-ncsu/expertiza/commit/6dd51b6629ac020d6dd65ef9994a638041106f87&lt;br /&gt;
# https://github.com/weichic-ncsu/expertiza/commit/2853eaf37f36f6e1291a14faaeca715bcbfe15e8&lt;br /&gt;
# https://github.com/weichic-ncsu/expertiza/commit/e38c3cba2625c613b836f056273492c53f9bbad8&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
* '''Add_signup_topics'''&lt;br /&gt;
&lt;br /&gt;
Previously we encountered an error page when attempting to create a topic with the same name as an existing topic. The functionality was set up to update the attributes of the existing topic and then redirect the user to add_signup_topics. However this route was broken ( from an error in a different controller class) and the functionality was very unclear from reading the code.&lt;br /&gt;
&lt;br /&gt;
We have changed this so that when the user attempts to create a new topic with the same name as an existing topic, the topic attributes are updated as before, but the user is instead redirected back to the topics tab of the assignment edit page.&lt;br /&gt;
&lt;br /&gt;
Old  ( in def update_existing_topic )&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
New:&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to edit_assignment_path(params[:id], anchor: 'tabs-2')&lt;br /&gt;
&lt;br /&gt;
With this change we were also able to remove the below method: &lt;br /&gt;
&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) : &lt;br /&gt;
    (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We also updated the corresponding rspec tests to reflect the change:&lt;br /&gt;
&lt;br /&gt;
old:&lt;br /&gt;
   expect(response).to redirect_to('/signup_sheet/add_signup_topics?id=1')&lt;br /&gt;
new:&lt;br /&gt;
   expect(response).to redirect_to('/assignments/1/edit#tabs-2')&lt;br /&gt;
&lt;br /&gt;
commits:&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/5dec776b7355290efde7e2249de83d89fd0dd259&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/8ab175b02cf825f5f414e04e33f1790da0f1bd93&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1dcd1b8107657fbeaaea60a586e6705dc0cf3404&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
* '''Methods removed (Swetha)'''&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
* '''Methods moved (Swetha)'''&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=147121</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=147121"/>
		<updated>2022-12-05T22:52:07Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Code Modifications ( Work Completed) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This attribute is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the attribute.&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb &lt;br /&gt;
&lt;br /&gt;
* The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller. It is also indicative of poor class design and violation of the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to create/delete new topics for an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Remove violations of Single Responsibility principle by refactoring the design of the controller.&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''Controller Re-design'''&lt;br /&gt;
&lt;br /&gt;
The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller.Upon analysis, we found that signup_sheet controller has methods related to creating/updating and deleting topics as well as methods to create and delete a sign-up for those topics in an assignment. This is certainly a violation of the Single Responsibility principle as this controller handles responsibilties of both topic CRUD and signup CRUD operations. To fix this, we have proposed to split this controller and create a new controller for Topics to manage its responsibilities. We plan to split up the methods as per below Class Diagram -&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASS.PNG|300px|Image: 300 pixels]]&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASSNEW.PNG|500px|Image: 500 pixels]]&lt;br /&gt;
&lt;br /&gt;
The new design follows '''Single Responsibility''', and the methods were split up on the basis of '''Information Expert''' pattern. Using the principle of Information Expert, a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfill it, and then determine where that information is stored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by the current rspec. Further, new tests will have to added/ old tests will have to be repurposed to check the newly designed Topic controller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper modules:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Verify setting up staggered deadlines of signup topics in assignments&lt;br /&gt;
# Login as instructor&lt;br /&gt;
# Hover on &amp;quot;Manage&amp;quot; Tab&lt;br /&gt;
# Click on &amp;quot;Assignments&amp;quot; Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;Wikipedia contribution&amp;quot; assignment&lt;br /&gt;
# Select &amp;quot;Staggered deadline assignnment?&amp;quot; checkbox&lt;br /&gt;
# Click &amp;quot;OK&amp;quot; at the popping up dialog&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# Click on &amp;quot;Topics&amp;quot; Tab&lt;br /&gt;
# Scroll down to the bottom and click &amp;quot;Show start/due date&amp;quot;&lt;br /&gt;
# Find out 2 topics, which are selected by at least 1 student, respectively&lt;br /&gt;
# Setup different deadlines for them and make sure one topic is in submission stage and the other one is in review stage&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# The updates should be saved without any error&lt;br /&gt;
# Sign in as one of the students for each topic, you should see different stages of the assignment &amp;quot;Wikipedia contribution&amp;quot; in the assignment list&lt;br /&gt;
&lt;br /&gt;
== Code Modifications ( Work Completed) ==&lt;br /&gt;
&lt;br /&gt;
* Is_intelligent (Swetha)&lt;br /&gt;
&lt;br /&gt;
* Participants variable (Juan)&lt;br /&gt;
&lt;br /&gt;
* Staggered Deadlines of Topics in Assignment&lt;br /&gt;
&lt;br /&gt;
:* Added back views rendered for staggered deadlines in the signup sheet&lt;br /&gt;
&lt;br /&gt;
:* Fixed controller error of this feature&lt;br /&gt;
&lt;br /&gt;
:* Tested this feature with demo video&lt;br /&gt;
&lt;br /&gt;
* Add_signup_topics (Juan)&lt;br /&gt;
&lt;br /&gt;
* Methods removed (Swetha)&lt;br /&gt;
&lt;br /&gt;
* Methods moved (Swetha)&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146986</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146986"/>
		<updated>2022-12-04T20:38:54Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Mandatory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This attribute is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the attribute.&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb &lt;br /&gt;
&lt;br /&gt;
* The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller. It is also indicative of poor class design and violation of the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to create/delete new topics for an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Remove violations of Single Responsibility principle by refactoring the design of the controller.&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''Controller Re-design'''&lt;br /&gt;
&lt;br /&gt;
The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller.Upon analysis, we found that signup_sheet controller has methods related to creating/updating and deleting topics as well as methods to create and delete a sign-up for those topics in an assignment. This is certainly a violation of the Single Responsibility principle as this controller handles responsibilties of both topic CRUD and signup CRUD operations. To fix this, we have proposed to split this controller and create a new controller for Topics to manage its responsibilities. We plan to split up the methods as per below Class Diagram -&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASS.PNG|300px|Image: 300 pixels]]&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASSNEW.PNG|500px|Image: 500 pixels]]&lt;br /&gt;
&lt;br /&gt;
The new design follows '''Single Responsibility''', and the methods were split up on the basis of '''Information Expert''' pattern. Using the principle of Information Expert, a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfill it, and then determine where that information is stored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by the current rspec. Further, new tests will have to added/ old tests will have to be repurposed to check the newly designed Topic controller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper modules:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Verify setting up staggered deadlines of signup topics in assignments&lt;br /&gt;
# Login as instructor&lt;br /&gt;
# Hover on &amp;quot;Manage&amp;quot; Tab&lt;br /&gt;
# Click on &amp;quot;Assignments&amp;quot; Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;Wikipedia contribution&amp;quot; assignment&lt;br /&gt;
# Select &amp;quot;Staggered deadline assignnment?&amp;quot; checkbox&lt;br /&gt;
# Click &amp;quot;OK&amp;quot; at the popping up dialog&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# Click on &amp;quot;Topics&amp;quot; Tab&lt;br /&gt;
# Scroll down to the bottom and click &amp;quot;Show start/due date&amp;quot;&lt;br /&gt;
# Find out 2 topics, which are selected by at least 1 student, respectively&lt;br /&gt;
# Setup different deadlines for them and make sure one topic is in submission stage and the other one is in review stage&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# The updates should be saved without any error&lt;br /&gt;
# Sign in as one of the students for each topic, you should see different stages of the assignment &amp;quot;Wikipedia contribution&amp;quot; in the assignment list&lt;br /&gt;
&lt;br /&gt;
== Code Modifications==&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146941</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146941"/>
		<updated>2022-12-01T20:01:05Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Mandatory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This attribute is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the attribute.&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb &lt;br /&gt;
&lt;br /&gt;
* The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller. It is also indicative of poor class design and violation of the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to create/delete new topics for an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Remove violations of Single Responsibility principle by refactoring the design of the controller.&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''Controller Re-design'''&lt;br /&gt;
&lt;br /&gt;
The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller.Upon analysis, we found that signup_sheet controller has methods related to creating/updating and deleting topics as well as methods to create and delete a sign-up for those topics in an assignment. This is certainly a violation of the Single Responsibility principle as this controller handles responsibilties of both topic CRUD and signup CRUD operations. To fix this, we have proposed to split this controller and create a new controller for Topics to manage its responsibilities. We plan to split up the methods as per below Class Diagram -&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASS.PNG|300px|Image: 300 pixels]]&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASSNEW.PNG|500px|Image: 500 pixels]]&lt;br /&gt;
&lt;br /&gt;
The new design follows '''Single Responsibility''', and the methods were split up on the basis of '''Information Expert''' pattern. Using the principle of Information Expert, a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfill it, and then determine where that information is stored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by the current rspec. Further, new tests will have to added/ old tests will have to be repurposed to check the newly designed Topic controller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper modules:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Verify setting up staggered deadlines of signup topics in assignments&lt;br /&gt;
# Login as instructor&lt;br /&gt;
# Hover on &amp;quot;Manage&amp;quot; Tab&lt;br /&gt;
# Click on &amp;quot;Assignments&amp;quot; Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;Wikipedia contribution&amp;quot; assignment&lt;br /&gt;
# Select &amp;quot;Staggered deadline assignnment?&amp;quot; checkbox&lt;br /&gt;
# Click &amp;quot;OK&amp;quot; at the popping up dialog&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# Click on &amp;quot;Topics&amp;quot; Tab&lt;br /&gt;
# Scroll down to the bottom and click &amp;quot;Show start/due date&amp;quot;&lt;br /&gt;
# Setup submission deadlines and review deadlines for at least 2 topics, and make sure the deadlines in these 2 topics are different&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# The updates should be saved without any error&lt;br /&gt;
&lt;br /&gt;
Normal signup topics&lt;br /&gt;
[[File:Topics_No_Staggered.png]]&lt;br /&gt;
&lt;br /&gt;
Set staggered deadlines for topics&lt;br /&gt;
[[File:Topics_Set_Staggered.png]]&lt;br /&gt;
[[File:Topics_Staggered.png]]&lt;br /&gt;
[[File:Topics_Staggered_Set_Due_Date.png]]&lt;br /&gt;
&lt;br /&gt;
Results&lt;br /&gt;
[[File:Set_Staggered.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Modifications==&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Set_Staggered.png&amp;diff=146940</id>
		<title>File:Set Staggered.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Set_Staggered.png&amp;diff=146940"/>
		<updated>2022-12-01T19:56:05Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_Staggered_Set_Due_Date.png&amp;diff=146939</id>
		<title>File:Topics Staggered Set Due Date.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_Staggered_Set_Due_Date.png&amp;diff=146939"/>
		<updated>2022-12-01T19:55:53Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_Staggered.png&amp;diff=146938</id>
		<title>File:Topics Staggered.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_Staggered.png&amp;diff=146938"/>
		<updated>2022-12-01T19:55:39Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_Set_Staggered.png&amp;diff=146937</id>
		<title>File:Topics Set Staggered.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_Set_Staggered.png&amp;diff=146937"/>
		<updated>2022-12-01T19:55:17Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_No_Staggered.png&amp;diff=146936</id>
		<title>File:Topics No Staggered.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Topics_No_Staggered.png&amp;diff=146936"/>
		<updated>2022-12-01T19:54:49Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146935</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146935"/>
		<updated>2022-12-01T19:54:02Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Mandatory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This attribute is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the attribute.&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb &lt;br /&gt;
&lt;br /&gt;
* The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller. It is also indicative of poor class design and violation of the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to create/delete new topics for an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Remove violations of Single Responsibility principle by refactoring the design of the controller.&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''Controller Re-design'''&lt;br /&gt;
&lt;br /&gt;
The signup_sheet controller currently has 30 methods, which is a violation of the upper limit for methods in a controller.Upon analysis, we found that signup_sheet controller has methods related to creating/updating and deleting topics as well as methods to create and delete a sign-up for those topics in an assignment. This is certainly a violation of the Single Responsibility principle as this controller handles responsibilties of both topic CRUD and signup CRUD operations. To fix this, we have proposed to split this controller and create a new controller for Topics to manage its responsibilities. We plan to split up the methods as per below Class Diagram -&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASS.PNG|300px|Image: 300 pixels]]&lt;br /&gt;
&lt;br /&gt;
[[File:SUPCLASSNEW.PNG|500px|Image: 500 pixels]]&lt;br /&gt;
&lt;br /&gt;
The new design follows '''Single Responsibility''', and the methods were split up on the basis of '''Information Expert''' pattern. Using the principle of Information Expert, a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfill it, and then determine where that information is stored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by the current rspec. Further, new tests will have to added/ old tests will have to be repurposed to check the newly designed Topic controller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper modules:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Verify setting up staggered deadlines of signup topics in assignments&lt;br /&gt;
# Login as instructor&lt;br /&gt;
# Hover on &amp;quot;Manage&amp;quot; Tab&lt;br /&gt;
# Click on &amp;quot;Assignments&amp;quot; Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;Wikipedia contribution&amp;quot; assignment&lt;br /&gt;
# Select &amp;quot;Staggered deadline assignnment?&amp;quot; checkbox&lt;br /&gt;
# Click &amp;quot;OK&amp;quot; at the popping up dialog&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# Click on &amp;quot;Topics&amp;quot; Tab&lt;br /&gt;
# Scroll down to the bottom and click &amp;quot;Show start/due date&amp;quot;&lt;br /&gt;
# Setup submission deadlines and review deadlines for at least 2 topics, and make sure the deadlines in these 2 topics are different&lt;br /&gt;
# Click &amp;quot;Save&amp;quot; button&lt;br /&gt;
# The updates should be saved without any error&lt;br /&gt;
&lt;br /&gt;
== Code Modifications==&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146679</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146679"/>
		<updated>2022-11-16T00:11:41Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Plan of Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by  the current rspec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
         it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do&lt;br /&gt;
           ...&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
Further changes include reducing these number of checks to reduce coupling with other modules.&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper module:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
== Code Modifications==&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146678</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146678"/>
		<updated>2022-11-16T00:06:27Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Plan of Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by  the current rspec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
     context 'when topic can be found' do&lt;br /&gt;
       context 'when assignment.staggered_deadline is True' do&lt;br /&gt;
         ...&lt;br /&gt;
       context 'when assignment.staggered_deadline is False' do&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
Further changes include reducing these number of checks to reduce coupling with other modules.&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper module:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
== Code Modifications==&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146675</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146675"/>
		<updated>2022-11-16T00:02:50Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Plan of Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
* Increase Cohesion and Minimize Coupling&lt;br /&gt;
&lt;br /&gt;
* DRY out the code wherever possible&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity by naming methods and variables appropriately&lt;br /&gt;
&lt;br /&gt;
* Improve code clarity of the controller by moving non-CRUD methods to helper functions wherever applicable&lt;br /&gt;
&lt;br /&gt;
==Plan of Work==&lt;br /&gt;
&lt;br /&gt;
* '''@Participants variable'''&lt;br /&gt;
&lt;br /&gt;
References to @participants is scattered throughout the project, including some references in signup sheet views. This variable was removed in the signup sheet controller in the previous pull request for the Fall 2022 OSS project, but references in views have not been removed. In the OSS project we noticed that test coverage for some of the methods/views in this controller were incomplete, so we should make sure the removal of this variable does not cause problems. The naming could also use improvement, as only teams are allowed to signup for projects.&lt;br /&gt;
&lt;br /&gt;
[[File:participantsVar.png]]&lt;br /&gt;
&lt;br /&gt;
There is also naming confusion because the controller has many references to the (singular) participant variable, and it is not clear how the two are supposed to be different. So better comments/naming is important.&lt;br /&gt;
&lt;br /&gt;
    def delete_signup&lt;br /&gt;
        participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
    def list&lt;br /&gt;
        @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
        @assignment = @participant.assignment&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
* '''Increase Test Coverage'''&lt;br /&gt;
We noticed that in general the controller could use more/better rspec tests as some error pages we encountered while manually testing were not captured by  the current rspec&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*''' Address and test effects of add_signup_topics_staggered '''&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Assignment is_intelligent attribute is a source of confusion'''&lt;br /&gt;
&lt;br /&gt;
There are several checks for @assignment.is_intelligent across the controllers and views. This attribute is atrociously named. It &lt;br /&gt;
simply checks for whether bidding is being used to assign topics. &lt;br /&gt;
&lt;br /&gt;
Proposed changes include renaming the attribute to bid_for_topics which more accurately captures its purpose.&lt;br /&gt;
If this attribute were to be renamed, it would involve a lot of changes across the project - &lt;br /&gt;
&lt;br /&gt;
:* The schema for Assignment would have to be updated&lt;br /&gt;
        t.boolean &amp;quot;is_intelligent&amp;quot;&lt;br /&gt;
:* All creation of Assignment objects across the code and specs would have to be changed&lt;br /&gt;
        &lt;br /&gt;
     context 'when current assignment is not intelligent assignment' do&lt;br /&gt;
      it 'renders signup_sheet#list page' do&lt;br /&gt;
        assignment.is_intelligent = false&lt;br /&gt;
        allow(Bid).to receive(:where).with(team_id: 1).and_return([double('Bid', topic_id: 1)])&lt;br /&gt;
        request_params = { id: 1 }&lt;br /&gt;
        get :list, params: request_params&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
:* Existing test or sample DB data for Assignments would also have to be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
:* Views including tree_display would also be affected as they contain checks like this -&lt;br /&gt;
&lt;br /&gt;
       (props) =&amp;gt;&lt;br /&gt;
        props.is_intelligent&lt;br /&gt;
          ? {&lt;br /&gt;
              title: 'Intelligent Assignment',&lt;br /&gt;
              href: '/lottery/run_intelligent_assignment/' + `${parseInt(props.id) / 2}`,&lt;br /&gt;
              src: '/assets/tree_view/run-lottery.png'&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
Further changes include reducing these number of checks to reduce coupling with other modules.&lt;br /&gt;
&lt;br /&gt;
* ''' Code Climate Issues '''&lt;br /&gt;
https://codeclimate.com/github/expertiza/expertiza/app/controllers/sign_up_sheet_controller.rb#&lt;br /&gt;
&lt;br /&gt;
Some issues observed on Code Climate for this controller - &lt;br /&gt;
:* Class SignUpSheetController has 32 methods (exceeds 20 allowed).&lt;br /&gt;
:* Class has too many lines. [393/100]&lt;br /&gt;
&lt;br /&gt;
We plan to move some methods that are not directly involves in CRUD to the helper module:&lt;br /&gt;
update_waitlist&lt;br /&gt;
compute_signed_up_topics&lt;br /&gt;
add_signup_topics,&lt;br /&gt;
set_values_for_new_topic,&lt;br /&gt;
set_priority,&lt;br /&gt;
switch_original_topic_to_approved_suggested_topic&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
* New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
== Code Modifications==&lt;br /&gt;
&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146564</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146564"/>
		<updated>2022-11-15T11:05:34Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Plan and List of Work done (specific tasks planned) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument.&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
* New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146563</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146563"/>
		<updated>2022-11-15T11:04:56Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Prior Work section with last years and last projects background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
:* DRYed out code used to check for certain errors; however, that was done using an array of messages and then selecting one of them using a constant subscript, whereas it would have been better to pass the messages as parameters.&lt;br /&gt;
:* The compute_signup_topics method returns results by side-effects (in instance variables); probably this could have been done more cleanly.&lt;br /&gt;
:* Most of the changes involve regularizing use of &amp;quot;sign_up&amp;quot; vs. &amp;quot;signup&amp;quot;; this should ideally be done in a separate commit so it would be mergeable without merging the whole project.&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
* New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146562</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146562"/>
		<updated>2022-11-15T11:01:18Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* RSpec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
:* rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
: We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
:* rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
:* rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
* New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]]&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146561</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146561"/>
		<updated>2022-11-15T10:59:35Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Plan and List of Work done (specific tasks planned) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
:* Work done&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* When creating a topic which could be found, test the availability in different values of assignment.staggered_deadline.&lt;br /&gt;
&lt;br /&gt;
:* Plan&lt;br /&gt;
::* RSpec&lt;br /&gt;
:::* Test add_signup_topics explicitly with different assignments as the input argument&lt;br /&gt;
::* Mandatory&lt;br /&gt;
:::* Test the route from app/views/assignments/edit/_topics.html.erb with different assignment_form&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146560</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146560"/>
		<updated>2022-11-15T10:38:53Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* General Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146559</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146559"/>
		<updated>2022-11-15T10:33:43Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* General Design Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
* Magic Tricks of Testing&lt;br /&gt;
:* Test incoming command messages by making assertions about direct public side effects.&lt;br /&gt;
:* Do not test private methods.&lt;br /&gt;
::* Do not make assertions about their results.&lt;br /&gt;
::* Do not expect to send them.&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146558</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146558"/>
		<updated>2022-11-15T09:43:10Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Plan and List of Work done (specific tasks planned) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* Address and test effects of add_signup_topics_staggered (Wei-Chi)&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146557</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146557"/>
		<updated>2022-11-15T09:42:35Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
:* Rename the method.&lt;br /&gt;
:* Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146556</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146556"/>
		<updated>2022-11-15T09:40:43Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
:* [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146555</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146555"/>
		<updated>2022-11-15T09:40:25Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in the method create.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146554</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146554"/>
		<updated>2022-11-15T09:38:55Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
:* Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
:* Currently in RSpec, it is only implicitly tested in ''create''.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146553</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146553"/>
		<updated>2022-11-15T09:04:32Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Prior Work section with last years and last projects background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
: Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:* Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:* Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:* Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:* Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:* List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
: We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:* Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:* General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146552</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146552"/>
		<updated>2022-11-15T09:02:06Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Prior Work section with last years and last projects background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
: Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:: * Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:: * Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:: * Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:: * Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:: * Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:: * List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
:We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:: * Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:: * General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146551</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146551"/>
		<updated>2022-11-15T09:01:23Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Prior Work section with last years and last projects background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
: Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
: We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
:: 1. Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
:: 2. Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
:: 3. Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:: 4. Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
:: 5. Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
:: 6. List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
:We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
:: 1. Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
:: 2. General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146550</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146550"/>
		<updated>2022-11-15T09:00:24Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Prior Work section with last years and last projects background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
: Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
: 1. Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
: 2. Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
: 3. Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
: 4. Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
: 5. Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
: 6. List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
: 1. Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: 2. General test case added for rendering list view&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146549</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146549"/>
		<updated>2022-11-15T08:58:33Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Address and test effects of add_signup_topics_staggered&lt;br /&gt;
: Add_signup_topics_staggered was supposed to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]. However, it was removed in the last version since it did not do anything different from add_signup_topics.&lt;br /&gt;
&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
: [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
: Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
General test case added for rendering list view&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146548</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146548"/>
		<updated>2022-11-15T08:55:16Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
*Provide extensive comments for all the code you view/refactor/modify. &lt;br /&gt;
*Ensure that any code changes do not break any functionality. Refactoring method names might cause cascaded updates in other files.&lt;br /&gt;
&lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines] [Not clear that this has been addressed and tested.]&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
; [In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.]  [Has this been fixed?]&lt;br /&gt;
*There are nine checks for @assignment.is_intelligent.  This method is atrociously named.  It simply checks for whether bidding is being used to assign topics.&lt;br /&gt;
Rename the method.&lt;br /&gt;
Figure out some way to remove all or almost all of those checks, which are a gross violation of the Single-Responsibility Principle (as well as cohesion).&lt;br /&gt;
*Also see Code Climate issues. To reduce the size of the file, you could move some methods to sign_up_sheet_helper.rb [Has this been done?.]&lt;br /&gt;
&lt;br /&gt;
==Prior Work section with last years and last projects background==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
 &lt;br /&gt;
We ( @sswetha08 @weichic-ncsu @juanbenavid ) have performed the following refactoring to fix the issues specified for this refactoring project:&lt;br /&gt;
&lt;br /&gt;
Renamed &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
Update method refactored by removing explicit update of every attribute of topic and instead performing this task through update_attributes function provided by rails. Further, update_max_choosers method changed to update_waitlist to support this.&lt;br /&gt;
&lt;br /&gt;
Removed add_signup_topics_staggered() and replaced it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
Removed load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
Removed the feature to sign up for a topic as an instructor as there seems to be no way to access this feature from the views.&lt;br /&gt;
&lt;br /&gt;
List method was too long and has been refactored.&lt;br /&gt;
&lt;br /&gt;
We have also added two new test cases for the controller:&lt;br /&gt;
&lt;br /&gt;
Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
General test case added for rendering list view&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== General Design Goals ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan and List of Work done (specific tasks planned)==&lt;br /&gt;
* assignment is intelligent? (Swetha)&lt;br /&gt;
* participants variable (Juan)&lt;br /&gt;
* topics staggered ( Wei-Chi)&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test cases&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
: New, more general test case added for rendering list view, as we noticed that some functionalities we broke while refactoring did not result in failed test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:F22_Signup_rspec.png]] &lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Add New Topic or Delete topic using links in the form below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;br /&gt;
&lt;br /&gt;
*New Tests&lt;br /&gt;
&lt;br /&gt;
==Modifications (probably after working on them)==&lt;br /&gt;
==Relevant Links==&lt;br /&gt;
*https://github.com/weichic-ncsu/expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146438</id>
		<title>CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2279._Further_refactoring_and_improvement_of_signup_sheet_controller&amp;diff=146438"/>
		<updated>2022-11-14T23:06:24Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Problem Statement==&lt;br /&gt;
*Prior Work section with last years and last projects background&lt;br /&gt;
*Plan and List of Work done (General Design goals and specific tasks planned)&lt;br /&gt;
*Test Plan&lt;br /&gt;
*Testing Scenarios (Basic + Edge cases)&lt;br /&gt;
*RSpec Testing&lt;br /&gt;
*Manual Testing&lt;br /&gt;
*Modifications (probably after working on them)&lt;br /&gt;
*Team&lt;br /&gt;
*Members&lt;br /&gt;
*Mentor&lt;br /&gt;
*Relevant Links&lt;br /&gt;
*Link to GitHub Repo for our Expertiza&lt;br /&gt;
*Link to Pull Request&lt;br /&gt;
*Link to Expertiza Server&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146194</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146194"/>
		<updated>2022-11-01T08:20:02Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Edge Cases and Pre-Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
# Destroy signup_sheet when other topics with the same assignment exists.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test case&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146193</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146193"/>
		<updated>2022-11-01T08:18:58Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* RSpec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; New test case&lt;br /&gt;
: Destroy signup_sheet when there are other topics in the assignment&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146192</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146192"/>
		<updated>2022-11-01T07:35:50Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146191</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146191"/>
		<updated>2022-11-01T07:35:13Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
; Edge Cases and Pre-Conditions&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Mandatory ===&lt;br /&gt;
; Login as instructor&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
; Login as student&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146190</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146190"/>
		<updated>2022-11-01T07:33:20Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146189</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146189"/>
		<updated>2022-11-01T07:30:55Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Edge Cases and Pre-Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
# Create signup_sheet when sign_up_topic cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146013</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=146013"/>
		<updated>2022-10-26T21:27:17Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2259 OSS assignment for Fall 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (ssairam)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project at http://152.7.99.122:8080/&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller performs the following functions:&lt;br /&gt;
* Allows an instructor to add/remove topics to an assignment.&lt;br /&gt;
* Allows an instructor to assign/remove students to topics (This has been removed as it is unused/impersonation of student is used instead)&lt;br /&gt;
* Allows a student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
*Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun in the names of variables/controller/helper functions.&lt;br /&gt;
&lt;br /&gt;
'''Before changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @sign_up_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @sign_up_topic = SignUpTopic.new&lt;br /&gt;
    @sign_up_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @sign_up_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @sign_up_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @sign_up_topic.category = params[:topic][:category]&lt;br /&gt;
    @sign_up_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After changing variable names'''&lt;br /&gt;
&lt;br /&gt;
  def new&lt;br /&gt;
    @id = params[:id]&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topic = @signup_topic&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def set_values_for_new_topic&lt;br /&gt;
    @signup_topic = SignUpTopic.new&lt;br /&gt;
    @signup_topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
    @signup_topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
    @signup_topic.max_choosers = params[:topic][:max_choosers]&lt;br /&gt;
    @signup_topic.category = params[:topic][:category]&lt;br /&gt;
    @signup_topic.assignment_id = params[:id]&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Before changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignUpSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''After changing controller name'''&lt;br /&gt;
&lt;br /&gt;
  class SignupSheetController &amp;lt; ApplicationController&lt;br /&gt;
  ...&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
'''Before changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'), &lt;br /&gt;
      signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      sign_up_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After changing helper function names'''&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;%= link_to image_tag('signup.png', :border =&amp;gt; 0, :title =&amp;gt; 'Sign Up Student', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_as_instructor_signup_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;%= link_to image_tag('delete_icon.png', :border =&amp;gt; 0, :title =&amp;gt; 'Delete Topic', :align =&amp;gt; 'middle'),&lt;br /&gt;
      signup_sheet_path(:id=&amp;gt;topic.id, :assignment_id =&amp;gt; params[:id]), method: :delete, confirm: 'Are you sure?' %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Update method has been refactored by removing explicit update of every attribute of topic and instead performing this task through &lt;br /&gt;
update_attributes function provided by rails. To filter out topic specific params from the hash, topic_params method has been defined.&lt;br /&gt;
&lt;br /&gt;
Previous version of update:&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      @topic.topic_identifier = params[:topic][:topic_identifier]&lt;br /&gt;
      update_max_choosers @topic&lt;br /&gt;
      @topic.category = params[:topic][:category]&lt;br /&gt;
      @topic.topic_name = params[:topic][:topic_name]&lt;br /&gt;
      @topic.micropayment = params[:topic][:micropayment]&lt;br /&gt;
      @topic.description = params[:topic][:description]&lt;br /&gt;
      @topic.link = params[:topic][:link]&lt;br /&gt;
      @topic.save&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Refactored update:&lt;br /&gt;
&lt;br /&gt;
  def update&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])&lt;br /&gt;
    if @topic&lt;br /&gt;
      update_waitlist @topic&lt;br /&gt;
      @topic.update_attributes(topic_params)&lt;br /&gt;
      undo_link(&amp;quot;The topic: \&amp;quot;#{@topic.topic_name}\&amp;quot; has been successfully updated. &amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The topic could not be updated.'&lt;br /&gt;
    end&lt;br /&gt;
    # Akshay - correctly changing the redirection url to topics tab in edit assignment view.&lt;br /&gt;
    redirect_to edit_assignment_path(params[:assignment_id]) + '#tabs-2'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Further, update_max_choosers method has been refactored so as to not set the value of max_choosers separately. It now simply checks whether the given value of max_choosers is valid and if yes, updates the waitlist accordingly. For instance, if max_choosers increase from 1 to 2, 1 team on the waitlist can be allotted the topic.The name of update_max_choosers has been changed to update_waitlist to reflect this change. update_existing_topic method also was refactored similar to update.&lt;br /&gt;
&lt;br /&gt;
  def update_existing_topic(topic)&lt;br /&gt;
    update_waitlist topic&lt;br /&gt;
    topic.update_attributes(topic_params)&lt;br /&gt;
    redirect_to_sign_up(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def update_waitlist(topic)&lt;br /&gt;
    # While saving the max choosers you should be careful; if there are users who have signed up for this particular&lt;br /&gt;
    # topic and are on waitlist, then they have to be converted to confirmed topic based on the availability. But if&lt;br /&gt;
    # there are choosers already and if there is an attempt to decrease the max choosers, as of now I am not allowing&lt;br /&gt;
    # it.&lt;br /&gt;
    if SignedUpTeam.find_by(topic_id: topic.id).nil? || topic.max_choosers == topic_params[:max_choosers]&lt;br /&gt;
      return&lt;br /&gt;
    elsif topic.max_choosers.to_i &amp;lt; topic_params[:max_choosers].to_i&lt;br /&gt;
      topic.update_waitlisted_users topic_params[:max_choosers]&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'The value of the maximum number of choosers can only be increased! No change has been made to maximum choosers.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/aab4361285e53f440bff1818ee8acce8c8a33648&lt;br /&gt;
&lt;br /&gt;
3. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics_staggered&lt;br /&gt;
    add_signup_topics&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics or the /add_signup_topics_staggered page depending on assignment type&lt;br /&gt;
  # staggered means that different topics can have different deadlines.&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) &lt;br /&gt;
                                          : (redirect_to action: 'add_signup_topics', id: assignment_id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
&lt;br /&gt;
  # simple function that redirects ti the /add_signup_topics page&lt;br /&gt;
  def redirect_to_sign_up(assignment_id)&lt;br /&gt;
    assignment = Assignment.find(assignment_id)&lt;br /&gt;
    redirect_to action: 'add_signup_topics', id: assignment_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
4. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
'''Before'''&lt;br /&gt;
&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  # retrieves all the data associated with the given assignment. Includes all topics,&lt;br /&gt;
  def load_add_signup_topics(assignment_id)&lt;br /&gt;
    @id = assignment_id&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where('assignment_id = ?', assignment_id)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(assignment_id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(assignment_id)&lt;br /&gt;
  &lt;br /&gt;
    @assignment = Assignment.find(assignment_id)&lt;br /&gt;
    # ACS Removed the if condition (and corresponding else) which differentiate assignments as team and individual assignments&lt;br /&gt;
    # to treat all assignments as team assignments&lt;br /&gt;
    # Though called participants, @participants are actually records in signed_up_teams table, which&lt;br /&gt;
    # is a mapping table between teams and topics (waitlisted recorded are also counted)&lt;br /&gt;
    @participants = SignedUpTeam.find_team_participants(assignment_id, session[:ip])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''After'''&lt;br /&gt;
  def add_signup_topics&lt;br /&gt;
    load_add_signup_topics(params[:id])&lt;br /&gt;
    SignUpSheet.add_signup_topic(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
5. The feature to sign up for a topic as an instructor has been removed as it didn't appear to have been used in many years. More importantly, there seems to be no way to access this feature from the views. Hence sign_up_as_instructor, sign_up_as_instructor_action and delete_sign_up_as_instructor methods have been removed along with its associated views and tests in the controller spec for signup_sheet.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7b3f68ad5da1bc24e1f58a4c815aeb5985156aa8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4d3baceb5a7135c89fad7660fd342eb49b2a20df&lt;br /&gt;
&lt;br /&gt;
6. List method refactored by moving computation of sign_up topics to new method, using values directly in views rather than copying to instance variables, and new method for finding topic deadlines.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/4684f83e388d7605a742ac85ffc90917c5864dd5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/b5636bb109258c7cddb6d4199ad5141c14a5dda8&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/ed995ba8d68c5d4767a80a555114a2dd40f9b131&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7d81153839fbd87783a1cdaee2b797b2b46c3aa5&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7f9720680a7d13db168de1009dcd54273a184286&lt;br /&gt;
&lt;br /&gt;
''' Before '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @max_team_size = @assignment.max_team_size&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
    @use_bookmark = @assignment.use_bookmark&lt;br /&gt;
&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      signed_up_topics = []&lt;br /&gt;
      @bids.each do |bid|&lt;br /&gt;
        sign_up_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
        signed_up_topics &amp;lt;&amp;lt; sign_up_topic if sign_up_topic&lt;br /&gt;
      end&lt;br /&gt;
      signed_up_topics &amp;amp;= @sign_up_topics&lt;br /&gt;
      @sign_up_topics -= signed_up_topics&lt;br /&gt;
      @bids = signed_up_topics&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @sign_up_topics.size&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('sign_up_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''' After '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# method to return a list of topics for which a bid has been made by a team&lt;br /&gt;
  def compute_signed_up_topics&lt;br /&gt;
    signed_up_topics = []&lt;br /&gt;
    @bids.each do |bid|&lt;br /&gt;
      signup_topic = SignUpTopic.find_by(id: bid.topic_id)&lt;br /&gt;
      signed_up_topics &amp;lt;&amp;lt; signup_topic if signup_topic&lt;br /&gt;
    end&lt;br /&gt;
    signed_up_topics &amp;amp;= @signup_topics&lt;br /&gt;
    return signed_up_topics&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def find_topic_deadlines&lt;br /&gt;
    @signup_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 7)&lt;br /&gt;
    @drop_topic_deadline = @assignment.due_dates.find_by(deadline_type_id: 6)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def list&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id].to_i)&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @signup_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)&lt;br /&gt;
    @slots_filled = SignUpTopic.find_slots_filled(@assignment.id)&lt;br /&gt;
    @slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)&lt;br /&gt;
    @show_actions = true&lt;br /&gt;
    @priority = 0&lt;br /&gt;
    team_id = @participant.team.try(:id)&lt;br /&gt;
&lt;br /&gt;
    # if assignment is intelligent, want to know which topics the team has already bid on&lt;br /&gt;
    if @assignment.is_intelligent&lt;br /&gt;
      @bids = team_id.nil? ? [] : Bid.where(team_id: team_id).order(:priority)&lt;br /&gt;
      @bids = compute_signed_up_topics()&lt;br /&gt;
      @signup_topics -= @bids&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @num_of_topics = @signup_topics.size&lt;br /&gt;
    @student_bids = team_id.nil? ? [] : Bid.where(team_id: team_id)&lt;br /&gt;
    find_topic_deadlines()&lt;br /&gt;
&lt;br /&gt;
    unless @assignment.due_dates.find_by(deadline_type_id: 1).nil?&lt;br /&gt;
      @show_actions = false if !@assignment.staggered_deadline? &amp;amp;&amp;amp; (@assignment.due_dates.find_by(deadline_type_id: 1).due_at &amp;lt; Time.now)&lt;br /&gt;
&lt;br /&gt;
      # Find whether the user has signed up for any topics; if so the user won't be able to&lt;br /&gt;
      # sign up again unless the former was a waitlisted topic&lt;br /&gt;
      # if team assignment, then team id needs to be passed as parameter else the user's id&lt;br /&gt;
      users_team = SignedUpTeam.find_team_users(@assignment.id, session[:user].id)&lt;br /&gt;
      @selected_topics = if users_team.empty?&lt;br /&gt;
                           nil&lt;br /&gt;
                         else&lt;br /&gt;
                           SignedUpTeam.find_user_signup_topics(@assignment.id, users_team.first.t_id)&lt;br /&gt;
                         end&lt;br /&gt;
    end&lt;br /&gt;
    render('signup_sheet/intelligent_topic_selection') &amp;amp;&amp;amp; return if @assignment.is_intelligent&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In views:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;%= get_intelligent_topic_row(topic, @selected_topics, @assignment.max_team_size) %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 &amp;lt;% if @assignment.use_bookmark %&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
We also ran the rspecs for signup_sheet model and helper just to make sure no functionality was broken.&lt;br /&gt;
: rspec spec/helpers/signup_sheet_helper_spec.rb&lt;br /&gt;
: rspec spec/models/signup_sheet_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145750</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145750"/>
		<updated>2022-10-25T21:20:58Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
-- Swetha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Wei-Chi&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
3. Remove load_add_signup_topics() since it does nothing for add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/e648df810a171a5b5b0756d91dd2c3c8d692b7cb&lt;br /&gt;
&lt;br /&gt;
-- Juan&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145749</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145749"/>
		<updated>2022-10-25T21:19:27Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
-- Swetha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Wei-Chi&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
2. Remove add_signup_topics_staggered() and replace it with add_signup_topics() since it does nothing but call add_signup_topics().&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/14059f8ee9b846bc4f9830d16b000c99d3f5c71c&lt;br /&gt;
&lt;br /&gt;
-- Juan&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145748</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145748"/>
		<updated>2022-10-25T21:17:51Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
-- Swetha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Wei-Chi&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/12f5e58ddb7782ec0ac7a4455489be8ecd167071&lt;br /&gt;
&lt;br /&gt;
-- Juan&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145747</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145747"/>
		<updated>2022-10-25T21:17:33Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
-- Swetha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Wei-Chi&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
-- Juan&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145746</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145746"/>
		<updated>2022-10-25T21:17:18Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
-- Swetha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Wei-Chi&lt;br /&gt;
&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
-- Juan&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145745</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145745"/>
		<updated>2022-10-25T21:17:04Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
*Naming is inconsistent.  When used as a verb, “sign up” is two words.  When an adjective or a noun, it should be one word, e.g., “signup_sheet_controller.”  Cf. “sign_up_as_instructor”.  Please make the naming consistent.  Of course, this will result in changes in calling methods as well. [Mostly fixed by previous version of project.]&lt;br /&gt;
*Update method has a plethora of instance variables defined before updating. These might not be necessary (e.g., look at update method of bookmarks_controller). Decide whether so many instance variables are really needed. Refactor the variables not needed out. &lt;br /&gt;
*Add_signup_topics_staggered does not do anything different from add_signup_topics. Separate functions are needed, because add_signup_topics_staggered needs to make sure that the deadlines are set. [Assignment 1042 has staggered deadlines]&lt;br /&gt;
*Several method names can be improved (including: load_add_signup_topics, list, ad_info etc.)&lt;br /&gt;
*What are differences between signup_as_instructor and signup_as_instructor_action methods? Investigate if they are needed and improve the method names if both are needed. Provide comments as to what each method does.&lt;br /&gt;
*The list method is too long and is sparsely commented. Provide comments and identify if the method can be split or made cleaner by moving code to models or helper methods.&lt;br /&gt;
*Refactor participants variable in  load_add_signup_topics&lt;br /&gt;
[In retrospect, the meaning of this is not clear.  The @participants variable is used in a way that is very obscure, with code spread across several views, and no comments saying what it is doing.  It used to be that participants (individual students) signed up for topics.  Now, only teams can sign up for topics.  So @participants does not make sense.&lt;br /&gt;
Signup_as_instructor_action has if-else ladder. It can be made more elegant. [If it is worth keeping this method at all.]&lt;br /&gt;
*Delete_signup and delete_signup_as_instructor have much in common and violate the DRY principle. delete_signup_as_instructor&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
-- Swetha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Wei-Chi&lt;br /&gt;
1. Rename &amp;quot;sign_up&amp;quot; to be &amp;quot;signup&amp;quot; when it is used as adjective or noun for variable/method/controller name.&lt;br /&gt;
&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/7fb2cceacbe459e5847141baea501bbd71952f12&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/1152bac5c77cb9cf07f7de820e8677ba9a2a47ed&lt;br /&gt;
https://github.com/weichic-ncsu/expertiza/commit/3a5c6131c169812e455c20406809650a8a512646&lt;br /&gt;
&lt;br /&gt;
-- Juan&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145740</id>
		<title>CSC/ECE 517 Fall 2022 - E2259. Refactor signup sheet controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2259._Refactor_signup_sheet_controller&amp;diff=145740"/>
		<updated>2022-10-25T20:35:33Z</updated>

		<summary type="html">&lt;p&gt;Wchen37: /* Team Members */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the information regarding the changes made for the E2223 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Juan Benavides (jdbenavi)&lt;br /&gt;
* Wei-Chi Chen (wchen37)&lt;br /&gt;
* Swetha Sairamakrishnan (jkini)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Expertiza is a open source project developed on Ruby on Rails.  This web application is maintained by the student and faculty at NC State.  This application gives complete control to the instructor to maintain the assignments in their class.  With multiple functionalities such as adding topics, creating groups, and peer reviews, Expertiza is a well developed application that can handle all types of assignments.  To learn more about the full functionality Expertiza has to offer, visit the Expertiza wiki.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the details are below:&lt;br /&gt;
* We have deployed the project -------------------&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student login: username -&amp;gt; student5899,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== About Controller == &lt;br /&gt;
The sign up sheet controller &lt;br /&gt;
* Allows an instructor to add/remove topics&lt;br /&gt;
* Allows an instructor to assign/remove students to topics&lt;br /&gt;
* Allows an student to see the list of available topics which can be bid on for given OSS assignment.&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
--- this year issues&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
; RSpec &lt;br /&gt;
: As such no functionality changed in any function, only refactoring done. All the refactoring was carefully verified by running rspec tests. To run the spec file, run: &lt;br /&gt;
: rspec spec/controllers/signup_sheet_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Physical Testing&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
#edit this stuff:&lt;br /&gt;
=== Edge Cases and Pre-Conditions ===&lt;br /&gt;
# When dropping topic if submission already done.&lt;br /&gt;
# When deadline from dropping topic has passed.&lt;br /&gt;
# Deleting topic when topic cannot be found.&lt;br /&gt;
# Signup in case when user cannot be found.&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
=== Login as instructor ===&lt;br /&gt;
# Hover on Manage Tab&lt;br /&gt;
# Click on Assignments Tab&lt;br /&gt;
# Click on Edit Button for &amp;quot;OSS project &amp;amp; documentation&amp;quot; assignment&lt;br /&gt;
# Select the Topic Tab&lt;br /&gt;
# Click the Green Check for any topic&lt;br /&gt;
# Enter a student UnityID and click submit&lt;br /&gt;
&lt;br /&gt;
=== Login as student ===&lt;br /&gt;
# Click on OSS project/Writing assignment 2&lt;br /&gt;
# Click on Signup sheet&lt;br /&gt;
# The list must be visible, which indicates functionality is as before after refactoring list function.&lt;/div&gt;</summary>
		<author><name>Wchen37</name></author>
	</entry>
</feed>