Fix null gender crash when importing replacement forms#551
Merged
JohnMwashuma merged 4 commits intomainfrom Feb 6, 2026
Merged
Fix null gender crash when importing replacement forms#551JohnMwashuma merged 4 commits intomainfrom
JohnMwashuma merged 4 commits intomainfrom
Conversation
Also fix find_missing_center_codes to exclude rows with NULL/empty center_code values, which are expected for replacement forms. Closes #550
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #551 +/- ##
=======================================
Coverage 84.18% 84.19%
=======================================
Files 165 165
Lines 11452 11452
=======================================
+ Hits 9641 9642 +1
+ Misses 1811 1810 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
faith-mutua
previously approved these changes
Feb 6, 2026
faith-mutua
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AttributeError: 'NoneType' object has no attribute 'upper'when importing result forms CSV that contains replacement form rows (emptycenter_code,station_number,gender)find_missing_center_codesSQL query to exclude NULL/empty center codes, which are expected for replacement formsChanges
import_result_forms.py:158- Add null guard before calling.upper()on gender field valueutils.py:301-306- AddIS NOT NULLand!= ''filters tofind_missing_center_codesquery so replacement form rows are not flagged as missing centersTest plan
test_async_import_result_forms_with_replacementsverifying:is_replacement=Truecenter=None,gender=None,station_number=NoneCloses #550