diff --git a/functions/sasha/index.py b/functions/sasha/index.py index a89b612..8e96d5f 100644 --- a/functions/sasha/index.py +++ b/functions/sasha/index.py @@ -105,9 +105,10 @@ def scrape_match(match_url_path): with_timezone = " ".join([start_time, "EST"]) tzinfo = {"EST": tz.gettz("America/New_York"), "CST": tz.gettz("America/Chicago")} - start_time_est = parse(with_timezone, tzinfos=tzinfo) - start_time_utc = start_time_est.astimezone(tz.gettz("Etc/GMT")) - start_time_utc = datetime.strftime(start_time_utc, "%Y-%m-%dT%H:%M:%S%z") + dt_start_time_est = parse(with_timezone, tzinfos=tzinfo) + dt_start_time_utc = dt_start_time_est.astimezone(tz.gettz("Etc/GMT")) + start_time_utc = datetime.strftime(dt_start_time_utc, "%Y-%m-%dT%H:%M:%S%z") + start_date_utc = datetime.strftime(dt_start_time_utc, "%Y-%m-%d") teams = html.css(".wf-title-med") teams = [t.text().replace("\t", "").replace("\n", "") for t in teams] @@ -128,6 +129,7 @@ def scrape_match(match_url_path): data = { "match_id": match_id, + "start_date": start_date_utc, "event_name": event_info["event_name"], "event_country_flag": event_info["country_flag"], "start_time": start_time_utc, @@ -159,6 +161,7 @@ def scrape_matches(page: str = 1): item = { "id": match_detail["match_id"], + "startDate": match_detail["start_date"], "eventName": match_detail["event_name"], "eventCountryFlag": match_detail["event_country_flag"], "startTime": match_detail["start_time"], diff --git a/template.yaml b/template.yaml index df3c00c..4316310 100644 --- a/template.yaml +++ b/template.yaml @@ -119,11 +119,15 @@ Resources: AttributeDefinitions: - AttributeName: id AttributeType: N + - AttributeName: startDate + AttributeType: S BillingMode: PROVISIONED DeletionProtectionEnabled: True KeySchema: - AttributeName: id KeyType: HASH + - AttributeName: startDate + KeyType: RANGE ProvisionedThroughput: ReadCapacityUnits: 1 WriteCapacityUnits: 1