-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CBO-1417] hearing day pagination #475
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsugarman
force-pushed
the
CBO-1417-hearing-day-pagination
branch
2 times, most recently
from
February 12, 2021 16:23
793602d
to
12f145d
Compare
jsugarman
commented
Feb 12, 2021
jsugarman
commented
Feb 12, 2021
jsugarman
commented
Feb 12, 2021
jsugarman
force-pushed
the
CBO-1417-hearing-day-pagination
branch
2 times, most recently
from
February 12, 2021 17:17
11ff1f1
to
fcfefdb
Compare
jsugarman
commented
Feb 15, 2021
kmahern
reviewed
Feb 16, 2021
kmahern
reviewed
Feb 16, 2021
naseberry
reviewed
Feb 17, 2021
jsugarman
force-pushed
the
CBO-1417-hearing-day-pagination
branch
from
February 18, 2021 18:40
eb132cc
to
e91d9bf
Compare
kmahern
approved these changes
Feb 22, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
jsugarman
force-pushed
the
CBO-1417-hearing-day-pagination
branch
from
February 22, 2021 15:13
a4fa578
to
1871c0b
Compare
jrmhaig
reviewed
Feb 22, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comments to the HearingPaginator
class but nothing major and I'd not be opposed to merging.
jrmhaig
approved these changes
Feb 23, 2021
jsugarman
force-pushed
the
CBO-1417-hearing-day-pagination
branch
from
February 23, 2021 20:23
f658ebf
to
89fbd3b
Compare
A parsing error is occuring resulting from brakeman not being upto date with ruby 2.7 triple dot `...` argument passing. Specifically ``` Error: app/helpers/hearing_helper.rb:4 :: parse error on value "..." (tDOT3) Could not parse app/helpers/hearing_helper.rb ``` We are only interested in security warnings from brakeman so `:exit_on_error: false` prevents non-zero return codes for parsing errors. In addition, since we are now passing three args/switches to brakeman I have put these in the default brakeman config file location so circle will also pick them up. Haved bumped an existing issue with brakeman for now. presidentbeef/brakeman#1483
Notes: 1. Disable rubocop Rails/HelperInstanceVariable I do not consider this to be relevant in the context of a class tha is used to create an object for use in views. I may raise an issue with rubocop. I note that memoized instance variables in helpers do not violate this cop due to an issue that was accepted for it. 2. Move link names to translations 3. Refactor hearing paginator spec The wording of the tests and there use of indexes rather than attributes was out of date. 4. Nav links may require a ``` <span class=“govuk-visually-hidden”> some description for screen reader</span> ``` see the [pagination example from moj design system](https://moj-design-system.herokuapp.com/components/pagination/examples/prev-next) Need to discuss with the frontend developer
Notes: Get hearing spec passing just stubbing the extra prosecution case query of the controller for now but ideally this mechanism will be reversed if i can find a better solution to passing the pagination data to the hearing controller.
Use @ministryofjustice/frontend/moj css As requested by designer this it to make use of the moj [pagination component](https://moj-design-system.herokuapp.com/components/pagination) which is [defined in the moj-frontend repo](https://github.com/ministryofjustice/moj-frontend/blob/master/package/moj/components/pagination/_pagination.scss) Notes: 1. Import moj assets before core typography The import order is important should we wish to override styles coming from either govuk or moj design systems.
Must match that in the prosecution case hearing summaries list. Notes: 1. Exclude hearing_paginator.rb from Rails/HelperInstanceVariable cop This helper is a class that is instantiated once per controller instantiation. As such it does not make sense to apply the Rails/HelperInstanceVariable cop to it at all. 2. Use @prosecution_case instance var directly Since it is not part of, nor needed for the public api this can more simply be referred to via the instance var itself.
To enable use of the hearing "scope" for pagination purposes.
Ideally we should be hitting the hearing endpoint only, however, since pagination currently requires having knowledge of all hearings via the prosecution case endpoint it is pointless and time-consuming to query both endpoints when the prosecution case endpoint contains all the info we need. As a further optimisation we could pass a "pagination collection" instead and hit the hearing endpoint alone.
Move backend logic out of view. Also, Remove unrequired locals as these were from a previous commit and mechanism which is no longer required.
Not needed by the public interface as set by instantiation which is performed during each controller instantiation.
jsugarman
force-pushed
the
CBO-1417-hearing-day-pagination
branch
from
February 23, 2021 21:00
89fbd3b
to
8baa7c9
Compare
This link depended on older mechanism for querying a hearing. It was also a simple drop in that was not part of designs or user-research The introduction of pagination (and later sorting) has broken this simplistic functionality. To get it working with pagination (and sorting) would have involved tigh coupling and considerable extra processing which a) seems excessive for the benefit b) should be worked as as a separate piece of work if needed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Add next and previous hearing day and hearing pagination
Ticket
CBO-1417 hearing day pagination
Why
Usability testing showed that caseworkers (especially AGFS)
need to view the detail of all hearing days, especially for
trials.
Adding next/previous links made this quicker and easier,
where as previously they could only navigate via the list
of hearings, which was inefficient and frustrating for
longer cases.
How
Unfortunately the usual pagination gems (will_paginate
and kaminari) are not going to work because:
a) we are consuming an API, not Active record models
b) although we are using json_api_client gem, that
follows the jsonapi specification and is supposed
to be compatible with kaminari and will_paginate
the Court data adaptor api itself does not implement the jsonapi pagination specification.
c) The nature of data coming from common platform and then from the adaptor
does not lend itself to "out of the box" pagination solutions and
a custom solution is likely to be more flexible while we progress our
understanding and requirements.
TODO (wip)
pass a PageItem set; use caching of api responses
- have now modified the hearing controller to just query the prosecution case endpoint and retrieve the hearing
from here, rather than both the pc endpoint and hearing endpoint. I have also spiked caching locally which worked
but this needs a separate ticket as infrastructure will be needed