Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Use the same default timestamp for converted data
Browse files Browse the repository at this point in the history
Since the conversion is logically one moment in time then the timestamp
used for records that do not have one should be the same.
  • Loading branch information
mcdonnnj committed Jan 21, 2022
1 parent a084400 commit cf1d5b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/mdyml/convert_cisagov.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def convert() -> None:
table_rows.append(line)
logging.info("Done reading Markdown table with %d rows.", len(table_rows))

# The timestamp to use if there is no timestamp in the row. Since the
# conversion is logically one action it should be the same for all converted
# data.
default_timestamp = datetime.now(timezone.utc).isoformat(timespec="seconds")

# Process all the data into a list of dictionaries
out_dict_list = []
row_count = 0
Expand Down Expand Up @@ -155,9 +160,7 @@ def convert() -> None:
parsed_date.replace(tzinfo=timezone.utc)
out_dict["last_updated"] = parsed_date.isoformat(timespec="seconds")
else:
out_dict["last_updated"] = datetime.now(timezone.utc).isoformat(
timespec="seconds"
)
out_dict["last_updated"] = default_timestamp

out_dict_list.append(out_dict)

Expand Down

0 comments on commit cf1d5b6

Please sign in to comment.