mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 23:16:23 +02:00
Merge pull request #2632 from internetee/improve-statistics
Improved stats query
This commit is contained in:
commit
f2bad50884
3 changed files with 3 additions and 20 deletions
|
@ -139,21 +139,6 @@ module Repp
|
|||
|
||||
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
|
||||
SELECT
|
||||
(object->'registrar_id')::text AS registrar_id,
|
||||
|
@ -162,7 +147,7 @@ module Repp
|
|||
log_domains
|
||||
WHERE
|
||||
event = 'destroy'
|
||||
AND object_changes IS NULL
|
||||
AND object IS NOT NULL
|
||||
AND created_at > :date_to
|
||||
GROUP BY
|
||||
registrar_id
|
||||
|
|
2
test/fixtures/files/domain_versions.csv
vendored
2
test/fixtures/files/domain_versions.csv
vendored
|
@ -1,5 +1,5 @@
|
|||
Name,Registrant,Registrar,Action,Created at
|
||||
,John,,destroy,2023-12-04 22:00:00
|
||||
,John,Good Names,destroy,2023-12-04 22:00:00
|
||||
hospital.test,John,Good Names,create,2023-12-04 22:00:00
|
||||
library.test,Acme Ltd,Best Names,create,2023-12-04 22:00:00
|
||||
shop.test,John,Best Names,update,2023-12-04 22:00:00
|
||||
|
|
|
4
test/fixtures/log_domains.yml
vendored
4
test/fixtures/log_domains.yml
vendored
|
@ -74,9 +74,7 @@ destroy_one:
|
|||
event: destroy
|
||||
object:
|
||||
registrant_id: <%= ActiveRecord::FixtureSet.identify(:john) %>
|
||||
object_changes:
|
||||
name: ['cinema.test', null]
|
||||
registrar_id: [<%= ActiveRecord::FixtureSet.identify(:goodnames) %>, null]
|
||||
registrar_id: <%= ActiveRecord::FixtureSet.identify(:goodnames) %>
|
||||
created_at: <%= Time.zone.parse('2023-12-05') %>
|
||||
|
||||
create_six:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue