Skip to content

Commit

Permalink
add_signup_topics and add_signup_topics were doing the same thing. So…
Browse files Browse the repository at this point in the history
… made it one function
  • Loading branch information
jagdish-kini committed Mar 19, 2022
1 parent 9e99f56 commit db12bf9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions app/controllers/signup_sheet_controller.rb
Expand Up @@ -140,10 +140,10 @@ def add_signup_topics
load_add_signup_topics(params[:id])
SignUpSheet.add_signup_topic(params[:id])
end

def add_signup_topics_staggered
add_signup_topics
end
# Commented add_signup_topics_staggered because it was doing same thing as add_signup_topics.
#def add_signup_topics_staggered
# add_signup_topics
#end

# retrieves all the data associated with the given assignment. Includes all topics,
def load_add_signup_topics(assignment_id)
Expand Down Expand Up @@ -174,7 +174,7 @@ def set_values_for_new_topic
# staggered means that different topics can have different deadlines.
def redirect_to_sign_up(assignment_id)
assignment = Assignment.find(assignment_id)
assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics_staggered', id: assignment_id) : (redirect_to action: 'add_signup_topics', id: assignment_id)
assignment.staggered_deadline == true ? (redirect_to action: 'add_signup_topics', id: assignment_id) : (redirect_to action: 'add_signup_topics', id: assignment_id)
end

# simple function that redirects to assignment->edit->topic panel to display /add_signup_topics or the /add_signup_topics_staggered page
Expand Down
2 changes: 1 addition & 1 deletion app/views/assignments/edit/_topics.html.erb
Expand Up @@ -39,7 +39,7 @@
<%= label_tag('assignment_form[assignment][use_bookmark]', 'Allow participants to create bookmarks?') %>
<br><br>
<% if @assignment_form.assignment.staggered_deadline == true %>
<%= render partial: '/signup_sheet/add_signup_topics_staggered', locals: {review_rounds: @review_rounds, assignment_submission_due_dates: @assignment_submission_due_dates, assignment_review_due_dates: @assignment_review_due_dates} %>
<%= render partial: '/signup_sheet/add_signup_topics', locals: {review_rounds: @review_rounds, assignment_submission_due_dates: @assignment_submission_due_dates, assignment_review_due_dates: @assignment_review_due_dates} %>
<% else %>
<%= render '/signup_sheet/add_signup_topics' %>
<% end %>
2 changes: 1 addition & 1 deletion config/routes.rb
Expand Up @@ -360,7 +360,7 @@
get :signup
get :delete_signup
get :add_signup_topics
get :add_signup_topics_staggered
#get :add_signup_topics_staggered
get :delete_signup
get :list
get :signup_topics
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/signup_sheet_controller_spec.rb
Expand Up @@ -94,7 +94,7 @@
end

context 'when topic can be found' do
it 'updates the existing topic and redirects to signup_sheet#add_signup_topics_staggered page' do
it 'updates the existing topic and redirects to signup_sheet#add_signup_topics page' do
allow(SignedUpTeam).to receive(:find_by).with(topic_id: 1).and_return(signed_up_team)
allow(SignedUpTeam).to receive(:where).with(topic_id: 1, is_waitlisted: true).and_return([signed_up_team2])
allow(Team).to receive(:find).with(2).and_return(team)
Expand All @@ -111,7 +111,7 @@
}
post :create, params
expect(SignedUpTeam.first.is_waitlisted).to be false
expect(response).to redirect_to('/signup_sheet/add_signup_topics_staggered?id=1')
expect(response).to redirect_to('/signup_sheet/add_signup_topics?id=1')
end
end
end
Expand Down

0 comments on commit db12bf9

Please sign in to comment.