Skip to content
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

Pass configuration into functions instead of loading internally #696

Open
teneightfive opened this issue Jul 28, 2020 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@teneightfive
Copy link
Contributor

Problem

Currently we load configuration into modules locally. This makes them hard to test and sometimes hard to follow.

An example can be seen in the discussion on #686.

Possible solution

Pass configuration into each function call separately. This will mean refactoring controllers and presenters a substantial amount but will make things easier to follow and test.

Example:

router.get('/', controller(config))
function controller(config) {
  return (req, res) => {
    const output = items.map(presenter(config))
    ...
  }
}
function presenter(config) {
  return (item) => {
    ...
  }
}
@teneightfive teneightfive added the enhancement New feature or request label Jul 28, 2020
teneightfive added a commit that referenced this issue Jul 28, 2020
This change extracts the handling of rendering assessment answers
within another component, for example, a list of panels with a tag
into another presenter.

This will allow it to be shared by other parts of the app and give the
ability to present the assessment answers in separate ways more easily.

This change does still contain a style of loading settings internally
that we would like to get rid of (see #696) as the refactor would
be a much bigger and more time consuming change at this stage.
teneightfive added a commit that referenced this issue Jul 29, 2020
This change extracts the handling of rendering assessment answers
within another component, for example, a list of panels with a tag
into another presenter.

This will allow it to be shared by other parts of the app and give the
ability to present the assessment answers in separate ways more easily.

This change does still contain a style of loading settings internally
that we would like to get rid of (see #696) as the refactor would
be a much bigger and more time consuming change at this stage.
teneightfive added a commit that referenced this issue Jul 29, 2020
This change extracts the handling of rendering assessment answers
within another component, for example, a list of panels with a tag
into another presenter.

This will allow it to be shared by other parts of the app and give the
ability to present the assessment answers in separate ways more easily.

This change does still contain a style of loading settings internally
that we would like to get rid of (see #696) as the refactor would
be a much bigger and more time consuming change at this stage.
teneightfive added a commit that referenced this issue Jul 29, 2020
This change extracts the handling of rendering assessment answers
within another component, for example, a list of panels with a tag
into another presenter.

This will allow it to be shared by other parts of the app and give the
ability to present the assessment answers in separate ways more easily.

This change does still contain a style of loading settings internally
that we would like to get rid of (see #696) as the refactor would
be a much bigger and more time consuming change at this stage.
teneightfive added a commit that referenced this issue Jul 29, 2020
This change extracts the handling of rendering assessment answers
within another component, for example, a list of panels with a tag
into another presenter.

This will allow it to be shared by other parts of the app and give the
ability to present the assessment answers in separate ways more easily.

This change does still contain a style of loading settings internally
that we would like to get rid of (see #696) as the refactor would
be a much bigger and more time consuming change at this stage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant