Skip to content

Commit

Permalink
do not show prev deltas without teams
Browse files Browse the repository at this point in the history
  • Loading branch information
severest committed May 22, 2018
1 parent 03125a5 commit fc09a60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/retro_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ def show
@retro = Retro.find_by_key!(params[:key])
@prev_retro_deltas = []
prev_retro = Retro.where(team: @retro.team)
.where.not(team: nil)
.where(status: :locked)
.where.not(id: @retro.id)
.order('created_at desc').first()
Expand Down
9 changes: 9 additions & 0 deletions test/controllers/retro_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,13 @@ class RetroControllerTest < ActionDispatch::IntegrationTest
json_response = JSON.parse(@response.body)
assert_equal 0, json_response['prev_deltas'].count
end

test "should not have prev deltas on retro with no team" do
old_retro = create(:full_retro, key: 'eeeee1', status: 'locked')
retro = create(:retro, key: 'eeeee2')
get "/api/retro/#{retro.key}"
assert_response :success
json_response = JSON.parse(@response.body)
assert_equal 0, json_response['prev_deltas'].count
end
end

0 comments on commit fc09a60

Please sign in to comment.