Skip to content

Commit

Permalink
handle content-less notes. closes #184
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanka16 committed Mar 31, 2022
1 parent 32f7fec commit ce455fe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions migration_tools/mapping_file_transformation/user_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,16 @@ def map_notes(self, user_map, legacy_user, legacy_id, user_uuid: str):
for note in self.notes_mapper.do_map(
legacy_user, legacy_id, FOLIONamespaces.other
)[0].get("notes", []):
note["links"] = [{"id": user_uuid, "type": "user"}]
logging.log(25, "notes\t%s", json.dumps(note))
self.migration_report.add(Blurbs.MappedNoteTypes, note["typeId"])
if note.get("content", "").strip():
note["links"] = [{"id": user_uuid, "type": "user"}]

logging.log(25, "notes\t%s", json.dumps(note))
self.migration_report.add(Blurbs.MappedNoteTypes, note["typeId"])
else:
self.migration_report.add_general_statistics(
"Notes without content that were discarded. Set some default "
"value if you only intend to set the note title"
)

def do_map(self, legacy_user, user_map, legacy_id):
self.folio_keys = MappingFileMapperBase.get_mapped_folio_properties_from_map(
Expand Down

0 comments on commit ce455fe

Please sign in to comment.