Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify handling of true/false values for User > addresses > primaryAddress #265

Closed
branchedelac opened this issue May 27, 2022 · 9 comments

Comments

@branchedelac
Copy link
Contributor

  1. Understand current behaviour
  2. Tweak current behaviour if necessary
  3. Add an example value to https://github.com/FOLIO-FSE/migration_repo_template/blob/main/mapping_files/user_mapping.json

Current behaviour seems to be that lowercase true/false without quotes is translated to "", uppercase "True"/"False" with quotes as True. Uppercase True/False without quotes is not valid json.

Lowercase "true"/"false" seems to work: it becomes to true/"false", which FOLIO translates to true/false.

@fontanka16
Copy link
Contributor

First, I double-checked what FOLIO expects (bugfest-lotus):
true/"true" is parsed to true in mod-user-import
false/"false" is parsed to false in mod-user-import

Then, I verified what json.loads() and json.dumps() does:
image

Then, I wrote a test to check that maps with True values in them, are mapped correctly:
image

Then, I wrote the same test, but parsing a json string instead of using a Python dictionary, making sure that the json parsing does not interfere:
image

Then, I updated the user map in the example repo template:
image

Then, I ran the example against bugfest, verifying that the mapping propagated:
image

Then, I posted the user to bugfest-Lotus (https://bugfest-lotus.int.aws.folio.org/users/preview/acf72e76-1a31-4301-a681-66bdddadedf3?query=%20kuragin&sort=name)
image

Since the behaviour works as expected, I checked the string representations as well:
image
gives
image

image
gives
image

@fontanka16
Copy link
Contributor

It would be great with some examples and data to try to mimic the behaviour you are experiencing.

@fontanka16
Copy link
Contributor

Updated example in repo template: FOLIO-FSE/migration_repo_template@87c37a6

@fontanka16
Copy link
Contributor

@branchedelac can we close this issue? Or do we need better clarifications?

@fontanka16
Copy link
Contributor

@branchedelac , a reminder. Can we close this one?

@branchedelac
Copy link
Contributor Author

@fontanka16 Have we (you) done something in the code/documentation/mapping file creator to make it clearer?

@fontanka16
Copy link
Contributor

@branchedelac see the above linked commits and updated examples in migration_repo_template.

@branchedelac
Copy link
Contributor Author

branchedelac commented Sep 12, 2022

@fontanka16 I understand were not able to reproduce the following issues:

lowercase true/false without quotes is translated to ""

nor

Uppercase True/False without quotes is not valid json.

The above two were what led me to believe that quoted lowercase was the only option that worked, and thus what we need to have as an example in the the migration repo user mapping file to help our colleagues map correctly.

@bltravis and I ran into this with Wellesley's users, I will see if I can find some example data/mapping file to verify.

@branchedelac
Copy link
Contributor Author

I verified with he data migration repo template, and am seeing the (expected) behaviour that @fontanka16 describes also for lowercase unquoted true/false. If nothing has changed in the code since we ran into this back in May -- except that thing I added to make sure there is always (at least) one primary address -- I am not sure what the issue might have been for Wellesley.

This is what I saw in May:

Lafayette's primary address mapping values: "True", "False" Result -- both migrated as true.
Wellesley's primary address mapping values: true, false Result -- one migrated as true, the other as "".

So I think we can close this. Thank you for writing the tests, Theodor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants