onegov-cloud icon indicating copy to clipboard operation
onegov-cloud copied to clipboard

Bugfix/swi 63 handle empty policy area

Open Tschuppi81 opened this issue 5 months ago • 3 comments

SWI: Ignore empty policy area

TYPE: Bugfix LINK: swi-63

Checklist

  • [x] I have performed a self-review of my code
  • [x] I considered adding a reviewer
  • [x] I have tested my code thoroughly by hand
  • [x] I have added tests for my changes/features

Tschuppi81 avatar Jul 25 '25 13:07 Tschuppi81

Is there a way to influence the converters to handle this case?

Tschuppi81 avatar Jul 25 '25 13:07 Tschuppi81

Codecov Report

:x: Patch coverage is 95.23810% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 86.41%. Comparing base (444995f) to head (ddc3461). :warning: Report is 164 commits behind head on master. :white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/onegov/core/filters.py 81.81% 2 Missing :warning:
Additional details and impacted files
Files with missing lines Coverage Δ
src/onegov/swissvotes/collections/votes.py 98.92% <100.00%> (+<0.01%) :arrow_up:
src/onegov/swissvotes/converters.py 100.00% <100.00%> (ø)
src/onegov/swissvotes/path.py 97.82% <100.00%> (+0.04%) :arrow_up:
src/onegov/core/filters.py 86.95% <81.81%> (-3.96%) :arrow_down:

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 444995f...ddc3461. Read the comment docs.

:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jul 25 '25 13:07 codecov[bot]

Is there a way to influence the converters to handle this case?

Yes, you can write a custom converter for the policy area format, so any values that don't conform to the format get dropped.

Ideally we change the collection to accept list[PolicyArea] instead and write a converter for PolicyArea that verifies the format, split the string over . and make sure each component is numeric and starts with the previous component.

Daverball avatar Jul 29 '25 06:07 Daverball