-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature/485768 page conditions #669
Conversation
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.
Looking good. If this gets more complicated, we should look at splitting out our v1/v2 engine logic into separate encapsulated functions and using something like the strategy pattern to switch between the logic for engine v1/v2 depending on the form definition's engine version.
e.g.
engineStrategies.js
class EngineStrategyV1 {
getNextPath(defaultPath) { }
// anything else we need
}
class EngineStrategyV2 {
getNextPath(defaultPath) { }
// anything else we need
}
QuestionPageController.ts
getNextPath(context: FormContext) {
const { model, next, path } = this
const { evaluationState } = context
const summaryPath = this.getSummaryPath()
const statusPath = this.getStatusPath()
// Walk from summary page (no next links) to status page
let defaultPath = path === summaryPath ? statusPath : undefined
return engineStrategy.getNextPath() // engineStrategy would be passed in ideally as a dependency in the constructor
}
questionPageController = new QuestionPageController(engineStrategy) // engineStrategy is either EngineStrategyV1 or EngineStrategyV2 based on model.engine
Quality Gate passedIssues Measures |
@@ -24,7 +24,7 @@ | |||
{% include "partials/heading.html" %} | |||
|
|||
{% block form %} | |||
{% if page.next | length %} | |||
{% if page.allowContinue %} |
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.
Nice 👌
No description provided.