From 5c12f9775e3d409b40efebc1a8ba0283951f89ef Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Wed, 22 May 2024 13:22:20 -1000 Subject: [PATCH] Unit metadata update time * When sending metadata, also update the unit doc to show last_updated date. --- src/panoptes/pocs/utils/cli/network.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/panoptes/pocs/utils/cli/network.py b/src/panoptes/pocs/utils/cli/network.py index c80d29eb2..2c3889073 100644 --- a/src/panoptes/pocs/utils/cli/network.py +++ b/src/panoptes/pocs/utils/cli/network.py @@ -121,7 +121,12 @@ def handleEvent(event): print(f'Adding data for {record_type=}: {data}') # Update the unit's metadata with the record_type. - unit_ref.set({'metadata': {record_type: data}}, merge=True) + unit_ref.set({ + 'metadata': { + record_type: data + }, + 'last_updated': firestore.SERVER_TIMESTAMP, + }, merge=True) # Add the record, storing the record_type name in the data. data['record_type'] = record_type