Fix gender in passenger format#490
Fix gender in passenger format#490kim00425 wants to merge 15 commits intoTravelport-Ukraine:masterfrom
Conversation
Updates from origin
Codecov Report
@@ Coverage Diff @@
## master #490 +/- ##
==========================================
+ Coverage 94.06% 94.09% +0.02%
==========================================
Files 120 120
Lines 2056 2066 +10
==========================================
+ Hits 1934 1944 +10
Misses 122 122
Continue to review full report at Codecov.
|
|
dchertousov
left a comment
There was a problem hiding this comment.
Thanks for your PR!
In case of non-INF Gender could be missing (as still could be parsed from name), but for the INF passengers you propose to always include gender based on First name.
IMO, we should to stick for the similar behaviour in all cases.
Also we try not to mutate function params, so I would like to see the code slightly modified:
- if gender field exists, always take the gender from it
- if gender field is absent, take the gender from the name
- if name does not include strings like MR, RS, MSTR MISS etc, set gender to null
- use separate variable when detecting gender, using rules above instead of modifying function params
Please also make sure, you have included all possible variants of MR/MRS strings and your reg exp is valid.
Current regex has some flaws:
(/MSTR|MISS$/gi).test('MSTRME/NAME')
this one will return true, while it should not. This would return false correctly:
(/(?:MSTR|MISS)$/gi).test('MSTRME/NAME')
i did PR again check please |
|
Kudos, SonarCloud Quality Gate passed!
|
Extract gender from infant last name