Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: DFE-Digital/access-your-teaching-qualifications
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2d50d0e5d3bcd9309673af013c7a054563a28d06
Choose a base ref
..
head repository: DFE-Digital/access-your-teaching-qualifications
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: af0b753326bbcc5cad4fb53530460b6cb66e0c55
Choose a head ref
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ GIT

GIT
remote: https://github.com/ilyakatz/data-migrate.git
revision: a46eb862fbc9c2ade4db178692ea86a454919905
revision: ecd0cd55cdc5aaab35de43f1f41ab0dc3c2aa2dd
specs:
data_migrate (11.0.0)
activerecord (>= 6.1)
@@ -281,7 +281,7 @@ GEM
bindata
faraday (~> 2.0)
faraday-follow_redirects
jwt (2.9.0)
jwt (2.9.1)
base64
kramdown (2.4.0)
rexml
38 changes: 38 additions & 0 deletions app/components/tabbed_pagination_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

class TabbedPaginationComponent < GovukComponent::PaginationComponent
def initialize(fragment: nil, **kwargs)
self.fragment = fragment
super(**kwargs)
end

private

attr_accessor :fragment

def build_items
pagy.series.map { |i| with_item(number: i, href: pagy_url_for(pagy, i, fragment:), from_pagy: true) }
end

def build_next
return unless pagy&.next

kwargs = {
href: pagy_url_for(pagy, pagy.next, fragment:),
text: @next_text,
}

with_next_page(**kwargs.compact)
end

def build_previous
return unless pagy&.prev

kwargs = {
href: pagy_url_for(pagy, pagy.prev, fragment:),
text: @previous_text,
}

with_previous_page(**kwargs.compact)
end
end
6 changes: 5 additions & 1 deletion app/controllers/check_records/bulk_searches_controller.rb
Original file line number Diff line number Diff line change
@@ -44,7 +44,11 @@ def show
QualificationsApi::Teacher.new(teacher['api_data'])
end
@not_found = data['not_found'].map {|record| Hashie::Mash.new(record) }
@pagy, @results = pagy_array(@results)
@pagy, @results = pagy_array(@results, limit: 10)
@pagy_not_found, @not_found =
pagy_array(@not_found, limit: 10, page_param: :page_not_found, anchor_string: '#records-not-found')

@bulk_search_response.update!(expires_at: 30.minutes.from_now)
end

private
2 changes: 1 addition & 1 deletion app/views/check_records/bulk_searches/new.html.erb
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
must be in DD/MM/YYYY format.
</p>
<p class="govuk-body">
You can add a maximum of 20 people.
You can add a maximum of 100 people.
</p>
</li>
<li>
5 changes: 4 additions & 1 deletion app/views/check_records/bulk_searches/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<% content_for :page_title, "Bulk Search Results" %>
<% content_for :breadcrumbs do %>
<%= govuk_breadcrumbs(breadcrumbs: { "Home" => check_records_search_path, "Find multiple records" => new_check_records_bulk_search_path, "Results" => nil }) %>
<%= render ActionAtComponent.new(action: "searched") %>
<% end %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<%= render ActionAtComponent.new(action: "searched") %>
<h1 class="govuk-heading-l"><%= pluralize(@total, 'teacher record') %> found</h1>
<p class="govuk-body govuk-!-margin-bottom-6">
We found <%= pluralize(@total, 'teacher record') %> out of the <%= pluralize(@results.count + @not_found.count, 'entry') %> you uploaded.
</p>
<%= govuk_tabs do |tabs|
if @results.any?
tabs.with_tab(label: "Records found", id: "records-found") do %>
19 changes: 14 additions & 5 deletions app/views/check_records/search/_not_found.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="no-results--table">
<%= govuk_table do |table|
table.with_caption(size: 'm', text: 'No records found')
<% if not_found.any? %>
<%= govuk_table do |table|
table.with_caption(size: 'm', text: 'No records found')

table.with_head do |head|
head.with_row do |row|
@@ -13,9 +14,17 @@
not_found.each do |record|
body.with_row do |row|
row.with_cell(text: record.trn)
row.with_cell(text: record.date_of_birth.to_date.to_fs(:long_uk))
row.with_cell(text: record.date_of_birth.to_date.to_fs(:long_uk))
end
end
end
end
end %>
end %>
<% end %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="app-pagination">
<%= render TabbedPaginationComponent.new(pagy: @pagy_not_found, fragment: '#records-not-found') if @pagy_not_found.pages.positive? %>
</div>
</div>
</div>
</div>
17 changes: 17 additions & 0 deletions spec/system/check_records/user_searches_with_a_valid_csv_spec.rb
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@
when_i_click_find_records
then_i_see_results
and_my_search_is_logged
when_i_wait_for_the_search_to_expire
then_i_see_the_expired_search_message
end

private
@@ -44,4 +46,19 @@ def and_my_search_is_logged
expect(search_log.query_count).to eq 2
expect(search_log.result_count).to eq 1
end

def when_i_wait_for_the_search_to_expire
travel 29.minutes
page.refresh
travel 2.minutes
page.refresh
expect(page).not_to have_content "Bulk search expired"
travel 31.minutes
page.refresh
end

def then_i_see_the_expired_search_message
expect(page).to have_content "Bulk search expired"
travel_back
end
end