Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
Don’t show the 10kft support project as “affected”
Browse files Browse the repository at this point in the history
When the 10kft ID for the support project was moved from being a constant to being an env var, we kept comparing it to other project IDs without type conversion.

However, env vars are strings, and project IDs are integers.

Convert to string before comparing.
  • Loading branch information
CristinaRO committed Feb 5, 2021
1 parent 1b17199 commit d6f6554
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.test
@@ -1,5 +1,5 @@
TENK_USER_ID=user@example.com
TENK_PASSWORD=really-strong-password
TENK_ID_FOR_SUPPORT=
TENK_ID_FOR_SUPPORT=101
HTTP_BASIC_PASSWORD=really-strong-password-2
HTTP_BASIC_USER=user@example.com
2 changes: 1 addition & 1 deletion app/controllers/support_rotations_controller.rb
Expand Up @@ -60,7 +60,7 @@ def ops_eng_name

def affected_projects
in_hours_projects = (first_line_dev.projects + first_line_ops.projects).uniq
client_projects = in_hours_projects.select { |p| p.tenk_id != Project::TENK_ID_FOR_SUPPORT }
client_projects = in_hours_projects.select { |p| p.tenk_id.to_s != Project::TENK_ID_FOR_SUPPORT }
client_projects.select do |project|
start_date <= Date.parse(project.ends_at) &&
end_date >= Date.parse(project.starts_at)
Expand Down
Expand Up @@ -6,8 +6,9 @@
end

it "will show the people assigned to support rotations and the affected client projects" do
support_project = Project.create(name: "1st line support", tenk_id: ENV.fetch("TENK_ID_FOR_SUPPORT", nil))
client1 = Project.create(name: "Client One", tenk_id: 123, starts_at: 1.month.ago, ends_at: Date.today.to_s)
team_member = TeamMember.create(first_name: "Jay", projects: [client1], tenk_id: 1234)
team_member = TeamMember.create(first_name: "Jay", projects: [client1, support_project], tenk_id: 1234)

past_day = team_member.support_days.create(date: 1.month.ago, support_type: "dev")
current_day = team_member.support_days.create(date: Date.today, support_type: "dev")
Expand All @@ -22,5 +23,6 @@

expect(page).to have_content("Support rotations")
expect(page).to have_content("Client One")
expect(page).not_to have_content("1st line support")
end
end

0 comments on commit d6f6554

Please sign in to comment.