tripDiary: support entering on the road work place when usual places are inlined - #1757
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📜 Recent review details🧰 Additional context used🧠 Learnings (3)📚 Learning: 2026-03-31T18:20:32.322ZApplied to files:
📚 Learning: 2026-06-26T01:23:52.727ZApplied to files:
📚 Learning: 2026-06-15T16:08:25.515ZApplied to files:
🔇 Additional comments (13)
WalkthroughAdds inline previous workplace name and geography fields for on-the-road visited places. The widgets include conditional visibility, map centering, required-field and precision validations, and English/French translations. Group configuration registers them, while save-flow logic copies their values into inserted usual-workplace places. Tests cover widget behavior, group wiring, and insertion scenarios. Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Still needs to be tested in a real survey (od_mtl), but I'm putting up the PR now so coderabbitai can review it in parallel. |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/buttonsVisitedPlace.test.ts`:
- Around line 229-232: Replace the trailing commas after the _previousWorkPlace
assignments in both affected test blocks with semicolons, keeping the following
arrivalTime statements separate.
In
`@packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/widgetsPreviousWorkplaceGeography.test.ts`:
- Line 366: Update the setResponse call in the affected geography test to
replace the correctly underscored previous-workplace geography path fragment,
matching the working paths used by the nearby cases so the activity response is
set.
- Around line 255-264: The test currently retrieves the name widget
configuration instead of the geography widget, so it does not cover the intended
non-inlined geography conditional. Update the `getWidgetConfigs()` lookup in the
test to use the previous-workplace geography widget’s configuration while
preserving the existing interview setup and expected false result.
In
`@packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/widgetsPreviousWorkplaceGeography.ts`:
- Around line 50-51: Remove the stray 'bla' literal from the parameter type of
the previousWorkPlaceConditional implementation, keeping it aligned with the
declared factory type's 'name' | 'geography' union.
- Around line 22-32: Share the visited-place geography validation helper and
default-zoom constant between widgetsPreviousWorkplaceGeography.ts and
widgetsGeography.ts. Extract the duplicated rules and constant into a common
module, then update both widget implementations to import and reuse them so
placement precision changes remain synchronized.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 9b870341-c9d1-47ca-b8ce-be14cd47a4f9
📒 Files selected for processing (9)
locales/en/visitedPlaces.ymllocales/fr/visitedPlaces.ymlpackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/buttonsVisitedPlace.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/groupPersonVisitedPlaces.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/widgetsPreviousWorkplaceGeography.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/buttonsVisitedPlace.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/groupPersonVisitedPlaces.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/widgetsPreviousWorkplaceGeography.tspackages/evolution-common/src/services/questionnaire/types/Data.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (6)
- GitHub Check: build-and-test (24.x)
- GitHub Check: check-format
- GitHub Check: code-lint
- GitHub Check: test-sequential (24.x)
- GitHub Check: generate-and-build-generator (24.x)
- GitHub Check: pr-build-check
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-03-31T18:20:32.322Z
Learnt from: kaligrafy
Repo: chairemobilite/evolution PR: 1462
File: packages/evolution-common/src/services/baseObjects/Completable.ts:1-6
Timestamp: 2026-03-31T18:20:32.322Z
Learning: In this repository (chairemobilite/evolution), do not flag or require a copyright year in file headers. For new files, the header format `Copyright Polytechnique Montreal and contributors` (without a year) is acceptable. Only verify the header presence/consistency, not the presence of the year.
Applied to files:
packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/buttonsVisitedPlace.tspackages/evolution-common/src/services/questionnaire/types/Data.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/groupPersonVisitedPlaces.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/groupPersonVisitedPlaces.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/widgetsPreviousWorkplaceGeography.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/buttonsVisitedPlace.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/widgetsPreviousWorkplaceGeography.test.ts
📚 Learning: 2026-06-15T16:08:25.515Z
Learnt from: tahini
Repo: chairemobilite/evolution PR: 1635
File: packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/widgetsGeography.ts:243-248
Timestamp: 2026-06-15T16:08:25.515Z
Learning: In the visitedPlaces questionnaire section, geography objects are expected to always include a `properties` field. When cloning/updating a visited-places geography (e.g., writing `clonedGeography.properties.lastAction`), using a non-null assertion (`clonedGeography.properties!.lastAction = ...`) is intentional. Reviewers should not treat this as a potential null/undefined bug or suggest changing it to optional chaining/guards; if `properties` is unexpectedly missing, it should fail fast as an upstream survey/data validation error.
Applied to files:
packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/buttonsVisitedPlace.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/groupPersonVisitedPlaces.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/groupPersonVisitedPlaces.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/widgetsPreviousWorkplaceGeography.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/buttonsVisitedPlace.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/widgetsPreviousWorkplaceGeography.test.ts
📚 Learning: 2026-06-26T01:23:52.727Z
Learnt from: tahini
Repo: chairemobilite/evolution PR: 1683
File: packages/evolution-common/src/services/questionnaire/sections/segments/widgetSegmentModePre.ts:61-63
Timestamp: 2026-06-26T01:23:52.727Z
Learning: In chairemobilite/evolution questionnaire code, do not populate questionnaire label `context` with external factory option values (e.g., `WidgetFactoryOptions.context`). Treat label `context` as label-specific domain data only (such as sequence/gender). CATI variants must not be derived from translation/label context; route them via the dedicated CATI mechanism used elsewhere in the codebase.
Applied to files:
packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/buttonsVisitedPlace.tspackages/evolution-common/src/services/questionnaire/types/Data.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/groupPersonVisitedPlaces.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/groupPersonVisitedPlaces.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/widgetsPreviousWorkplaceGeography.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/buttonsVisitedPlace.test.tspackages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/widgetsPreviousWorkplaceGeography.test.ts
🔇 Additional comments (6)
packages/evolution-common/src/services/questionnaire/types/Data.ts (1)
239-244: LGTM!locales/en/visitedPlaces.yml (1)
86-86: LGTM!Also applies to: 98-103
locales/fr/visitedPlaces.yml (1)
84-84: LGTM!Also applies to: 98-104
packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/groupPersonVisitedPlaces.ts (1)
43-47: LGTM! Reverse-order insertion correctly puts the name question before the geography one, right after the on-the-road departure activity.Also applies to: 59-60, 141-144, 154-154
packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/__tests__/groupPersonVisitedPlaces.test.ts (1)
21-21: LGTM!Also applies to: 30-31, 66-66, 403-481
packages/evolution-common/src/services/questionnaire/sections/visitedPlaces/buttonsVisitedPlace.ts (1)
150-168: 📐 Maintainability & Code QualityNo change needed.
VisitedPlaceis not a strictname?: neverdiscriminated union in this payload type, and this package’s config does not enablestrict.> Likely an incorrect or invalid review comment.
First part of chairemobilite#1552 This adds the name and geography widgets and tests for the `_previousWorkPlace`. These widgets appear if the questionnaire configuration supports inlining usual places, and the work on the road previous place activity is 'workUsual', and no usual work place has been defined for this respondent. In all other cases, those 2 widgets are invisible.
Second part of chairemobilite#1552 This adds the previous work place geography widgets to the visitedPlaces group when the `inlineUsualPlacesEntry` is `true`. The widgets are just not added if it is not the case.
fixes chairemobilite#1552 Last step to the inlining of usual places. For work on the road activities starting from the usual work place when the previous place is not already work usual, this adds the name and geography to the place, from the current place's previous work place data. Add test cases with usual work place previous and next activities for workOnTheRoad.
|
Confirmed to work with |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
fixes #1552
Add 2 widgets, only when the
inlineUsualPlacesEntryistrue, to the visited places group:visitedPlacePreviousWorkPlaceNameandvisitedPlacePreviousWorkPlaceGeography. These widgets allow to enter the previous work place geography, when not available, to populate the previous place that will be added upon saving the place.The widgets are not available if the
inlineUsualPlacesEntryisfalse.See individual commits for more details.
Summary by CodeRabbit