diff --git a/app/logical/moderator/ip_addr_search.rb b/app/logical/moderator/ip_addr_search.rb index c47216c04..1959e3626 100644 --- a/app/logical/moderator/ip_addr_search.rb +++ b/app/logical/moderator/ip_addr_search.rb @@ -31,6 +31,7 @@ module Moderator add_row(sums, PostAppeal.where(creator_ip_addr: ip_addrs).group(:creator).count) add_row(sums, PostFlag.where(creator_ip_addr: ip_addrs).group(:creator).count) add_row(sums, Upload.where(uploader_ip_addr: ip_addrs).group(:uploader).count) + add_row(sums, UserFeedback.where(creator_ip_addr: ip_addrs).group(:creator).count) add_row(sums, Hash[User.where(last_ip_addr: ip_addrs).collect { |user| [user, 1] }]) add_row_id(sums, PoolArchive.where(updater_ip_addr: ip_addrs).group(:updater_id).count) if PoolArchive.enabled? @@ -60,6 +61,7 @@ module Moderator add_row(sums, PostFlag.where(creator: users).group(:creator_ip_addr).count) add_row(sums, Upload.where(uploader: users).group(:uploader_ip_addr).count) add_row(sums, User.where(id: users).where.not(last_ip_addr: nil).group(:last_ip_addr).count) + add_row(sums, UserFeedback.where(creator_id: users).where.not(creator_ip_addr: nil).group(:creator_ip_addr).count) sums end diff --git a/db/migrate/20181130004740_add_creator_ip_addr_to_user_feedback.rb b/db/migrate/20181130004740_add_creator_ip_addr_to_user_feedback.rb new file mode 100644 index 000000000..27f01d14e --- /dev/null +++ b/db/migrate/20181130004740_add_creator_ip_addr_to_user_feedback.rb @@ -0,0 +1,6 @@ +class AddCreatorIpAddrToUserFeedback < ActiveRecord::Migration[5.2] + def change + add_column :user_feedback, :creator_ip_addr, "inet" + add_index :user_feedback, :creator_ip_addr + end +end diff --git a/db/structure.sql b/db/structure.sql index 04dc90557..ed26fe024 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3149,7 +3149,8 @@ CREATE TABLE public.user_feedback ( category character varying NOT NULL, body text NOT NULL, created_at timestamp without time zone, - updated_at timestamp without time zone + updated_at timestamp without time zone, + creator_ip_addr inet ); @@ -7174,6 +7175,13 @@ CREATE INDEX index_user_feedback_on_created_at ON public.user_feedback USING btr CREATE INDEX index_user_feedback_on_creator_id ON public.user_feedback USING btree (creator_id); +-- +-- Name: index_user_feedback_on_creator_ip_addr; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_user_feedback_on_creator_ip_addr ON public.user_feedback USING btree (creator_ip_addr); + + -- -- Name: index_user_feedback_on_user_id; Type: INDEX; Schema: public; Owner: - -- @@ -7509,6 +7517,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20181113174914'), ('20181114180205'), ('20181114185032'), -('20181114202744'); +('20181114202744'), +('20181130004740');