Skip to content

Commit

Permalink
Add message if no modified entities
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjtaylor committed Dec 14, 2023
1 parent 50bfbfe commit 96ff20a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,23 @@ def send_message_to_slack_blocks(webhook_url, blocks):

enriched_data = enrich_count(count, syn)

slack_message_blocks = dataframe_to_slack_block_with_md_links(enriched_data)
# Check if the dataframe is empty
if enriched_data.empty:
# If no modified entities are found, prepare a simple message for Slack
slack_message_blocks = {
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "No entities were modified in the last day"
}
}
]
}
else:
# If there are modified entities, format the message as before
slack_message_blocks = dataframe_to_slack_block_with_md_links(enriched_data)

# Usage
send_message_to_slack_blocks(webhook_url, slack_message_blocks)
Expand Down

0 comments on commit 96ff20a

Please sign in to comment.