From 7249d7f6142f94bda997a0080c6dac0d28db1631 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Mon, 16 Dec 2024 17:49:08 +0000 Subject: [PATCH 1/7] Remove kaminari, install pagy --- Gemfile | 2 +- Gemfile.lock | 15 +- app/controllers/application_controller.rb | 2 + app/helpers/application_helper.rb | 1 + app/views/kaminari/_first_page.html.haml | 9 - app/views/kaminari/_gap.html.haml | 8 - app/views/kaminari/_last_page.html.haml | 9 - app/views/kaminari/_next_page.html.haml | 9 - app/views/kaminari/_page.html.haml | 10 - app/views/kaminari/_paginator.html.haml | 23 --- app/views/kaminari/_prev_page.html.haml | 9 - config/initializers/kaminari_config.rb | 10 - config/initializers/pagy.rb | 220 ++++++++++++++++++++++ config/locales/pagy.en.yml | 20 ++ 14 files changed, 246 insertions(+), 101 deletions(-) delete mode 100644 app/views/kaminari/_first_page.html.haml delete mode 100644 app/views/kaminari/_gap.html.haml delete mode 100644 app/views/kaminari/_last_page.html.haml delete mode 100644 app/views/kaminari/_next_page.html.haml delete mode 100644 app/views/kaminari/_page.html.haml delete mode 100644 app/views/kaminari/_paginator.html.haml delete mode 100644 app/views/kaminari/_prev_page.html.haml delete mode 100644 config/initializers/kaminari_config.rb create mode 100644 config/initializers/pagy.rb create mode 100644 config/locales/pagy.en.yml diff --git a/Gemfile b/Gemfile index 3a6c02f882..b7e4e4caf5 100644 --- a/Gemfile +++ b/Gemfile @@ -29,13 +29,13 @@ gem 'jquery-rails', '~> 4.6.0' gem 'json-schema', '~> 5.1.1' gem 'jsbundling-rails' gem 'nokogiri', '~> 1.18' -gem 'kaminari', '>= 1.2.1' gem 'libreconv', '~> 0.9.5' gem 'logstasher', '2.1.5' gem 'logstuff', '0.0.2' gem 'net-imap' gem 'net-pop' gem 'net-smtp' +gem 'pagy' gem 'paper_trail', '~> 16.0.0' gem 'pg', '~> 1.5.9' gem 'rails', '~> 7.0.8' diff --git a/Gemfile.lock b/Gemfile.lock index ca93b0a536..f37a893210 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -348,18 +348,6 @@ GEM jsonapi-renderer (0.2.2) jwt (2.10.1) base64 - kaminari (1.2.2) - activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.2) - kaminari-activerecord (= 1.2.2) - kaminari-core (= 1.2.2) - kaminari-actionview (1.2.2) - actionview - kaminari-core (= 1.2.2) - kaminari-activerecord (1.2.2) - activerecord - kaminari-core (= 1.2.2) - kaminari-core (1.2.2) laa-fee-calculator-client (2.0.0) faraday (~> 2.9) faraday-http-cache (~> 2.2) @@ -435,6 +423,7 @@ GEM version_gem (~> 1.1) orm_adapter (0.5.0) ostruct (0.6.1) + pagy (9.3.3) paper_trail (16.0.0) activerecord (>= 6.1) request_store (~> 1.4) @@ -739,7 +728,6 @@ DEPENDENCIES jsbundling-rails json-schema (~> 5.1.1) json_spec - kaminari (>= 1.2.1) laa-cda! laa-fee-calculator-client (~> 2.0) launchy (~> 3.0.1) @@ -754,6 +742,7 @@ DEPENDENCIES net-smtp net-ssh (~> 7.3) nokogiri (~> 1.18) + pagy paper_trail (~> 16.0.0) parallel_tests pg (~> 1.5.9) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cdcdc4ef46..5ffbe00b09 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,8 @@ class ApplicationController < ActionController::Base skip_forgery_protection if ENV.fetch('DISABLE_CSRF', nil) == '1' include CookieConcern + include Pagy::Backend + before_action :set_default_cookie_usage helper_method :current_user_messages_count diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7e4af7d3ca..4b2966670d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,6 @@ module ApplicationHelper include GOVUKDesignSystemFormBuilder::BuilderHelper + include Pagy::Frontend def current_user_is_caseworker? current_user.persona.is_a?(CaseWorker) diff --git a/app/views/kaminari/_first_page.html.haml b/app/views/kaminari/_first_page.html.haml deleted file mode 100644 index 3280a7f489..0000000000 --- a/app/views/kaminari/_first_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "First" page --# available local variables --# url: url to the first page --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.first - = link_to_unless current_page.first?, t('views.pagination.first_html').html_safe, url, remote: remote diff --git a/app/views/kaminari/_gap.html.haml b/app/views/kaminari/_gap.html.haml deleted file mode 100644 index 3406c40770..0000000000 --- a/app/views/kaminari/_gap.html.haml +++ /dev/null @@ -1,8 +0,0 @@ --# Non-link tag that stands for skipped pages... --# available local variables --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.page.gap - = t('views.pagination.truncate').html_safe diff --git a/app/views/kaminari/_last_page.html.haml b/app/views/kaminari/_last_page.html.haml deleted file mode 100644 index a2a307e08c..0000000000 --- a/app/views/kaminari/_last_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Last" page --# available local variables --# url: url to the last page --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.last - = link_to_unless current_page.last?, t('views.pagination.last_html').html_safe, url, :remote => remote diff --git a/app/views/kaminari/_next_page.html.haml b/app/views/kaminari/_next_page.html.haml deleted file mode 100644 index 5fed14c817..0000000000 --- a/app/views/kaminari/_next_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Next" page --# available local variables --# url: url to the next page --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.next - = link_to_unless current_page.last?, t('views.pagination.next_html').html_safe, url, rel: 'next', remote: remote diff --git a/app/views/kaminari/_page.html.haml b/app/views/kaminari/_page.html.haml deleted file mode 100644 index 50b913c3b7..0000000000 --- a/app/views/kaminari/_page.html.haml +++ /dev/null @@ -1,10 +0,0 @@ --# Link showing page number --# available local variables --# page: a page object for "this" page --# url: url to this page --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li{ class: "page#{' current' if page.current?}" } - = link_to_unless page.current?, t('views.pagination.page_html', count: page), url, { remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil } diff --git a/app/views/kaminari/_paginator.html.haml b/app/views/kaminari/_paginator.html.haml deleted file mode 100644 index f3540cb8af..0000000000 --- a/app/views/kaminari/_paginator.html.haml +++ /dev/null @@ -1,23 +0,0 @@ --# The container tag --# available local variables --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote --# paginator: the paginator that renders the pagination tags inside -= paginator.render do - .govuk-grid-row - .govuk-grid-column-full - %nav.pagination.app-pagintion--inline - %p.govuk-visually-hidden - = t('views.pagination.title') - %ul.govuk-list - = first_page_tag unless current_page.first? - = prev_page_tag unless current_page.first? - - each_page do |page| - - if page.left_outer? || page.right_outer? || page.inside_window? - = page_tag page - - elsif !page.was_truncated? - = gap_tag - = next_page_tag unless current_page.last? - = last_page_tag unless current_page.last? diff --git a/app/views/kaminari/_prev_page.html.haml b/app/views/kaminari/_prev_page.html.haml deleted file mode 100644 index 006e26cf0b..0000000000 --- a/app/views/kaminari/_prev_page.html.haml +++ /dev/null @@ -1,9 +0,0 @@ --# Link to the "Previous" page --# available local variables --# url: url to the previous page --# current_page: a page object for the currently displayed page --# total_pages: total number of pages --# per_page: number of items to fetch per page --# remote: data-remote -%li.prev - = link_to_unless current_page.first?, t('views.pagination.previous_html').html_safe, url, rel: 'prev', remote: remote diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb deleted file mode 100644 index 36bf80260d..0000000000 --- a/config/initializers/kaminari_config.rb +++ /dev/null @@ -1,10 +0,0 @@ -Kaminari.configure do |config| - # config.default_per_page = 25 - # config.max_per_page = nil - config.window = 3 - # config.outer_window = 0 - # config.left = 0 - # config.right = 0 - # config.page_method_name = :page - # config.param_name = :page -end diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb new file mode 100644 index 0000000000..062ef3f37c --- /dev/null +++ b/config/initializers/pagy.rb @@ -0,0 +1,220 @@ +# frozen_string_literal: true + +# Pagy initializer file (9.3.3) +# Customize only what you really need and notice that the core Pagy works also without any of the following lines. +# Should you just cherry pick part of this file, please maintain the require-order of the extras + + +# Pagy Variables +# See https://ddnexus.github.io/pagy/docs/api/pagy#variables +# You can set any pagy variable as a Pagy::DEFAULT. They can also be overridden per instance by just passing them to +# Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods +# Here are the few that make more sense as DEFAULTs: +# Pagy::DEFAULT[:limit] = 20 # default +# Pagy::DEFAULT[:size] = 7 # default +# Pagy::DEFAULT[:ends] = true # default +# Pagy::DEFAULT[:page_param] = :page # default +# Pagy::DEFAULT[:count_args] = [] # example for non AR ORMs +# Pagy::DEFAULT[:max_pages] = 3000 # example + + +# Extras +# See https://ddnexus.github.io/pagy/categories/extra + + +# Legacy Compatibility Extras + +# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`) +# See https://ddnexus.github.io/pagy/docs/extras/size +# require 'pagy/extras/size' # must be required before the other extras + + +# Backend Extras + +# Arel extra: For better performance utilizing grouped ActiveRecord collections: +# See: https://ddnexus.github.io/pagy/docs/extras/arel +# require 'pagy/extras/arel' + +# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding +# See https://ddnexus.github.io/pagy/docs/extras/array +# require 'pagy/extras/array' + +# Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day) +# See https://ddnexus.github.io/pagy/docs/extras/calendar +# require 'pagy/extras/calendar' +# Default for each calendar unit class in IRB: +# >> Pagy::Calendar::Year::DEFAULT +# >> Pagy::Calendar::Quarter::DEFAULT +# >> Pagy::Calendar::Month::DEFAULT +# >> Pagy::Calendar::Week::DEFAULT +# >> Pagy::Calendar::Day::DEFAULT +# +# Uncomment the following lines, if you need calendar localization without using the I18n extra +# module LocalizePagyCalendar +# def localize(time, opts) +# ::I18n.l(time, **opts) +# end +# end +# Pagy::Calendar.prepend LocalizePagyCalendar + +# Countless extra: Paginate without any count, saving one query per rendering +# See https://ddnexus.github.io/pagy/docs/extras/countless +# require 'pagy/extras/countless' +# Pagy::DEFAULT[:countless_minimal] = false # default (eager loading) + +# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects +# See https://ddnexus.github.io/pagy/docs/extras/elasticsearch_rails +# Default :pagy_search method: change only if you use also +# the searchkick or meilisearch extra that defines the same +# Pagy::DEFAULT[:elasticsearch_rails_pagy_search] = :pagy_search +# Default original :search method called internally to do the actual search +# Pagy::DEFAULT[:elasticsearch_rails_search] = :search +# require 'pagy/extras/elasticsearch_rails' + +# Headers extra: http response headers (and other helpers) useful for API pagination +# See https://ddnexus.github.io/pagy/docs/extras/headers +# require 'pagy/extras/headers' +# Pagy::DEFAULT[:headers] = { page: 'Current-Page', +# limit: 'Page-Items', +# count: 'Total-Count', +# pages: 'Total-Pages' } # default + +# Keyset extra: Paginate with the Pagy keyset pagination technique +# See https://ddnexus.github.io/pagy/docs/extras/keyset +# require 'pagy/extras/keyset' + +# Meilisearch extra: Paginate `Meilisearch` result objects +# See https://ddnexus.github.io/pagy/docs/extras/meilisearch +# Default :pagy_search method: change only if you use also +# the elasticsearch_rails or searchkick extra that define the same method +# Pagy::DEFAULT[:meilisearch_pagy_search] = :pagy_search +# Default original :search method called internally to do the actual search +# Pagy::DEFAULT[:meilisearch_search] = :ms_search +# require 'pagy/extras/meilisearch' + +# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc. +# See https://ddnexus.github.io/pagy/docs/extras/metadata +# you must require the JS Tools internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels +# require 'pagy/extras/js_tools' +# require 'pagy/extras/metadata' +# For performance reasons, you should explicitly set ONLY the metadata you use in the frontend +# Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example + +# Searchkick extra: Paginate `Searchkick::Results` objects +# See https://ddnexus.github.io/pagy/docs/extras/searchkick +# Default :pagy_search method: change only if you use also +# the elasticsearch_rails or meilisearch extra that defines the same +# Pagy::DEFAULT[:searchkick_pagy_search] = :pagy_search +# Default original :search method called internally to do the actual search +# Pagy::DEFAULT[:searchkick_search] = :search +# require 'pagy/extras/searchkick' +# uncomment if you are going to use Searchkick.pagy_search +# Searchkick.extend Pagy::Searchkick + + +# Frontend Extras + +# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination +# See https://ddnexus.github.io/pagy/docs/extras/bootstrap +# require 'pagy/extras/bootstrap' + +# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination +# See https://ddnexus.github.io/pagy/docs/extras/bulma +# require 'pagy/extras/bulma' + +# Pagy extra: Add the pagy styled versions of the javascript-powered navs +# and a few other components to the Pagy::Frontend module. +# See https://ddnexus.github.io/pagy/docs/extras/pagy +# require 'pagy/extras/pagy' + +# Multi size var used by the *_nav_js helpers +# See https://ddnexus.github.io/pagy/docs/extras/pagy#steps +# Pagy::DEFAULT[:steps] = { 0 => 5, 540 => 7, 720 => 9 } # example + + +# Feature Extras + +# Gearbox extra: Automatically change the limit per page depending on the page number +# See https://ddnexus.github.io/pagy/docs/extras/gearbox +# require 'pagy/extras/gearbox' +# set to false only if you want to make :gearbox_extra an opt-in variable +# Pagy::DEFAULT[:gearbox_extra] = false # default true +# Pagy::DEFAULT[:gearbox_limit] = [15, 30, 60, 100] # default + +# Limit extra: Allow the client to request a custom limit per page with an optional selector UI +# See https://ddnexus.github.io/pagy/docs/extras/limit +# require 'pagy/extras/limit' +# set to false only if you want to make :limit_extra an opt-in variable +# Pagy::DEFAULT[:limit_extra] = false # default true +# Pagy::DEFAULT[:limit_param] = :limit # default +# Pagy::DEFAULT[:limit_max] = 100 # default + +# Overflow extra: Allow for easy handling of overflowing pages +# See https://ddnexus.github.io/pagy/docs/extras/overflow +require 'pagy/extras/overflow' +Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception) + +# Trim extra: Remove the page=1 param from links +# See https://ddnexus.github.io/pagy/docs/extras/trim +# require 'pagy/extras/trim' +# set to false only if you want to make :trim_extra an opt-in variable +# Pagy::DEFAULT[:trim_extra] = false # default true + +# Standalone extra: Use pagy in non Rack environment/gem +# See https://ddnexus.github.io/pagy/docs/extras/standalone +# require 'pagy/extras/standalone' +# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default + +# Jsonapi extra: Implements JSON:API specifications +# See https://ddnexus.github.io/pagy/docs/extras/jsonapi +# require 'pagy/extras/jsonapi' # must be required after the other extras +# set to false only if you want to make :jsonapi an opt-in variable +# Pagy::DEFAULT[:jsonapi] = false # default true + +# Rails +# Enable the .js file required by the helpers that use javascript +# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_limit_selector_js) +# See https://ddnexus.github.io/pagy/docs/api/javascript + +# With the asset pipeline +# Sprockets need to look into the pagy javascripts dir, so add it to the assets paths +# Rails.application.config.assets.paths << Pagy.root.join('javascripts') + +# I18n + +# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem +# See https://ddnexus.github.io/pagy/docs/api/i18n +# Notice: No need to configure anything in this section if your app uses only "en" +# or if you use the i18n extra below +# +# Examples: +# load the "de" built-in locale: +# Pagy::I18n.load(locale: 'de') +# +# load the "de" locale defined in the custom file at :filepath: +# Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml') +# +# load the "de", "en" and "es" built-in locales: +# (the first passed :locale will be used also as the default_locale) +# Pagy::I18n.load({ locale: 'de' }, +# { locale: 'en' }, +# { locale: 'es' }) +# +# load the "en" built-in locale, a custom "es" locale, +# and a totally custom locale complete with a custom :pluralize proc: +# (the first passed :locale will be used also as the default_locale) +# Pagy::I18n.load({ locale: 'en' }, +# { locale: 'es', filepath: 'path/to/pagy-es.yml' }, +# { locale: 'xyz', # not built-in +# filepath: 'path/to/pagy-xyz.yml', +# pluralize: lambda{ |count| ... } ) + + +# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory +# than the default pagy internal i18n (see above) +# See https://ddnexus.github.io/pagy/docs/extras/i18n +# require 'pagy/extras/i18n' +Pagy::I18n.load(locale: 'en', filepath: 'config/locales/pagy.en.yml') + +# When you are done setting your own default freeze it, so it will not get changed accidentally +Pagy::DEFAULT.freeze diff --git a/config/locales/pagy.en.yml b/config/locales/pagy.en.yml new file mode 100644 index 0000000000..b493627ffe --- /dev/null +++ b/config/locales/pagy.en.yml @@ -0,0 +1,20 @@ +en: + pagy: + aria_label: + nav: + one: "Page" + other: "Pages" + prev: "Previous" + next: "Next" + prev: "Previous" + next: "Next" + gap: "…" + item_name: + one: "claim" + other: "claims" + info: + no_items: "No %{item_name} found" + single_page: "Displaying %{count} %{item_name}" + multiple_pages: "Displaying %{item_name} %{from}-%{to} of %{count} in total" + combo_nav_js: "Page %{page_input} of %{pages}" + limit_selector_js: "Show %{limit_input} %{item_name} per page" \ No newline at end of file From cdda5db81302cc9dc7f60ca9ba50cf79f75e5b74 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Tue, 17 Dec 2024 14:11:00 +0000 Subject: [PATCH 2/7] Use Pagy on admin users page Replaces the uses of the Kaminari gem for pagination with Pagy on the superadmin 'All users' page. --- app/controllers/concerns/pagination_helpers.rb | 2 +- app/controllers/users_controller.rb | 2 +- app/views/users/index.html.haml | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/concerns/pagination_helpers.rb b/app/controllers/concerns/pagination_helpers.rb index 552bef3c41..20740d13e0 100644 --- a/app/controllers/concerns/pagination_helpers.rb +++ b/app/controllers/concerns/pagination_helpers.rb @@ -14,6 +14,6 @@ def page_size end def current_page - params[:page].to_i + [params[:page].to_i, 1].max end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 26197ed5ac..f0e819ac03 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -31,7 +31,7 @@ class UsersController < ApplicationController include PaginationHelpers def index - @users = User.order(created_at: :desc).page(current_page).per(page_size) + @pagy, @users = pagy(User.order(created_at: :desc), page: current_page, limit: page_size) end def update_settings diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 41c9c7349e..b6b56f3b0e 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -29,4 +29,6 @@ = govuk_table_td('data-label': t('.created')) do = user.created_at -= paginate @users +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe + From 46ca16cc3b4873c9d5cf0cd738189becded931af Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Tue, 17 Dec 2024 14:42:22 +0000 Subject: [PATCH 3/7] Use Pagy on provider claims pages Replaces the uses of the Kaminari gem for pagination with Pagy on the provider 'Your claims', 'Your claim archive', 'Your outstanding claims' and 'Your authorised claims' pages. --- app/controllers/external_users/claims_controller.rb | 3 ++- app/views/external_users/claims/_main_claims_list.html.haml | 2 +- app/views/external_users/claims/archived.html.haml | 4 +++- app/views/external_users/claims/authorised.html.haml | 6 ++++-- app/views/external_users/claims/index.html.haml | 4 +++- app/views/external_users/claims/outstanding.html.haml | 6 ++++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/controllers/external_users/claims_controller.rb b/app/controllers/external_users/claims_controller.rb index e9cb879e0d..c50f74b6c9 100644 --- a/app/controllers/external_users/claims_controller.rb +++ b/app/controllers/external_users/claims_controller.rb @@ -253,7 +253,8 @@ def sort_defaults(defaults = {}) def sort_and_paginate(options = {}) sort_defaults(options) - @claims = @claims.sort_using(sort_column, sort_direction).page(current_page).per(@sort_defaults[:pagination]) + @pagy, @claims = pagy(@claims.sort_using(sort_column, sort_direction), page: current_page, + limit: @sort_defaults[:pagination]) end def scheme diff --git a/app/views/external_users/claims/_main_claims_list.html.haml b/app/views/external_users/claims/_main_claims_list.html.haml index a62671ef23..4cccbd3c81 100644 --- a/app/views/external_users/claims/_main_claims_list.html.haml +++ b/app/views/external_users/claims/_main_claims_list.html.haml @@ -7,7 +7,7 @@ - if @claims.none? = t('shared.no_claims_found') - else - = "Showing #{pluralize(@claims.unscope(:order).size, 'claim')} of #{@claims.total_count}" + = pagy_info(@pagy).html_safe - if params[:search].present? = "matching #{params[:search]}" diff --git a/app/views/external_users/claims/archived.html.haml b/app/views/external_users/claims/archived.html.haml index e97b2e6692..46f7afeffc 100644 --- a/app/views/external_users/claims/archived.html.haml +++ b/app/views/external_users/claims/archived.html.haml @@ -9,4 +9,6 @@ #details = render partial: 'main_claims_list', locals: { claims: @claims } - = paginate @claims + +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe diff --git a/app/views/external_users/claims/authorised.html.haml b/app/views/external_users/claims/authorised.html.haml index d796ef7a89..2603ca5408 100644 --- a/app/views/external_users/claims/authorised.html.haml +++ b/app/views/external_users/claims/authorised.html.haml @@ -5,9 +5,11 @@ %p.govuk-heading-l %span.govuk-caption-l - = t('.with_total_assessed_value_of_html', size: @claims.unscope(:order).size, total: @claims.total_count) + = t('.with_total_assessed_value_of_html', size: @claims.unscope(:order).size, total: @pagy.count) = number_to_currency(@total_value) #details#listanchor = render partial: 'main_claims_list', locals: { claims: @claims } - = paginate @claims + +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe diff --git a/app/views/external_users/claims/index.html.haml b/app/views/external_users/claims/index.html.haml index ec676ecddc..7e72eaa96d 100644 --- a/app/views/external_users/claims/index.html.haml +++ b/app/views/external_users/claims/index.html.haml @@ -19,4 +19,6 @@ .importer-results{'aria-live': 'polite'} = render partial: 'main_claims_list', locals: { claims: @claims } -= paginate @claims + +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe diff --git a/app/views/external_users/claims/outstanding.html.haml b/app/views/external_users/claims/outstanding.html.haml index 40ee3dea75..55ddec8af7 100644 --- a/app/views/external_users/claims/outstanding.html.haml +++ b/app/views/external_users/claims/outstanding.html.haml @@ -5,9 +5,11 @@ %p.govuk-heading-l %span.govuk-caption-l - = t('.claims_value_html', size: @claims.unscope(:order).size, total: @claims.total_count) + = t('.claims_value_html', size: @claims.unscope(:order).size, total: @pagy.count) = number_to_currency(@total_value) #details#listanchor = render partial: 'main_claims_list', locals: { claims: @claims } - = paginate @claims + +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe From 6c0ecdfddb1a2644308fc5f61b425054275da4e1 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Thu, 19 Dec 2024 11:26:22 +0000 Subject: [PATCH 4/7] Use Pagy on caseworker claims pages Replaces the uses of the Kaminari gem for pagination with Pagy on the caseworker claims pages. This is more complex than the change to the provider claims pages due to the way claims data is fetched from the API. Pagination is currently done by the API, so it is necessary to make changes there too. This commit * updates `API::V2::CaseWorkers::Claim` to use Pagy to paginate claims and pass the resulting Pagy object to `API::Entities::PaginatedCollection` * updates `API::Entities::PaginatedCollection` to read pagination data from the Pagy object and include it in the API response * updates `CaseWorkers::ClaimsController` to create a new Pagy object on the client side based on pagination data received from the API * updates views to use the Pagy object when displaying pagination controls --- .../case_workers/claims_controller.rb | 9 +++++++-- .../api/entities/paginated_collection.rb | 12 ++++++++---- app/interfaces/api/v2/case_workers/claim.rb | 18 ++++++++++++++---- app/interfaces/api/v2/criteria_helper.rb | 1 + .../case_workers/claims/_claims_list.html.haml | 2 +- .../case_workers/claims/archived.html.haml | 4 +++- app/views/case_workers/claims/index.html.haml | 4 +++- spec/api/v2/case_workers/claim_spec.rb | 8 ++++---- .../case_workers/claims_controller_spec.rb | 4 +++- 9 files changed, 44 insertions(+), 18 deletions(-) diff --git a/app/controllers/case_workers/claims_controller.rb b/app/controllers/case_workers/claims_controller.rb index 6061416712..cf213d524c 100644 --- a/app/controllers/case_workers/claims_controller.rb +++ b/app/controllers/case_workers/claims_controller.rb @@ -119,8 +119,13 @@ def search_terms end def sort_and_paginate - # GOTCHA: must paginate in same call that sorts/orders - @claims = @claims.sort_using(sort_column, sort_direction).page(current_page).per(page_size) unless @claims.remote? + @claims = @claims.sort_using(sort_column, sort_direction) unless @claims.remote? + @pagy = Pagy.new( + count: @claims.total_count, + limit: @claims.limit_value, + page: @claims.current_page, + pages: @claims.total_pages + ) end def sort_claims diff --git a/app/interfaces/api/entities/paginated_collection.rb b/app/interfaces/api/entities/paginated_collection.rb index 1d1e1eb5ab..dd1c89528e 100644 --- a/app/interfaces/api/entities/paginated_collection.rb +++ b/app/interfaces/api/entities/paginated_collection.rb @@ -18,20 +18,24 @@ def items object[:items] end + def pagination + options[:pagy] + end + def current_page - items.current_page + pagination.page end def total_pages - items.total_pages + pagination.pages end def total_count - items.total_count + pagination.count end def limit_value - items.limit_value + pagination.limit end end end diff --git a/app/interfaces/api/v2/case_workers/claim.rb b/app/interfaces/api/v2/case_workers/claim.rb index dbc78b0947..9327363f89 100644 --- a/app/interfaces/api/v2/case_workers/claim.rb +++ b/app/interfaces/api/v2/case_workers/claim.rb @@ -51,6 +51,14 @@ def value_band_id params[:value_band_id] end + def page + params[:page] + end + + def limit + params[:limit] + end + def current_claims current_user.claims.where(id: ::Claim::BaseClaim.search( search_terms, Claims::StateMachine::CASEWORKER_DASHBOARD_UNDER_ASSESSMENT_STATES, *search_options @@ -82,19 +90,21 @@ def claims_scope end def claims - claims_scope + @pagy, @claims = pagy(claims_scope .includes(:external_user, :case_type, :injection_attempts, :case_workers, :court, :messages, defendants: %i[representation_orders]) - .sort_using(params[:sorting], params[:direction]) - .page(params[:page]).per(params[:limit]) + .sort_using(params[:sorting], params[:direction]), + page:, limit:) + + @claims end end resource :claims do desc 'Retrieve list of allocated, unallocated or archived claims' get do - present claims, with: API::Entities::PaginatedCollection, user: current_user + present claims, with: API::Entities::PaginatedCollection, user: current_user, pagy: @pagy end end end diff --git a/app/interfaces/api/v2/criteria_helper.rb b/app/interfaces/api/v2/criteria_helper.rb index 9217f90170..0b6070ecab 100644 --- a/app/interfaces/api/v2/criteria_helper.rb +++ b/app/interfaces/api/v2/criteria_helper.rb @@ -1,6 +1,7 @@ module API::V2 module CriteriaHelper extend Grape::API::Helpers + include Pagy::Backend params :pagination do optional :page, type: Integer, desc: 'OPTIONAL: Current page.' diff --git a/app/views/case_workers/claims/_claims_list.html.haml b/app/views/case_workers/claims/_claims_list.html.haml index b4e85788ab..0f29ecab4f 100644 --- a/app/views/case_workers/claims/_claims_list.html.haml +++ b/app/views/case_workers/claims/_claims_list.html.haml @@ -1,7 +1,7 @@ .govuk-grid-row{class: 'govuk-!-margin-top-9'} .govuk-grid-column-full %p.govuk-body{class: 'claim-count govuk-!-text-align-right'} - = t('.number_of_claims', claim_count: claims.total_count) + = pagy_info(@pagy).html_safe .govuk-grid-column-full = govuk_table do diff --git a/app/views/case_workers/claims/archived.html.haml b/app/views/case_workers/claims/archived.html.haml index d5b9761210..985264763f 100644 --- a/app/views/case_workers/claims/archived.html.haml +++ b/app/views/case_workers/claims/archived.html.haml @@ -4,4 +4,6 @@ = render partial: 'layouts/header', locals: { page_heading: t('.page_heading')} = render partial: 'search_form', locals: { archived: true } = render partial: 'claims_list', locals: { claims: @claims } -= paginate @claims + +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe diff --git a/app/views/case_workers/claims/index.html.haml b/app/views/case_workers/claims/index.html.haml index 58fc855823..7290eccf5b 100644 --- a/app/views/case_workers/claims/index.html.haml +++ b/app/views/case_workers/claims/index.html.haml @@ -4,4 +4,6 @@ = render partial: 'layouts/header', locals: { page_heading: t('.page_heading') } = render partial: 'search_form', locals: { archived: false } = render partial: 'claims_list', locals: { claims: @claims } -= paginate @claims + +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe diff --git a/spec/api/v2/case_workers/claim_spec.rb b/spec/api/v2/case_workers/claim_spec.rb index 7ba32b4204..77fbd27cb9 100644 --- a/spec/api/v2/case_workers/claim_spec.rb +++ b/spec/api/v2/case_workers/claim_spec.rb @@ -71,7 +71,7 @@ def do_request(my_params = params) direction: 'asc', filter: 'all', limit: 25, - page: 0, + page: 1, scheme: 'lgfs', search: '', sorting: 'last_submitted_at', @@ -137,16 +137,16 @@ def pagination_details(response) context 'default' do it 'paginates with default values' do pagination = pagination_details(do_request) - expect(pagination.sort.to_h).to eq({ current_page: 1, limit_value: 10, total_count: 0, total_pages: 0 }) + expect(pagination.sort.to_h).to eq({ current_page: 1, total_pages: 1, limit_value: 10, total_count: 0 }) end end context 'custom values' do let(:pagination) { { limit: 5, page: 3 } } - it 'paginates with default values' do + it 'paginates with custom values' do pagination = pagination_details(do_request) - expect(pagination.sort.to_h).to eq({ current_page: 3, limit_value: 5, total_count: 0, total_pages: 0 }) + expect(pagination.sort.to_h).to eq({ current_page: 3, total_pages: 1, limit_value: 5, total_count: 0 }) end end end diff --git a/spec/controllers/case_workers/claims_controller_spec.rb b/spec/controllers/case_workers/claims_controller_spec.rb index bde3d91d7e..4a0ab3a925 100644 --- a/spec/controllers/case_workers/claims_controller_spec.rb +++ b/spec/controllers/case_workers/claims_controller_spec.rb @@ -22,12 +22,14 @@ { sorting: 'last_submitted_at', direction: 'asc', - page: 0, + page: 1, limit: 10, search: nil } end + before { allow(claims_collection).to receive_messages(total_count: 15, total_pages: 2, limit_value: 10, current_page: 1) } + context 'no search terms present' do it 'calls case worker claims service with appropriate params' do expect(Claims::CaseWorkerClaims).to receive(:new).with(current_user: @case_worker.user, action: 'current', criteria:).and_return(claims_service) From ee54d63b1592badbb64c6f5c7ad8ca4317c6c420 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Thu, 19 Dec 2024 11:26:54 +0000 Subject: [PATCH 5/7] Use Pagy on caseworker admin allocation pages Replaces the uses of the Kaminari gem for pagination with Pagy on the caseworker allocation pages. This is more complex than the change to the provider claims pages due to the way claims data is fetched from the API. Pagination is currently done by the API, so it is necessary to make changes there too. Similar to the previous commit it is necessary to create a new Pagy object in the CaseWorkers::Admin::AllocationsController based on pagination data received from the API. This also fixes a bug(?) where the `sort_and_paginate` method was never being called in that controller. --- .rubocop_todo.yml | 3 ++- .../case_workers/admin/allocations_controller.rb | 9 ++++++++- .../admin/allocations/_re_allocation.html.haml | 2 +- app/views/case_workers/admin/allocations/new.html.haml | 3 ++- .../case_workers/admin/allocations_controller_spec.rb | 9 +++++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ae109039f4..4217cbaa9e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -242,10 +242,11 @@ Metrics/AbcSize: - 'spec/support/seed_helpers.rb' - 'spec/support/validation_helpers.rb' -# Offense count: 19 +# Offense count: 20 # Configuration parameters: CountComments, Max, CountAsOne. Metrics/ClassLength: Exclude: + - 'app/controllers/case_workers/claims_controller.rb' - 'app/controllers/external_users/claims_controller.rb' - 'app/interfaces/api/entities/search_result.rb' - 'app/interfaces/api/v1/dropdown_data.rb' diff --git a/app/controllers/case_workers/admin/allocations_controller.rb b/app/controllers/case_workers/admin/allocations_controller.rb index c00574f9b1..65dcf08afb 100644 --- a/app/controllers/case_workers/admin/allocations_controller.rb +++ b/app/controllers/case_workers/admin/allocations_controller.rb @@ -7,6 +7,7 @@ class AllocationsController < CaseWorkers::Admin::ApplicationController before_action :set_claims, only: %i[new create] before_action :set_summary_values, only: [:new], if: :summary_from_previous_request? before_action :process_claim_ids, only: [:create], if: :quantity_allocation? + before_action :sort_and_paginate def new @allocation = Allocation.new @@ -88,7 +89,13 @@ def search_claims(states = nil) end def sort_and_paginate - @claims = @claims.sort_using(sort_column, sort_direction).page(current_page).per(page_size) + @claims = @claims.sort_using(sort_column, sort_direction) unless @claims.remote? + @pagy = Pagy.new( + count: @claims.total_count, + limit: @claims.limit_value, + page: @claims.current_page, + pages: @claims.total_pages + ) end def allocation_params diff --git a/app/views/case_workers/admin/allocations/_re_allocation.html.haml b/app/views/case_workers/admin/allocations/_re_allocation.html.haml index 2f1c6d5c77..54479f4e00 100644 --- a/app/views/case_workers/admin/allocations/_re_allocation.html.haml +++ b/app/views/case_workers/admin/allocations/_re_allocation.html.haml @@ -35,7 +35,7 @@ .govuk-grid-column-one-half = t('.re_allocation') .govuk-grid-column-one-half.claim-count{ class: 'govuk-!-text-align-right' } - = t('.number_of_claims', claim_count: @claims.total_count) + = pagy_info(@pagy).html_safe = govuk_table_thead do = govuk_table_row do diff --git a/app/views/case_workers/admin/allocations/new.html.haml b/app/views/case_workers/admin/allocations/new.html.haml index 4d203f581e..db4c8b5dde 100644 --- a/app/views/case_workers/admin/allocations/new.html.haml +++ b/app/views/case_workers/admin/allocations/new.html.haml @@ -13,4 +13,5 @@ .js-re-allocation-page = render partial: 're_allocation' - = paginate @claims + %nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe diff --git a/spec/controllers/case_workers/admin/allocations_controller_spec.rb b/spec/controllers/case_workers/admin/allocations_controller_spec.rb index d9c0dafb49..90cda475b8 100644 --- a/spec/controllers/case_workers/admin/allocations_controller_spec.rb +++ b/spec/controllers/case_workers/admin/allocations_controller_spec.rb @@ -2,15 +2,16 @@ RSpec.describe CaseWorkers::Admin::AllocationsController do before(:all) do - # create(:graduated_fee_type, code: 'GTRL') #use seeded case types 'real' fee type codes - # load '#{Rails.root}/db/seeds/case_types.rb' @case_worker = create(:case_worker) @admin = create(:case_worker, :admin) end after(:all) { clean_database } - before { sign_in @admin.user } + before do + sign_in @admin.user + allow(claims_collection).to receive_messages(total_count: 15, total_pages: 2, limit_value: 10, current_page: 1) + end let(:tab) { nil } # default tab is 'unallocated' when tab not provided @@ -30,7 +31,7 @@ direction: 'asc', scheme: 'agfs', filter: 'all', - page: 0, + page: 1, limit: 25, search: nil, value_band_id: 0 From 14141d425a576cfb2089dfdd2183d213f1f87467 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Thu, 19 Dec 2024 18:26:35 +0000 Subject: [PATCH 6/7] Move pagination links to partial Tidies up the views a little by moving the code to generate pagination controls to a reusable shared partial. This also adds some extra control to hide the pagination links when only one page is displayed, in line with GDS guidelines. --- app/views/case_workers/admin/allocations/new.html.haml | 3 +-- app/views/case_workers/claims/archived.html.haml | 3 +-- app/views/case_workers/claims/index.html.haml | 3 +-- app/views/external_users/claims/archived.html.haml | 4 +--- app/views/external_users/claims/authorised.html.haml | 4 +--- app/views/external_users/claims/index.html.haml | 3 +-- app/views/external_users/claims/outstanding.html.haml | 4 +--- app/views/shared/_pagination.html.haml | 2 ++ app/views/users/index.html.haml | 3 +-- 9 files changed, 10 insertions(+), 19 deletions(-) create mode 100644 app/views/shared/_pagination.html.haml diff --git a/app/views/case_workers/admin/allocations/new.html.haml b/app/views/case_workers/admin/allocations/new.html.haml index db4c8b5dde..60924cb5fa 100644 --- a/app/views/case_workers/admin/allocations/new.html.haml +++ b/app/views/case_workers/admin/allocations/new.html.haml @@ -13,5 +13,4 @@ .js-re-allocation-page = render partial: 're_allocation' - %nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/case_workers/claims/archived.html.haml b/app/views/case_workers/claims/archived.html.haml index 985264763f..b00e8c887a 100644 --- a/app/views/case_workers/claims/archived.html.haml +++ b/app/views/case_workers/claims/archived.html.haml @@ -5,5 +5,4 @@ = render partial: 'search_form', locals: { archived: true } = render partial: 'claims_list', locals: { claims: @claims } -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' diff --git a/app/views/case_workers/claims/index.html.haml b/app/views/case_workers/claims/index.html.haml index 7290eccf5b..9106f97794 100644 --- a/app/views/case_workers/claims/index.html.haml +++ b/app/views/case_workers/claims/index.html.haml @@ -5,5 +5,4 @@ = render partial: 'search_form', locals: { archived: false } = render partial: 'claims_list', locals: { claims: @claims } -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' diff --git a/app/views/external_users/claims/archived.html.haml b/app/views/external_users/claims/archived.html.haml index 46f7afeffc..45b826d4a0 100644 --- a/app/views/external_users/claims/archived.html.haml +++ b/app/views/external_users/claims/archived.html.haml @@ -9,6 +9,4 @@ #details = render partial: 'main_claims_list', locals: { claims: @claims } - -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/external_users/claims/authorised.html.haml b/app/views/external_users/claims/authorised.html.haml index 2603ca5408..4da1e67d51 100644 --- a/app/views/external_users/claims/authorised.html.haml +++ b/app/views/external_users/claims/authorised.html.haml @@ -10,6 +10,4 @@ #details#listanchor = render partial: 'main_claims_list', locals: { claims: @claims } - -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/external_users/claims/index.html.haml b/app/views/external_users/claims/index.html.haml index 7e72eaa96d..01aae60ced 100644 --- a/app/views/external_users/claims/index.html.haml +++ b/app/views/external_users/claims/index.html.haml @@ -20,5 +20,4 @@ = render partial: 'main_claims_list', locals: { claims: @claims } -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' \ No newline at end of file diff --git a/app/views/external_users/claims/outstanding.html.haml b/app/views/external_users/claims/outstanding.html.haml index 55ddec8af7..1ad26a2527 100644 --- a/app/views/external_users/claims/outstanding.html.haml +++ b/app/views/external_users/claims/outstanding.html.haml @@ -10,6 +10,4 @@ #details#listanchor = render partial: 'main_claims_list', locals: { claims: @claims } - -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/shared/_pagination.html.haml b/app/views/shared/_pagination.html.haml new file mode 100644 index 0000000000..f774844775 --- /dev/null +++ b/app/views/shared/_pagination.html.haml @@ -0,0 +1,2 @@ +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe if @pagy.pages > 1 \ No newline at end of file diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index b6b56f3b0e..e89f2f7ef8 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -29,6 +29,5 @@ = govuk_table_td('data-label': t('.created')) do = user.created_at -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' From 0994d9fbcc9915ad0dd669f131dac391b979b3b4 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Thu, 19 Dec 2024 17:23:22 +0000 Subject: [PATCH 7/7] Update VCR cassettes Requests to the API have changed as Pagy indexes pages from 1, not 0 used by Kaminari. This means the `pages` parameter in API calls to the `caseworker/claims` endpoint now use 1 instead of 0, and VCR cassettes need to be updated to reflect this. This also updates a feature test which had become inaccurate to a change of onscreen wording as a result of the use of the @pagy_info helper method to display pagination data. --- features/re_allocation.feature | 4 ++-- vcr/cassettes/features/case_workers/admin/allocation.yml | 6 +++--- vcr/cassettes/features/case_workers/admin/reallocation.yml | 6 +++--- vcr/cassettes/features/case_workers/claims/authorise.yml | 4 ++-- .../features/case_workers/claims/injection_error.yml | 6 +++--- vcr/cassettes/features/case_workers/claims/messaging.yml | 4 ++-- vcr/cassettes/features/case_workers/claims/refuse.yml | 6 +++--- vcr/cassettes/features/case_workers/claims/reject.yml | 4 ++-- vcr/cassettes/features/provider_management.yml | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/features/re_allocation.feature b/features/re_allocation.feature index fba3f42e9e..6a6f229947 100644 --- a/features/re_allocation.feature +++ b/features/re_allocation.feature @@ -14,7 +14,7 @@ Feature: Case worker admin re-allocates claims When I click the link 'Re-allocation' Then I should see a page title "View the re-allocation queue" - And I should see 'Number of claims: 1' + And I should see 'Displaying 1 claim' When I fill in 'Search' with 'does not exist' And I click the button 'Search claims' @@ -28,7 +28,7 @@ Feature: Case worker admin re-allocates claims When I click the link 'Re-allocation' Then I should see a page title "View the re-allocation queue" - And I should see 'Number of claims: 1' + And I should see 'Displaying 1 claim' And the page should be accessible skipping 'aria-allowed-attr' When I select case worker "Kanesha Torphy" diff --git a/vcr/cassettes/features/case_workers/admin/allocation.yml b/vcr/cassettes/features/case_workers/admin/allocation.yml index d32a04d544..4efadab214 100644 --- a/vcr/cassettes/features/case_workers/admin/allocation.yml +++ b/vcr/cassettes/features/case_workers/admin/allocation.yml @@ -44,7 +44,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:38:03 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=2c6a4c3a-e1bc-44a5-82b5-bfcf2fe782e3&direction=asc&filter=all&limit=25&page=0&scheme=agfs&search&sorting=last_submitted_at&status=unallocated&value_band_id=0 + uri: http://localhost:3001/api/case_workers/claims?api_key=2c6a4c3a-e1bc-44a5-82b5-bfcf2fe782e3&direction=asc&filter=all&limit=25&page=1&scheme=agfs&search&sorting=last_submitted_at&status=unallocated&value_band_id=0 body: encoding: US-ASCII string: '' @@ -136,7 +136,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:38:03 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=2c6a4c3a-e1bc-44a5-82b5-bfcf2fe782e3&direction=asc&filter=all&limit=25&page=0&scheme=agfs&search&sorting=last_submitted_at&status=unallocated&value_band_id=0 + uri: http://localhost:3001/api/case_workers/claims?api_key=2c6a4c3a-e1bc-44a5-82b5-bfcf2fe782e3&direction=asc&filter=all&limit=25&page=1&scheme=agfs&search&sorting=last_submitted_at&status=unallocated&value_band_id=0 body: encoding: US-ASCII string: '' @@ -186,7 +186,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:38:03 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=2fa6b8ba-72bd-4482-9230-ce9077bb0a48&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=2fa6b8ba-72bd-4482-9230-ce9077bb0a48&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' diff --git a/vcr/cassettes/features/case_workers/admin/reallocation.yml b/vcr/cassettes/features/case_workers/admin/reallocation.yml index 8cc2fe8d2d..10b53f9758 100644 --- a/vcr/cassettes/features/case_workers/admin/reallocation.yml +++ b/vcr/cassettes/features/case_workers/admin/reallocation.yml @@ -44,7 +44,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:39:49 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=0b8bc28b-460a-4e96-a023-100d0bd010ee&direction=asc&filter=all&limit=25&page=0&scheme=agfs&search&sorting=last_submitted_at&status=unallocated&value_band_id=0 + uri: http://localhost:3001/api/case_workers/claims?api_key=0b8bc28b-460a-4e96-a023-100d0bd010ee&direction=asc&filter=all&limit=25&page=1&scheme=agfs&search&sorting=last_submitted_at&status=unallocated&value_band_id=0 body: encoding: US-ASCII string: '' @@ -128,7 +128,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:39:50 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=0b8bc28b-460a-4e96-a023-100d0bd010ee&direction=asc&filter=all&limit=25&page=0&scheme=agfs&search&sorting=last_submitted_at&status=allocated&value_band_id=0 + uri: http://localhost:3001/api/case_workers/claims?api_key=0b8bc28b-460a-4e96-a023-100d0bd010ee&direction=asc&filter=all&limit=25&page=1&scheme=agfs&search&sorting=last_submitted_at&status=allocated&value_band_id=0 body: encoding: US-ASCII string: '' @@ -213,7 +213,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:39:50 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=0b8bc28b-460a-4e96-a023-100d0bd010ee&direction=asc&filter=all&limit=25&page=0&scheme=agfs&search=does%20not%20exist&sorting=last_submitted_at&status=allocated&value_band_id=0 + uri: http://localhost:3001/api/case_workers/claims?api_key=0b8bc28b-460a-4e96-a023-100d0bd010ee&direction=asc&filter=all&limit=25&page=1&scheme=agfs&search=does%20not%20exist&sorting=last_submitted_at&status=allocated&value_band_id=0 body: encoding: US-ASCII string: '' diff --git a/vcr/cassettes/features/case_workers/claims/authorise.yml b/vcr/cassettes/features/case_workers/claims/authorise.yml index 3c9bcb7c48..05183e8850 100644 --- a/vcr/cassettes/features/case_workers/claims/authorise.yml +++ b/vcr/cassettes/features/case_workers/claims/authorise.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=790d0ef2-70b5-4d4f-ae21-585d870d282e&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=790d0ef2-70b5-4d4f-ae21-585d870d282e&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -45,7 +45,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:38:56 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=790d0ef2-70b5-4d4f-ae21-585d870d282e&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=790d0ef2-70b5-4d4f-ae21-585d870d282e&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' diff --git a/vcr/cassettes/features/case_workers/claims/injection_error.yml b/vcr/cassettes/features/case_workers/claims/injection_error.yml index 1d0550c990..a1c618bffe 100644 --- a/vcr/cassettes/features/case_workers/claims/injection_error.yml +++ b/vcr/cassettes/features/case_workers/claims/injection_error.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=e21a6099-56d9-4697-bd62-441a4b04ed8c&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=e21a6099-56d9-4697-bd62-441a4b04ed8c&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -47,7 +47,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:39:30 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=e21a6099-56d9-4697-bd62-441a4b04ed8c&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=e21a6099-56d9-4697-bd62-441a4b04ed8c&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -92,7 +92,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:39:31 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=e21a6099-56d9-4697-bd62-441a4b04ed8c&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=e21a6099-56d9-4697-bd62-441a4b04ed8c&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' diff --git a/vcr/cassettes/features/case_workers/claims/messaging.yml b/vcr/cassettes/features/case_workers/claims/messaging.yml index daf0eda4d3..2ef5ae846d 100644 --- a/vcr/cassettes/features/case_workers/claims/messaging.yml +++ b/vcr/cassettes/features/case_workers/claims/messaging.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=c8af71c3-6468-4869-a331-be0a29d32f76&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=c8af71c3-6468-4869-a331-be0a29d32f76&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -46,7 +46,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 12:43:29 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=c8af71c3-6468-4869-a331-be0a29d32f76&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=c8af71c3-6468-4869-a331-be0a29d32f76&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' diff --git a/vcr/cassettes/features/case_workers/claims/refuse.yml b/vcr/cassettes/features/case_workers/claims/refuse.yml index ec87f9e226..9a8ebcfa3c 100644 --- a/vcr/cassettes/features/case_workers/claims/refuse.yml +++ b/vcr/cassettes/features/case_workers/claims/refuse.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=b873a938-dc39-495f-a46e-a166f54be296&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=b873a938-dc39-495f-a46e-a166f54be296&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -46,7 +46,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:40:07 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=b873a938-dc39-495f-a46e-a166f54be296&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=b873a938-dc39-495f-a46e-a166f54be296&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -84,6 +84,6 @@ http_interactions: - '93' body: encoding: ASCII-8BIT - string: '{"pagination":{"current_page":1,"total_pages":0,"total_count":0,"limit_value":10},"items":[]}' + string: '{"pagination":{"current_page":1,"total_pages":1,"total_count":0,"limit_value":10},"items":[]}' recorded_at: Thu, 25 Apr 2024 11:40:08 GMT recorded_with: VCR 6.2.0 diff --git a/vcr/cassettes/features/case_workers/claims/reject.yml b/vcr/cassettes/features/case_workers/claims/reject.yml index af42aa9f93..e70f6882dc 100644 --- a/vcr/cassettes/features/case_workers/claims/reject.yml +++ b/vcr/cassettes/features/case_workers/claims/reject.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=e00ab308-f9b3-4382-9399-d9702efc1a34&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=e00ab308-f9b3-4382-9399-d9702efc1a34&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' @@ -46,7 +46,7 @@ http_interactions: recorded_at: Thu, 25 Apr 2024 11:40:14 GMT - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=e00ab308-f9b3-4382-9399-d9702efc1a34&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=e00ab308-f9b3-4382-9399-d9702efc1a34&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: '' diff --git a/vcr/cassettes/features/provider_management.yml b/vcr/cassettes/features/provider_management.yml index 4b5d60d14a..b63c97fdfd 100644 --- a/vcr/cassettes/features/provider_management.yml +++ b/vcr/cassettes/features/provider_management.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: http://localhost:3001/api/case_workers/claims?api_key=3db163fd-8bc6-4929-8c9d-975f8f189419&direction=asc&limit=10&page=0&search&sorting=last_submitted_at&status=current + uri: http://localhost:3001/api/case_workers/claims?api_key=3db163fd-8bc6-4929-8c9d-975f8f189419&direction=asc&limit=10&page=1&search&sorting=last_submitted_at&status=current body: encoding: US-ASCII string: ''