diff --git a/app/controllers/repp/v1/stats_controller.rb b/app/controllers/repp/v1/stats_controller.rb index b8c3b053f..8e0f78125 100644 --- a/app/controllers/repp/v1/stats_controller.rb +++ b/app/controllers/repp/v1/stats_controller.rb @@ -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 diff --git a/test/fixtures/log_domains.yml b/test/fixtures/log_domains.yml index bbd161c64..28a9a36c3 100644 --- a/test/fixtures/log_domains.yml +++ b/test/fixtures/log_domains.yml @@ -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: