mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 13:06:18 +02:00
Improved stats query
This commit is contained in:
parent
8cef623888
commit
c67a21c7ba
2 changed files with 2 additions and 19 deletions
|
@ -139,21 +139,6 @@ module Repp
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
-- Query for 'destroy' events and count the number of domains destroyed associated with each registrar
|
|
||||||
SELECT
|
|
||||||
(object_changes->'registrar_id'->>0)::text AS registrar_id,
|
|
||||||
COUNT(*) AS domain_count
|
|
||||||
FROM
|
|
||||||
log_domains
|
|
||||||
WHERE
|
|
||||||
event = 'destroy'
|
|
||||||
AND object_changes->'registrar_id' IS NOT NULL
|
|
||||||
AND created_at > :date_to
|
|
||||||
GROUP BY
|
|
||||||
registrar_id
|
|
||||||
|
|
||||||
UNION ALL
|
|
||||||
|
|
||||||
-- Query for 'destroy' events and count the number of domains destroyed associated with each registrar
|
-- Query for 'destroy' events and count the number of domains destroyed associated with each registrar
|
||||||
SELECT
|
SELECT
|
||||||
(object->'registrar_id')::text AS registrar_id,
|
(object->'registrar_id')::text AS registrar_id,
|
||||||
|
@ -162,7 +147,7 @@ module Repp
|
||||||
log_domains
|
log_domains
|
||||||
WHERE
|
WHERE
|
||||||
event = 'destroy'
|
event = 'destroy'
|
||||||
AND object_changes IS NULL
|
AND object IS NOT NULL
|
||||||
AND created_at > :date_to
|
AND created_at > :date_to
|
||||||
GROUP BY
|
GROUP BY
|
||||||
registrar_id
|
registrar_id
|
||||||
|
|
4
test/fixtures/log_domains.yml
vendored
4
test/fixtures/log_domains.yml
vendored
|
@ -74,9 +74,7 @@ destroy_one:
|
||||||
event: destroy
|
event: destroy
|
||||||
object:
|
object:
|
||||||
registrant_id: <%= ActiveRecord::FixtureSet.identify(:john) %>
|
registrant_id: <%= ActiveRecord::FixtureSet.identify(:john) %>
|
||||||
object_changes:
|
registrar_id: <%= ActiveRecord::FixtureSet.identify(:goodnames) %>
|
||||||
name: ['cinema.test', null]
|
|
||||||
registrar_id: [<%= ActiveRecord::FixtureSet.identify(:goodnames) %>, null]
|
|
||||||
created_at: <%= Time.zone.parse('2023-12-05') %>
|
created_at: <%= Time.zone.parse('2023-12-05') %>
|
||||||
|
|
||||||
create_six:
|
create_six:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue