Skip to content

Commit

Permalink
Merge pull request #1119 from scottsds/issue_2215
Browse files Browse the repository at this point in the history
Issue 2215: Error 500 on GE Summary page
  • Loading branch information
CristinaRO committed Jun 19, 2014
2 parents ee00060 + 9a9cde0 commit a43d2b5
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,35 @@
</p>
<% end %>
<h3 class="heading"><%= ts("Requested %{tag_type}", :tag_type => tag_type.pluralize.capitalize) %></h3>
<p class="note">
<%= ts('Listed by fewest offers and most requests.') %>
</p>
<table id="challenge_summary" summary="<%= ts("Number of requests and offers for each requested %{tag_type} in this challenge, listed by fewest offers and most requests.", :tag_type => tag_type) %>">
<caption><%=ts("Requests and Offers for Requested %{tag_type}", :tag_type => tag_type.pluralize.capitalize) %></caption>
<thead>
<tr>
<th scope="col"><%= tag_type.capitalize %></th>
<th scope="col"><%= ts('Requests') %></th>
<th scope="col"><%= ts('Offers') %></th>
</tr>
</thead>
<tbody>
<% summary_tags.each do |tag| %>
<% if summary_tags.empty? %>
<p class="notice"><%= ts("Tags were not used in this Challenge, so there is no summary to display here.") %></p>
<% else %>
<h3 class="heading"><%= ts("Requested %{tag_type}", :tag_type => tag_type.pluralize.capitalize) %></h3>
<p class="note">
<%= ts('Listed by fewest offers and most requests.') %>
</p>
<table id="challenge_summary" summary="<%= ts("Number of requests and offers for each requested %{tag_type} in this challenge, listed by fewest offers and most requests.", :tag_type => tag_type) %>">
<caption><%=ts("Requests and Offers for Requested %{tag_type}", :tag_type => tag_type.pluralize.capitalize) %></caption>
<thead>
<tr>
<th scope="row">
<span class="<%= tag.requests > 0 ? 'requested' : '' %> <%= tag.offers > 0 ? 'offered' : '' %>">
<%= tag.name %>
</span>
</th>
<td><span class="requested"><%= tag.requests.to_i -%></span></td>
<td><span class="offered"><%= tag.offers.to_i -%></span></td>
<th scope="col"><%= tag_type.capitalize %></th>
<th scope="col"><%= ts('Requests') %></th>
<th scope="col"><%= ts('Offers') %></th>
</tr>
<% end %>
</tbody>
</table>
</thead>
<tbody>
<% summary_tags.each do |tag| %>
<tr>
<th scope="row">
<span class="<%= tag.requests > 0 ? 'requested' : '' %> <%= tag.offers > 0 ? 'offered' : '' %>">
<%= tag.name %>
</span>
</th>
<td><span class="requested"><%= tag.requests.to_i %></span></td>
<td><span class="offered"><%= tag.offers.to_i %></span></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

34 changes: 33 additions & 1 deletion features/gift_exchanges/challenge_giftexchange.feature
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,37 @@ Feature: Gift Exchange Challenge
And I follow "Download (CSV)"
Then I should get a file with ending and type csv

Scenario: View a signup summary with no tags
Given the following activated users exist
| login | password |
| user1 | password |
| user2 | password |
| user3 | password |
| user4 | password |
| user5 | password |
| user6 | password |
When I am logged in as "mod1"
And I have created the tagless gift exchange "My Gift Exchange"
And I open signups for "My Gift Exchange"
When I am logged in as "user1" with password "password"
And I start to sign up for "My Gift Exchange" tagless gift exchange
When I am logged in as "user2" with password "password"
And I start to sign up for "My Gift Exchange" tagless gift exchange
When I am logged in as "user3" with password "password"
And I start to sign up for "My Gift Exchange" tagless gift exchange
When I am logged in as "user4" with password "password"
And I start to sign up for "My Gift Exchange" tagless gift exchange
When I am logged in as "user5" with password "password"
And I start to sign up for "My Gift Exchange" tagless gift exchange
When I am logged in as "user6" with password "password"
And I start to sign up for "My Gift Exchange" tagless gift exchange
When I am logged in as "mod1"
And I go to "My Gift Exchange" collection's page
And I follow "Sign-up Summary"
Then I should not see "Summary does not appear until at least"
And I should see "Tags were not used in this Challenge, so there is no summary to display here."


Scenario: Tagsets show up in Challenge metadata
Given I am logged in as "mod1"
And I have created the gift exchange "Cabbot Cove Remixes"
Expand All @@ -362,6 +393,7 @@ Feature: Gift Exchange Challenge
And I should not see "Standard Challenge Tags"
And I should not see "Angela Lansbury"


Scenario: Mod deletes a user's sign-up and a user deletes their own sign-up without JavaScript
Given I am logged in as "mod1"
And I have created the gift exchange "Awesome Gift Exchange"
Expand All @@ -374,4 +406,4 @@ Feature: Gift Exchange Challenge
When I am logged in as "myname2"
And I delete my signup for the gift exchange "Awesome Gift Exchange"
Then I should see "Challenge sign-up was deleted."


18 changes: 18 additions & 0 deletions features/step_definitions/challege_gift_exchange_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
step %{I have created the gift exchange "#{challengename}" with name "#{challengename.gsub(/[^\w]/, '_')}"}
end

Given /^I have created the tagless gift exchange "([^\"]*)" with name "([^\"]*)"$/ do |challengename, name|
step %{I have set up the gift exchange "#{challengename}" with name "#{name}"}
step "I submit"
step %{I should see "Challenge was successfully created"}
end

Given /^I have created the tagless gift exchange "([^\"]*)"$/ do |challengename|
step %{I have created the tagless gift exchange "#{challengename}" with name "#{challengename.gsub(/[^\w]/, '_')}"}
end

When /^I fill in gift exchange challenge options$/ do
current_date = DateTime.current
fill_in("Sign-up opens", :with => "#{current_date.months_ago(2)}")
Expand Down Expand Up @@ -141,6 +151,14 @@
step %{I check the 1st checkbox with value "Stargate SG-1"}
end

When /^I start to sign up for "([^\"]*)" tagless gift exchange$/ do |title|
visit collection_path(Collection.find_by_title(title))
step %{I follow "Sign Up"}
step %{I fill in "Description" with "random text"}
step %{I press "Submit"}
step %{I should see "Sign-up was successfully created"}
end

## Matching

Given /^the gift exchange "([^\"]*)" is ready for matching$/ do |title|
Expand Down
2 changes: 0 additions & 2 deletions features/step_definitions/challenge_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
step %{a canonical fandom "Unrequested"}
end


### General Challenge Settings

When /^I edit settings for "([^\"]*)" challenge$/ do |title|
Expand Down Expand Up @@ -107,7 +106,6 @@
step %{I follow "Sign Up"}
end


### Editing signups

When /^I edit my signup for "([^\"]*)"$/ do |title|
Expand Down

0 comments on commit a43d2b5

Please sign in to comment.