Skip to content

Commit

Permalink
Notification more 4 percent declined
Browse files Browse the repository at this point in the history
  • Loading branch information
strug committed Sep 23, 2024
1 parent a34c80f commit 04dc9b7
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
INSERT INTO fb_notificator.notification_template (name, type, skeleton, basic_params, query_text)
VALUES ('> 4% decline', 'MAIL_FORM', '<>', 'partyId,shopId',
'select partyId,shopId,percent from ( ' ||
'SELECT partyId,shopId,resultStatus,count() as status_count, ' ||
'sum(status_count) over(partition by partyId, shopId) as host_count, ' ||
'round(100 * status_count / host_count, 2) as percent ' ||
'FROM fraud.fruad ' ||
'WHERE timestamp >= toDate(:currentDate) - INTERVAL 1 day ' ||
'GROUP BY partyId, shopId, resultStatus )' ||
'where resultStatus = ''DECLINE'' and percent > 4 ' ||
'order by percent ASC');

0 comments on commit 04dc9b7

Please sign in to comment.