Skip to content

Commit 4844c20

Browse files
murugaplthomasleese
authored andcommitted
Merge pull request #4739 from nhsuk/fix-low-pds-match-rate-rendering
Fix low pds match rate rendering
2 parents e578b08 + 24b02ab commit 4844c20

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
@forward "details";
12
@forward "summary-list";
23
@forward "tables";

app/components/app_import_pds_unmatched_summary_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class AppImportPDSUnmatchedSummaryComponent < ViewComponent::Base
44
def initialize(changesets:)
5-
@changesets = changesets
5+
@changesets = changesets.sort_by(&:row_number)
66
end
77

88
def call

app/views/imports/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<% end %>
102102

103103
<details class="nhsuk-details nhsuk-expander">
104-
<summary class="nhsuk-details__summary" data-module="app-sticky" data-app-sticky-init>
104+
<summary class="nhsuk-details__summary" data-module="app-sticky">
105105
<span class="nhsuk-details__summary-text">
106106
<%= import.changesets.without_pds_match.count %> unmatched records
107107
</span>

db/seeds.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,20 @@ def create_imports(user, team)
203203
uploaded_by: user
204204
)
205205
end
206+
207+
low_pds_import =
208+
FactoryBot.create(
209+
:cohort_import,
210+
:low_pds_match_rate,
211+
team:,
212+
uploaded_by: user
213+
)
214+
FactoryBot.create_list(
215+
:patient_changeset,
216+
15,
217+
import: low_pds_import,
218+
pds_nhs_number: nil
219+
)
206220
end
207221

208222
def create_school_moves(team)

spec/components/app_import_pds_unmatched_summary_component_spec.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"address_postcode" => "AB1 2CD"
2121
}
2222
},
23-
import:
23+
import:,
24+
row_number: 2
2425
)
2526
end
2627

@@ -52,7 +53,8 @@
5253
"address_postcode" => "ZZ9 9ZZ"
5354
}
5455
},
55-
import:
56+
import:,
57+
row_number: 1
5658
)
5759
end
5860

@@ -63,6 +65,13 @@
6365
expect(rendered).to have_content("20 August 2011")
6466
expect(rendered).to have_content("ZZ9 9ZZ")
6567
end
68+
69+
it "renders records in row number order" do
70+
rows = rendered.css("tbody tr").map(&:text)
71+
72+
expect(rows.first).to include("Bob")
73+
expect(rows.last).to include("Alice")
74+
end
6675
end
6776

6877
context "when values are blank" do

0 commit comments

Comments
 (0)