LCOV - code coverage report
Current view: top level - matchscore/db/postgres - telegram_payment_reminder.clj Coverage Total Hit
Test: lcov.info Lines: 100.0 % 14 14
Test Date: 2026-11-23 18:11:10 Functions: - 0 0

            Line data    Source code
       1            4 : (ns matchscore.db.postgres.telegram-payment-reminder
       2              :   (:require
       3              :    [matchscore.utils.db :as utils.db]
       4              :    [next.jdbc :as jdbc]))
       5              : 
       6              : 
       7            4 : (defn candidates
       8              :  "Events in the bounded reminder window which have a payment reminder setting
       9              :    on either the event or its template and no recorded payment-details post."
      10              :  [ds now limit]
      11            1 :  (->>
      12            2 :    (jdbc/execute!
      13            1 :     ds
      14            2 :     ["SELECT e.uuid,
      15              :              e.datetime_start,
      16              :              e.state,
      17              :              e.settings,
      18              :              t.settings AS template_settings
      19              :         FROM events e
      20              :         LEFT JOIN templates t ON t.uuid = e.template_id
      21              :        WHERE e.datetime_start >= ?::timestamptz - interval '169 hours'
      22              :          AND e.datetime_start <= ?::timestamptz + interval '168 hours'
      23              :          AND e.state <> 'cancelled'
      24              :          AND (jsonb_exists(e.settings, 'payment-reminder')
      25              :               OR jsonb_exists(t.settings, 'payment-reminder'))
      26              :          AND NOT EXISTS (SELECT 1
      27              :                            FROM telegram_chat_messages m
      28              :                           WHERE m.event_id = e.uuid
      29              :                             AND m.kind = 'payment_details_post')
      30              :        ORDER BY e.datetime_start, e.uuid
      31              :        LIMIT ?"
      32            3 :      (str now)
      33            3 :      (str now)
      34            2 :      (long limit)])
      35            1 :    (mapv
      36            1 :     (fn [row]
      37            2 :      (->
      38            3 :        (utils.db/unqualify-keys row)
      39            2 :        (update :uuid str))))))
        

Generated by: LCOV version 2.0-1