Report update times per region and current time to calculate diff in client

This commit is contained in:
Emily Doherty 2023-09-24 00:46:18 -07:00
parent b2a49dd712
commit 8d75348bb2

View File

@ -50,12 +50,17 @@ def token_data(version: str) -> dict:
items = table.scan()['Items'] items = table.scan()['Items']
data = { data = {
'current_time': datetime.datetime.utcfromtimestamp(int(items[0]['current_time'])).replace( 'current_time': datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat(timespec="seconds"),
tzinfo=datetime.timezone.utc).isoformat(), 'price_data': {},
'price_data': {} 'update_times': {},
} }
for item in items: for item in items:
data['price_data'][item['region']] = int(int(item['price']) / 10000) data['price_data'][item['region']] = int(int(item['price']) / 10000)
data['update_times'][item['region']] = (
datetime.datetime
.utcfromtimestamp(int(item['current_time']))
.replace(tzinfo=datetime.timezone.utc).isoformat()
)
return data return data