diff --git a/camply/notifications/email_notifications.py b/camply/notifications/email_notifications.py index 44270291..6a89b91f 100755 --- a/camply/notifications/email_notifications.py +++ b/camply/notifications/email_notifications.py @@ -120,4 +120,14 @@ def send_campsites(self, campsites: List[AvailableCampsite], **kwargs) -> None: master_email_body_list.append(composed_message) master_email_body = "\n".join(master_email_body_list) if len(campsites) > 0: - self.send_message(message=master_email_body) + # Create dynamic subject with campground name and date + first_campsite = campsites[0] + campground_name = first_campsite.facility_name + booking_date = first_campsite.booking_date.strftime("%Y-%m-%d") + + if len(campsites) == 1: + subject = f"Campsite Available: {campground_name} - {booking_date}" + else: + subject = f"{len(campsites)} Campsites Available: {campground_name} - {booking_date}" + + self.send_message(message=master_email_body, subject=subject) diff --git a/camply/search/base_search.py b/camply/search/base_search.py index 6b556c62..21be96f2 100644 --- a/camply/search/base_search.py +++ b/camply/search/base_search.py @@ -426,7 +426,12 @@ def _handle_notifications( "Go Get your campsite! 🏕" ) logger.warning(error_message) - notifier.send_message(message=error_message) + # Create subject with campground name and date + first_campsite = logged_campsites[0] + campground_name = first_campsite.facility_name + booking_date = first_campsite.booking_date.strftime("%Y-%m-%d") + subject = f"Lots of Availability ({len(logged_campsites)} sites): {campground_name} - {booking_date}" + notifier.send_message(message=error_message, subject=subject) logged_campsites = logged_campsites[:minimum_first_notify] notifier.send_campsites(campsites=logged_campsites)