Skip to content

Commit fc09a60

Browse files
committed
do not show prev deltas without teams
1 parent 03125a5 commit fc09a60

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

app/controllers/retro_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ def show
33
@retro = Retro.find_by_key!(params[:key])
44
@prev_retro_deltas = []
55
prev_retro = Retro.where(team: @retro.team)
6+
.where.not(team: nil)
67
.where(status: :locked)
78
.where.not(id: @retro.id)
89
.order('created_at desc').first()

test/controllers/retro_controller_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,13 @@ class RetroControllerTest < ActionDispatch::IntegrationTest
7373
json_response = JSON.parse(@response.body)
7474
assert_equal 0, json_response['prev_deltas'].count
7575
end
76+
77+
test "should not have prev deltas on retro with no team" do
78+
old_retro = create(:full_retro, key: 'eeeee1', status: 'locked')
79+
retro = create(:retro, key: 'eeeee2')
80+
get "/api/retro/#{retro.key}"
81+
assert_response :success
82+
json_response = JSON.parse(@response.body)
83+
assert_equal 0, json_response['prev_deltas'].count
84+
end
7685
end

0 commit comments

Comments
 (0)