Skip to content

Commit

Permalink
Adds dashes in between date elements for catalogedDate.
Browse files Browse the repository at this point in the history
  • Loading branch information
shelleydoljack committed Sep 20, 2022
1 parent 517939a commit afc5a38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugins/folio/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def _adjust_records(bibs_transformer: BibsTransformer, tsv_dates: str):
ckey = record["hrid"].removeprefix("a")
matched_row = dates_df.loc[dates_df["CATKEY"] == ckey]
if matched_row["CATALOGED_DATE"].values[0] != "0":
record["catalogedDate"] = matched_row["CATALOGED_DATE"].values[0]
date_cat = matched_row["CATALOGED_DATE"].values[0]
record["catalogedDate"] = date_cat[:4] + '-' + date_cat[4:6] + '-' + date_cat[-2:]
records.append(record)
with open(bibs_transformer.processor.results_file.name, "w+") as fo:
for record in records:
Expand Down
2 changes: 1 addition & 1 deletion plugins/tests/test_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_adjust_records(mock_file_system): # noqa
instance_records = [json.loads(row) for row in fo.readlines()]

assert instance_records[0]["_version"] == 1
assert instance_records[0]["catalogedDate"] == "19950710"
assert instance_records[0]["catalogedDate"] == "1995-07-10"
assert "catalogedDate" not in instance_records[1]


Expand Down

0 comments on commit afc5a38

Please sign in to comment.