Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

More visibility/flexibility of the number of results returned from search #203

Merged
merged 2 commits into from
Aug 7, 2017

Conversation

beseven
Copy link
Contributor

@beseven beseven commented Aug 2, 2017

Description

Return a set number of results, pass on display results and total results as meta tags
Enable the number of results to be set as an ENV var

Related Issue

https://trello.com/c/VHkRE78n/452-send-flexible-no-of-results-and-shown-results-as-metadata-wt

Motivation and Context

More flexibility in how many results we are displaying, returning the number of total results for reporting purposes

Checklist

  • Updated & new tests
  • Upgraded packages

@beseven beseven requested a review from neilbmclaughlin August 2, 2017 18:59
@c2s-dev
Copy link

c2s-dev commented Aug 2, 2017

🚀 deployment of nhsuk/gp-finder succeeded (http://gp-finder-pr-203.dev.beta.nhschoices.net)

@beseven beseven force-pushed the feature/add-result-numbers-to-metadata branch from bd91de0 to 4f3d409 Compare August 3, 2017 06:27
@c2s-dev
Copy link

c2s-dev commented Aug 3, 2017

🚀 deployment of nhsuk/gp-finder succeeded (http://gp-finder-pr-203.dev.beta.nhschoices.net)

@beseven beseven force-pushed the feature/add-result-numbers-to-metadata branch from 4f3d409 to d99ead7 Compare August 3, 2017 12:13
@c2s-dev
Copy link

c2s-dev commented Aug 3, 2017

🚀 deployment of nhsuk/gp-finder succeeded (http://gp-finder-pr-203.dev.beta.nhschoices.net)

@@ -3,6 +3,8 @@ const backLinkUtils = require('../lib/utils/backLink');
function fromRequest(req, res, next) {
res.locals.search = req.query.search;
res.locals.postcodeSearch = req.query.postcode;
res.locals.resultsReturnedCount = 30;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? rename to resultsLimit.

Also, given that this isn't fromRequest is would be better to have it in config/config.js and app/middleware/locals.js as for the analytics Id's?

If pulled from an env var it will need a default (e.g. resultsLimit: process.env.RESULTS_LIMIT || 30).

Same probably applies to the other hard coded values but they can have an issue raised.

package.json Outdated
@@ -50,6 +50,7 @@
"nunjucks": "^3.0.1",
"postcodesio-client": "billinghamj/postcodesio-client-node",
"require-environment-variables": "^1.1.2",
"tunnel-agent": "^0.6.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this package used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a dependency of node-sass that snyk was complaining about. I guess it should be fixed another way. Will take a look.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If node-sass needs it then OK. Just couldn't find a require for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading sub-dependencies is not a thing in yarn yet (yarnpkg/yarn#2394) so this is a valid workaround of manually upgrading the sub-dependency of node-sass to be able to pass snyk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, decided to update the policy for the moment. Snyk uses npm update instead, so the manual yarn upgrade doesn't quite do the trick.

@@ -25,7 +25,7 @@ function assertSearchResponse(search, postcode, done, assertions) {
describe('Results page', () => {
const noOnlineBookingLinkMessage = 'This surgery doesn't have an online booking system.';

describe('page layout', () => {
describe('layout', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an integration test for the presence of a greater than 0 resultLimit and resultsCount.

@beseven beseven force-pushed the feature/add-result-numbers-to-metadata branch from d99ead7 to 4aa8bf4 Compare August 3, 2017 15:48
@c2s-dev
Copy link

c2s-dev commented Aug 3, 2017

🚀 deployment of nhsuk/gp-finder succeeded (http://gp-finder-pr-203.dev.beta.nhschoices.net)

@neilbmclaughlin
Copy link
Contributor

This is stalled pending outcome of #208

@neilbmclaughlin
Copy link
Contributor

Now #208 is resolved then the snyk/yarn.lock changes should no longer be required.

@beseven beseven force-pushed the feature/add-result-numbers-to-metadata branch from 4aa8bf4 to a646b66 Compare August 7, 2017 07:42
@c2s-dev
Copy link

c2s-dev commented Aug 7, 2017

🚀 deployment of nhsuk/gp-finder succeeded (http://gp-finder-pr-203.dev.beta.nhschoices.net)

@beseven beseven force-pushed the feature/add-result-numbers-to-metadata branch from a646b66 to fb6a182 Compare August 7, 2017 07:56
@c2s-dev
Copy link

c2s-dev commented Aug 7, 2017

🚀 deployment of nhsuk/gp-finder succeeded (http://gp-finder-pr-203.dev.beta.nhschoices.net)

@neilbmclaughlin neilbmclaughlin merged commit c4c390c into master Aug 7, 2017
@neilbmclaughlin neilbmclaughlin deleted the feature/add-result-numbers-to-metadata branch August 7, 2017 10:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants