Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1367 from 18F/admin-sees-current-winning-bid-in-h…
Browse files Browse the repository at this point in the history
…eader

Admin sees current winning bid in header
  • Loading branch information
jessieay authored Oct 24, 2016
2 parents 80d7bd1 + 1ce1b30 commit f86f2dc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/view_models/admin/auction_show_view_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def html_summary
end

def bid_label
if over? && auction.bids.any?
if available?
bidding_status_presenter.bid_label(current_user)
elsif over? && auction.bids.any?
"Winning bid (#{lowest_bidder_name}): #{highlighted_bid_amount_as_currency}"
elsif auction.bids.any?
"Current bid: #{highlighted_bid_amount_as_currency}"
Expand All @@ -99,6 +101,10 @@ def highlighted_bid_amount_as_currency
Currency.new(rules.highlighted_bid(current_user).amount).to_s
end

def available?
bidding_status.available?
end

def over?
bidding_status.over?
end
Expand Down
2 changes: 0 additions & 2 deletions app/views/admin/auctions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<%= render partial: @view_model.csv_report_partial,
locals: { auction: @view_model } %>
</div>
</div>
<div class="auction-subtitles">
<div class="auction-subtitle">
<div class="bidding-status">
<%= render partial: 'auctions/bidding_status_label',
Expand Down
4 changes: 4 additions & 0 deletions features/admin_views_open_auction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ Feature: Admin views open auction
And I sign in
When I visit the admin auction page for that auction
Then I should see the open auction message for admins
And I should see the current winning bid in a header subtitle

When I visit the auction page
Then I should see the open auction message for admins
And I should see the current winning bid in a header subtitle

Scenario: There is an open auction for the other purchase card
Given there is an open auction
And the auction is for a different purchase card
And I am an administrator
And I sign in

When I visit the admin auction page for that auction
Then I should see the open auction message for admins
And I should see the current winning bid in a header subtitle
2 changes: 1 addition & 1 deletion spec/view_models/admin/auction_show_view_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
user = create(:user)
view_model = Admin::AuctionShowViewModel.new(auction: auction, current_user: user)

expect(view_model.bid_label).to eq("Current bid: #{Currency.new(bid.amount)}")
expect(view_model.bid_label).to eq("Current low bid: #{Currency.new(bid.amount)} (#{bid.bidder.name})")
end

it "should show the starting price when auction hasn't started yet" do
Expand Down

0 comments on commit f86f2dc

Please sign in to comment.