Skip to content

PT-453 | Add cultural route support to enrolment form#495

Merged
karisal-anders merged 2 commits into
mainfrom
PT-453-add-culture-route-support
Jun 4, 2026
Merged

PT-453 | Add cultural route support to enrolment form#495
karisal-anders merged 2 commits into
mainfrom
PT-453-add-culture-route-support

Conversation

@karisal-anders

@karisal-anders karisal-anders commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description ✨

Needs backend support from City-of-Helsinki/palvelutarjotin#509

NOTE:

  • SonarCloud's coverage analysis should be ok, IsPartOfCulturalRouteField has tests for it, and the playwright page changes should not be counted against coverage. So, the coverage should be >65% even though it says not so.

Add cultural route support to enrolment form

Also:

Related 🤝

Testing ⚗️

Automated tests ⚙️️

Manual testing 👷‍♂️

Screenshots 📸

See the screenshots from City-of-Helsinki/palvelutarjotin#509 as this PR was used with the backend support in that PR.

Additional notes 🗒️

Fix "yarn typecheck":
```
$ yarn typecheck
yarn run v1.22.22
$ tsc --project ./tsconfig.json --noEmit
src/domain/headless-cms/components/__tests__/CmsPage.test.tsx:113:11 -
error TS2322: Type '"primary"' is not assignable to type
'ButtonVariant.Primary | ButtonVariant.Secondary | ButtonVariant.Success
| ButtonVariant.Danger | ButtonVariant.Clear | undefined'.

113           loadMoreButtonVariant: 'primary',
              ~~~~~~~~~~~~~~~~~~~~~

src/domain/headless-cms/components/__tests__/CmsPage.test.tsx:114:11 -
error TS2322: Type '"coat"' is not assignable to type 'ButtonPresetTheme
| ButtonTheme | undefined'.

114           loadMoreButtonTheme: 'coat',
              ~~~~~~~~~~~~~~~~~~~

src/playwright/tests/search.spec.ts:55:41 - error TS2345: Argument of
type '"Detaljerad sökning"' is not assignable to parameter of type
'SearchButton'.

55     await frontPageSv.clickSearchButton('Detaljerad sökning');
                                           ~~~~~~~~~~~~~~~~~~~~

src/playwright/tests/search.spec.ts:71:41 - error TS2345: Argument of
type '"Advanced search"' is not assignable to parameter of type
'SearchButton'.

71     await frontPageEn.clickSearchButton('Advanced search');
                                           ~~~~~~~~~~~~~~~~~
```

Refs: PT-453
@karisal-anders karisal-anders changed the title PT-453 | Add "Is part of cultural route?" support to enrolment form PT-453 | Add cultural route support to enrolment form Jun 2, 2026
@azure-pipelines

Copy link
Copy Markdown

KULTUS-UI branch is deployed to platta: https://kultus-ui-pr495.dev.hel.ninja 🚀🚀🚀

@karisal-anders karisal-anders marked this pull request as ready for review June 3, 2026 13:49
@karisal-anders karisal-anders requested a review from a team as a code owner June 3, 2026 13:49
Comment thread src/domain/enrolment/enrolmentForm/constants.ts Outdated
also:
- with the request of the product owner don't restore any previous
  answer to "Is part of cultural route" question from local storage
  persisted Formik form's data, but instead always reset the question
  to its initial value i.e. no data given at all
- update generated GraphQL types using backend running
  City-of-Helsinki/palvelutarjotin#509 i.e. the backend support for the
  `is_part_of_cultural_route` field in enrolments and queue enrolments
- add tests
- update playwright tests

Refs: PT-453
@karisal-anders karisal-anders force-pushed the PT-453-add-culture-route-support branch from f08c5ab to f37539f Compare June 3, 2026 14:09
@sonarqubecloud

sonarqubecloud Bot commented Jun 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
64.7% Coverage on New Code (required ≥ 65%)

See analysis details on SonarQube Cloud

@azure-pipelines

Copy link
Copy Markdown

KULTUS-UI branch is deployed to platta: https://kultus-ui-pr495.dev.hel.ninja 🚀🚀🚀

@mikkojamG mikkojamG left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@nikomakela nikomakela left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new isPartOfCulturalRoute field in EnrolmentForm is now a bit hard to understand, which makes it also hard to maintain. Because of good unit tests, I think it's. still approvable.

Comment on lines +211 to +213
<FormGroup>
<IsPartOfCulturalRouteField formikFieldName="isPartOfCulturalRoute" />
</FormGroup>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think it changes the result or analysis any how, but now I could understand this is "No / I don't know what cultural route is / I don't want to give an answer".

I would have personally used just a checkbox. If I know what a cultural route is, I would check it. I'm enrolling and I need to check that all the information that I have given with form is valid. If we would really trust in users and in the given input, this would be easy boolean analysis and way easier to implement and even cleaner UI and UX. Now we are doing much work only to guide the report analysis, because the input would still be the same -- This implementation still does not answer to report analysis question whether or not the user has seen this question.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I talked with the product owner about their needs and they wanted this so that people always choose a value, that they need to make a choice. So, making the user always choose a value for this is intentional and as per product owner's wishes.

"hasEmailNotification": true,
"hasSmsNotification": true,
"isMandatoryAdditionalInformationRequired": false,
"isPartOfCulturalRoute": "YES",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

so can it now be "", " ", true, false, "YES" and "NO_OR_UNKNOWN"? But it's still converted to true / false when sent to graphql endpoint?

Then in backend, at least in reports interface, it's again converted back to string from boolean as in City-of-Helsinki/palvelutarjotin#509?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the enrolment form the values are "" (empty string) or either of the IsPartOfCulturalRoute enum's values i.e. IsPartOfCulturalRoute.NO_OR_UNKNOWN (i.e. "NO_OR_UNKNOWN" as a string value) or IsPartOfCulturalRoute.YES (i.e. "YES" as a string value).

The tests for validIsPartOfCulturalRouteToBoolean test that the enum values above pass and are converted to boolean values, and others like e.g. any of ['', ' ', 'yes', 'NO', 'unanswered', null, undefined, true, 0, 1] raise an exception.

In the backend the value has slightly different meaning than in the frontend here, as in the backend there's also the possibility of "Unanswered" for old enrolments and queue enrolments made before this functionality has been deployed to production. On user input "Unanswered" is not allowed, but in the backend when converting EnrolmentBase.is_part_of_cultural_route boolean values the False value has "Unanswered", "No" and "I don't know" all in it, and conveying the reality of the information is IMHO good to have in reports so people interpreting the reports don't make false assumptions based on incorrectly presented data (If the "Unanswered" and "No / I don't know" cases saved as False would need to be separated it could still be done and that information conveyed by splitting the False values according to EnrolmentBase.enrolment_time to before deployment of this functionality and after).

@karisal-anders karisal-anders merged commit 99f33d4 into main Jun 4, 2026
27 of 28 checks passed
@karisal-anders karisal-anders deleted the PT-453-add-culture-route-support branch June 4, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants