Skip to content

Commit

Permalink
revert change from #111
Browse files Browse the repository at this point in the history
  • Loading branch information
MateoLostanlen committed Oct 25, 2023
1 parent 826ef9f commit 2d633fa
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions app/utils/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,9 @@ def build_alerts_elements(images_url_live_alerts, live_alerts, map_style):
alerts_markers_layer = dl.LayerGroup(children=alerts_markers, id="alerts_markers")

# Building the alerts notification btn
today = pd.Timestamp.now().normalize()
today_alerts_df = all_events[all_events["created_at"].dt.normalize() == today]

# The rest of the code remains the same...
nb_today_alerts = len(today_alerts_df) # Number of unique events from today
nb_alerts = len(all_events) # Number of unique events
alert_button = html.Div(
dbc.Button("Nouvelles alertes | {}".format(nb_today_alerts), className="btn-header-alerts"),
dbc.Button("Nouvelles alertes | {}".format(nb_alerts), className="btn-header-alerts"),
id=f"alert_button_{map_style}",
style={"position": "absolute", "top": "10px", "right": "30px", "z-index": "1000"},
)
Expand Down Expand Up @@ -477,9 +473,6 @@ def build_individual_alert_components(live_alerts, alert_frame_urls, site_device

else:
all_alerts = pd.read_json(live_alerts)
# Filtering for today's alerts
today = pd.Timestamp.now().normalize()
all_alerts = all_alerts[all_alerts["created_at"].dt.normalize() == today]

all_events = all_alerts.drop_duplicates(["id", "event_id"]).groupby("event_id").head(1) # Get unique events

Expand Down Expand Up @@ -575,9 +568,6 @@ def build_alert_overview(live_alerts, frame_urls, event_id, acknowledged):
acknowledge_alert_space_children = [html.P("Alerte acquittée.")]

df = pd.read_json(live_alerts)
# Filtering for today's alerts
today = pd.Timestamp.now().normalize()
df = df[df["created_at"].dt.normalize() == today]
df = df.drop_duplicates(["id", "event_id"]).groupby("event_id").head(1) # Get unique events

df["event_id"] = df["event_id"].astype(str)
Expand Down

0 comments on commit 2d633fa

Please sign in to comment.