diff --git a/backend/src/dashboard/main.py b/backend/src/dashboard/main.py index b0dac4f..a4336ee 100644 --- a/backend/src/dashboard/main.py +++ b/backend/src/dashboard/main.py @@ -319,6 +319,5 @@ def open_modal(jobs_cell, revenue_cell, close_click, jobs_data, revenue_data, is if __name__ == "__main__": app.run(debug=True) # TODO: - # 1) They just need a way to check numbers via hubspot deals # 2) a few feedback changes from management as they need it # 3) Investigate why this week numbers are wrong ( i think its something to do with attempts) ( might be that the data wasn't saved till now?) diff --git a/backend/src/dashboard/services/json_reader.py b/backend/src/dashboard/services/json_reader.py index 9b0f267..6474fbe 100644 --- a/backend/src/dashboard/services/json_reader.py +++ b/backend/src/dashboard/services/json_reader.py @@ -22,7 +22,10 @@ class jsonReader: return None if timestamp.endswith("Z"): timestamp = timestamp[:-1] - dt = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S") + try: + dt = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S") + except: + dt = datetime.strptime(timestamp, "%Y-%m-%d") return dt.strftime("%Y-%m-%d") def initial_setup(self): @@ -62,9 +65,9 @@ class jsonReader: # Multiple attempts => multiple rows for attempt in deal["attempts"]: rows.append({ - "submission_date": self.to_date_only(deal["deal_properties"].get("submission_date")), + "submission_date": self.to_date_only(attempt["submission_date"]), "hubspot_id": deal["deal_properties"]["deal_id"], - "expected_commencement_date": deal["deal_properties"].get("expected_commencement_date"), + "expected_commencement_date": self.to_date_only(attempt["expected_commencement_date"]), "work_type": product_type, "price": next( (item["price"] for item in deal["line_items"] if product_type in item["name"]),