From 50e555a30f691cb895665fb24dddbd439e1329f5 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Sun, 21 Oct 2018 13:24:30 -0400 Subject: [PATCH] trim closed suffix from fitness schedule api --- penn/fitness.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/penn/fitness.py b/penn/fitness.py index 2712623..7e92000 100644 --- a/penn/fitness.py +++ b/penn/fitness.py @@ -30,7 +30,7 @@ def get_schedule(self): data = [] for item in raw_data["events"]: out = { - "name": item["title"], + "name": re.sub(r"\s*-?\s*CLOSED$", "", item["title"], re.I), "all_day": item["all_day"] } if not item["all_day"]: @@ -54,7 +54,7 @@ def get_usage(self): data = [x.strip() for x in item.get_text("\n").strip().split("\n")] data = [x for x in data if x] output.append({ - "name": re.sub(r"\s*-\s*CLOSED$", "", data[0], re.I), + "name": re.sub(r"\s*-?\s*CLOSED$", "", data[0], re.I), "open": "Open" in data[1], "count": int(data[2].rsplit(" ", 1)[-1]), "updated": eastern.localize(datetime.datetime.strptime(data[3][8:].strip(), '%m/%d/%Y %I:%M %p')).isoformat(),