Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: modify notifications_summary #417

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions views/015_job_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,17 @@ SELECT
notifications.created_at,
notifications.updated_at,
notifications.created_by,
job_history_latest_status.status job_status,
job_history_latest_status.details job_details,
job_history_latest_status.duration_millis job_duration_millis,
job_history_latest_status.time_start job_time_start
COUNT (event_queue.id) AS pending,
ROUND(AVG(CASE WHEN notification_send_history.error IS NOT NULL THEN notification_send_history.duration_millis ELSE NULL END), 2) AS avg_duration_ms,
COUNT (CASE WHEN notification_send_history.error IS NOT NULL THEN 1 END) AS failed,
COUNT (CASE WHEN notification_send_history.error IS NULL THEN 1 END) AS sent,
mode() WITHIN GROUP (ORDER BY notification_send_history.error) AS most_common_error
FROM
notifications
LEFT JOIN job_history_latest_status ON notifications.id::TEXT = job_history_latest_status.resource_id
LEFT JOIN notification_send_history ON notifications.id = notification_send_history.notification_id
LEFT JOIN event_queue ON
notifications.id::TEXT = event_queue.properties->>'notification_id' AND
event_queue.name = 'notification.send'
WHERE
notifications.deleted_at IS NULL;
notifications.deleted_at IS NULL
GROUP BY notifications.id;
Loading