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

Commit

Permalink
Merge pull request #58 from dxw/fix/support-project-id-is-string
Browse files Browse the repository at this point in the history
Don’t show the 10kft support project as “affected”
  • Loading branch information
CristinaRO committed Feb 5, 2021
2 parents 09717b7 + d6f6554 commit 48adb96
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 48adb96

Please sign in to comment.