FV-149 Anpassung Filtermenü Zeitauswahl#558
Hidden character warning
Conversation
WalkthroughAdds detection for partial pedestrian-only countings (single FUSS category and non-24h duration). Applies BLOCK time selection and the ZB_06_19 time block by default in those cases, disables the Tageswert radio when applicable, and watches option changes to adapt time selection automatically. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (2)
✏️ Tip: You can disable this entire section by setting 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/src/components/zaehlstelle/optionsmenue/OptionsmenueZaehlstelle.vue (1)
182-207:⚠️ Potential issue | 🟠 MajorAdd missing
case Fahrzeug.FUSSto setfussverkehroptionThe switch statement doesn't handle
Fahrzeug.FUSS, sooptionsCopy.fussverkehrremains at its default value offalseon initial load. This preventsisOnlyFussgaengerSelectedinZeitauswahlPanel.vuefrom ever beingtrueinitially, even for pedestrian-only countings.While line 147 forces
BLOCKselection for non-24-hour pedestrian countings viaisTeilzaehlungFussverkehr, the pedestrian traffic option itself won't be pre-selected in the UI, which is inconsistent with the intended behavior for pedestrian-only counts.Add a case after
Fahrzeug.RAD:case Fahrzeug.FUSS: optionsCopy.fussverkehr = true; break;
🤖 Fix all issues with AI agents
In
`@frontend/src/components/zaehlstelle/optionsmenue/OptionsmenueZaehlstelle.vue`:
- Around line 134-138: The computed isTeilzaehlungFussverkehr currently uses
loose inequality (activeZaehlung.value.zaehldauer !=
Zaehldauer.DAUER_24_STUNDEN); update this to use strict inequality (!==) to
ensure type-safe comparison. Locate the computed property
isTeilzaehlungFussverkehr and replace the != operator with !== when comparing
activeZaehlung.value.zaehldauer to Zaehldauer.DAUER_24_STUNDEN so the check is
strict and consistent with other components like ZeitauswahlPanel.vue.
In
`@frontend/src/components/zaehlstelle/optionsmenue/panels/ZeitauswahlPanel.vue`:
- Around line 346-362: The deep watcher on chosenOptionsCopy causes redundant
re-runs because adaptOptionsUpdate mutates that same object; replace the broad
deep watch with targeted watchers (watch chosenOptionsCopy.value.zeitauswahl and
isOnlyFussgaengerSelected, or a single watch on a computed that derives those
specific keys) so adaptOptionsUpdate only runs when relevant fields change, and
inside adaptOptionsUpdate verify the candidate Zeitblock before assigning by
checking that Zeitblock.ZB_06_19 exists in zeitblockValues (or fall back to the
first available zeitblock in zeitblockValues) instead of hardcoding it; update
references to chosenOptionsCopy, adaptOptionsUpdate, zeitauswahl, zeitblock,
Zeitblock.ZB_06_19, zeitblockValues and isOnlyFussgaengerSelected accordingly.
🧹 Nitpick comments (1)
frontend/src/components/zaehlstelle/optionsmenue/panels/ZeitauswahlPanel.vue (1)
330-334: Duplicate computed:isTeilzaehlungFussverkehris defined identically inOptionsmenueZaehlstelle.vue.Consider extracting this into a shared composable or utility to avoid maintaining the same logic in two places.
Also, Line 333 uses
!=(loose equality) while the rest of the codebase consistently uses!==(strict equality). Use!==for consistency.Proposed fix for strict equality
const isTeilzaehlungFussverkehr = computed(() => { return (activeZaehlung.value.kategorien.length === 1 && activeZaehlung.value.kategorien[0] === Fahrzeug.FUSS && - activeZaehlung.value.zaehldauer != Zaehldauer.DAUER_24_STUNDEN); + activeZaehlung.value.zaehldauer !== Zaehldauer.DAUER_24_STUNDEN); });
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/src/components/zaehlstelle/optionsmenue/OptionsmenueZaehlstelle.vuefrontend/src/components/zaehlstelle/optionsmenue/panels/ZeitauswahlPanel.vue
🔇 Additional comments (2)
frontend/src/components/zaehlstelle/optionsmenue/panels/ZeitauswahlPanel.vue (1)
336-344: Consider adding Fahrzeugkategorie checks toisOnlyFussgaengerSelected.This computed property checks traffic type booleans (
kraftfahrzeugverkehr,schwerverkehr, etc.) but doesn't check Fahrzeugkategorie-related options (personenkraftwagen,lastkraftwagen,lastzuege,busse,kraftraeder,pkwEinheiten). If any Fahrzeugkategorie is selected alongside Fussverkehr, the computed will incorrectly evaluate totrue, causing "Tageswert" to be disabled and forced to BLOCK when a mixed selection actually exists. The utility functionhasSelectedFahrzeugkategorie()is already available in ZaehlstelleUtils and should be incorporated into this logic.frontend/src/components/zaehlstelle/optionsmenue/OptionsmenueZaehlstelle.vue (1)
147-150: ValidateZeitblock.ZB_06_19exists in available blocks before assigning it.The code hardcodes
Zeitblock.ZB_06_19for 13-hour countings and Fußverkehr-only partial countings without checking if it exists inactiveZaehlung.value.zeitauswahl.blocks. If the backend returns a blocks array without this block, the user ends up with a zeitblock value that doesn't match any option in the dropdown. Add a check to ensure the block is available, or fall back to the first available block (as done in the SONSTIGE case at line 178).
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
frontend/src/components/zaehlstelle/optionsmenue/OptionsmenueZaehlstelle.vue
Show resolved
Hide resolved
| watch( | ||
| () => chosenOptionsCopy.value, | ||
| () => { | ||
| adaptOptionsUpdate(); | ||
| }, | ||
| { deep: true } | ||
| ); | ||
|
|
||
| /** | ||
| * Passt die Controls anhand ihrer Abhängigkeiten zu anderen Optionen an. | ||
| */ | ||
| function adaptOptionsUpdate(){ | ||
| if (isOnlyFussgaengerSelected.value && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.BLOCK && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.SPITZENSTUNDE_FUSS){ | ||
| chosenOptionsCopy.value.zeitauswahl = Zeitauswahl.BLOCK; | ||
| chosenOptionsCopy.value.zeitblock = Zeitblock.ZB_06_19; | ||
| } | ||
| } |
There was a problem hiding this comment.
Deep watcher on the entire options model may cause unintended re-triggers.
Since adaptOptionsUpdate mutates chosenOptionsCopy (setting zeitauswahl and zeitblock), the deep watcher will fire again on those mutations. The guard condition prevents an infinite loop, but the watcher still executes twice per relevant change.
More importantly, adaptOptionsUpdate hardcodes Zeitblock.ZB_06_19 without verifying it exists in zeitblockValues. If the active counting doesn't include that block, this could set an invalid value.
Suggested: guard against unavailable zeitblock
function adaptOptionsUpdate(){
if (isOnlyFussgaengerSelected.value && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.BLOCK && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.SPITZENSTUNDE_FUSS){
chosenOptionsCopy.value.zeitauswahl = Zeitauswahl.BLOCK;
- chosenOptionsCopy.value.zeitblock = Zeitblock.ZB_06_19;
+ const defaultBlock = zeitblockValues.value.length > 0
+ ? zeitblockValues.value[0].value
+ : Zeitblock.ZB_06_19;
+ chosenOptionsCopy.value.zeitblock = defaultBlock;
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| watch( | |
| () => chosenOptionsCopy.value, | |
| () => { | |
| adaptOptionsUpdate(); | |
| }, | |
| { deep: true } | |
| ); | |
| /** | |
| * Passt die Controls anhand ihrer Abhängigkeiten zu anderen Optionen an. | |
| */ | |
| function adaptOptionsUpdate(){ | |
| if (isOnlyFussgaengerSelected.value && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.BLOCK && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.SPITZENSTUNDE_FUSS){ | |
| chosenOptionsCopy.value.zeitauswahl = Zeitauswahl.BLOCK; | |
| chosenOptionsCopy.value.zeitblock = Zeitblock.ZB_06_19; | |
| } | |
| } | |
| watch( | |
| () => chosenOptionsCopy.value, | |
| () => { | |
| adaptOptionsUpdate(); | |
| }, | |
| { deep: true } | |
| ); | |
| /** | |
| * Passt die Controls anhand ihrer Abhängigkeiten zu anderen Optionen an. | |
| */ | |
| function adaptOptionsUpdate(){ | |
| if (isOnlyFussgaengerSelected.value && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.BLOCK && chosenOptionsCopy.value.zeitauswahl !== Zeitauswahl.SPITZENSTUNDE_FUSS){ | |
| chosenOptionsCopy.value.zeitauswahl = Zeitauswahl.BLOCK; | |
| const defaultBlock = zeitblockValues.value.length > 0 | |
| ? zeitblockValues.value[0].value | |
| : Zeitblock.ZB_06_19; | |
| chosenOptionsCopy.value.zeitblock = defaultBlock; | |
| } | |
| } |
🤖 Prompt for AI Agents
In `@frontend/src/components/zaehlstelle/optionsmenue/panels/ZeitauswahlPanel.vue`
around lines 346 - 362, The deep watcher on chosenOptionsCopy causes redundant
re-runs because adaptOptionsUpdate mutates that same object; replace the broad
deep watch with targeted watchers (watch chosenOptionsCopy.value.zeitauswahl and
isOnlyFussgaengerSelected, or a single watch on a computed that derives those
specific keys) so adaptOptionsUpdate only runs when relevant fields change, and
inside adaptOptionsUpdate verify the candidate Zeitblock before assigning by
checking that Zeitblock.ZB_06_19 exists in zeitblockValues (or fall back to the
first available zeitblock in zeitblockValues) instead of hardcoding it; update
references to chosenOptionsCopy, adaptOptionsUpdate, zeitauswahl, zeitblock,
Zeitblock.ZB_06_19, zeitblockValues and isOnlyFussgaengerSelected accordingly.
Description
Anpassung Filtermenü Zeitauswahl
Issue References
FV-149
Definition of Done
Summary by CodeRabbit
New Features
Bug Fixes