Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irb(main):009:0> r = users.map{|user| p [Amelia::Data::Issues::Tabs.new(user, {}).call.map{|h| h.slice(:id, :issues_count)}] }
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.5ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1941]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : Service Load (1.0ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (2.2ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1941]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (2.2ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1941]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.2ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 1941]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.4ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1941]]
- I, [2021-11-09 14:05:18#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:18#53] INFO -- : {:user_id=>1941, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[1138, 1115, 1165, 1088, 1134, 984, 989, 1029, 1058, 1061, 1065, 1076, 1090, 1095, 1096, 1106, 1127, 1132, 1135, 1139, 1150, 1153, 1159, 1168, 1170, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 356, 357, 358, 360, 1197, 1253, 1274, 1179, 1110, 1114, 1125, 1129, 1162, 1167, 1171, 1012, 1046, 1047, 1059, 1074, 1080, 1092, 1093, 1048, 1049, 1148, 1050, 1161, 1176, 344, 1136, 1075, 1133], "work_category_id"=>[96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:18#53] DEBUG -- : Issue Load (6.7ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (1138, 1115, 1165, 1088, 1134, 984, 989, 1029, 1058, 1061, 1065, 1076, 1090, 1095, 1096, 1106, 1127, 1132, 1135, 1139, 1150, 1153, 1159, 1168, 1170, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 356, 357, 358, 360, 1197, 1253, 1274, 1179, 1110, 1114, 1125, 1129, 1162, 1167, 1171, 1012, 1046, 1047, 1059, 1074, 1080, 1092, 1093, 1048, 1049, 1148, 1050, 1161, 1176, 344, 1136, 1075, 1133) AND issues.work_category_id IN (96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (1941) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>8, :issues_count=>79}, {:id=>69, :issues_count=>16}, {:id=>51, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.1ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1942]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : Service Load (1.2ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.6ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1942]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.9ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1942]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.8ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 1942]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.3ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1942]]
- I, [2021-11-09 14:05:18#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:18#53] INFO -- : {:user_id=>1942, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[645], "work_category_id"=>[96, 95, 94, 93, 92, 84]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:18#53] DEBUG -- : Issue Load (4.9ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (645) AND issues.work_category_id IN (96, 95, 94, 93, 92, 84) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (1942) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>69, :issues_count=>4}, {:id=>51, :issues_count=>0}, {:id=>8, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1943]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (0.4ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : Service Load (0.6ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.1ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1943]]
- D, [2021-11-09 14:05:18#53] DEBUG -- : (1.6ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1943]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.3ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 1943]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.9ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1943]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>1943, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 611, 613, 614, 619, 620, 706, 708, 1211, 877, 14, 16, 18, 42, 52, 64, 82, 107, 121, 2, 22, 61, 75], "work_category_id"=>[96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (8.7ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 611, 613, 614, 619, 620, 706, 708, 1211, 877, 14, 16, 18, 42, 52, 64, 82, 107, 121, 2, 22, 61, 75) AND issues.work_category_id IN (96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (1943) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>8, :issues_count=>32}, {:id=>69, :issues_count=>15}, {:id=>51, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.9ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1944]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.8ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.4ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1944]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (2.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1944]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 1944]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1944]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>1944, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[1372], "work_category_id"=>[96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (8.3ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (1372) AND issues.work_category_id IN (96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (1944) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>69, :issues_count=>0}, {:id=>51, :issues_count=>0}, {:id=>8, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.8ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1945]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.8ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1945]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1945]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 1945]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.2ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1945]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>1945, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[721, 792, 870, 863, 795, 797, 800, 802, 803, 1255, 299, 300, 288, 301, 1103], "work_category_id"=>[96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (4.8ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (721, 792, 870, 863, 795, 797, 800, 802, 803, 1255, 299, 300, 288, 301, 1103) AND issues.work_category_id IN (96, 95, 94, 93, 92, 84, 42, 41, 40, 39, 38, 183) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (1945) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>8, :issues_count=>9}, {:id=>69, :issues_count=>3}, {:id=>51, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.0ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1978]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.7ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.0ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 1978]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1978]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.0ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 1978]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 1978]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>1978, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[1372], "work_category_id"=>[84, 96, 95, 94, 93, 92]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (3.9ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (1372) AND issues.work_category_id IN (84, 96, 95, 94, 93, 92) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (1978) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>69, :issues_count=>0}, {:id=>51, :issues_count=>0}, {:id=>8, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.8ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2020]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 1]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.8ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4, $5, $6) [["id", 8], ["id", 7], ["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.9ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2020]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.2ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2020]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 2020]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2020]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>2020, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[528, 875, 532, 537, 1213, 1270, 237, 221], "work_category_id"=>[51, 90, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 83, 82, 81, 80, 79, 78, 184, 96, 95, 94, 93, 92, 84, 50, 63, 75, 48, 70, 74, 61, 68, 47, 73, 54, 71, 58, 64, 52, 42, 41, 40, 39, 38, 183]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (4.6ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (528, 875, 532, 537, 1213, 1270, 237, 221) AND issues.work_category_id IN (51, 90, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 83, 82, 81, 80, 79, 78, 184, 96, 95, 94, 93, 92, 84, 50, 63, 75, 48, 70, 74, 61, 68, 47, 73, 54, 71, 58, 64, 52, 42, 41, 40, 39, 38, 183) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (2020) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>51, :issues_count=>26}, {:id=>6, :issues_count=>22}, {:id=>69, :issues_count=>6}, {:id=>8, :issues_count=>3}, {:id=>7, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Facility Load (0.9ms) SELECT "facilities".* FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2023]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.5ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 1]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 1]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.9ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3, $4) [["id", 6], ["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2023]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 2023]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2023]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>2023, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[1, 2], "building_id"=>[39], "work_category_id"=>[90]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (4.0ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (1, 2) AND issues.building_id IN (39) AND issues.work_category_id IN (90) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (2023) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>6, :issues_count=>2}, {:id=>69, :issues_count=>0}, {:id=>51, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.8ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2039]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.8ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3) [["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2039]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.2ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2039]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 2039]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2039]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>2039, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[2], "work_category_id"=>[98]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (3.8ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (2) AND issues.work_category_id IN (98) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (2039) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>51, :issues_count=>15}, {:id=>69, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.8ms) SELECT "services"."id" FROM "services" INNER JOIN "facilities" ON "services"."facility_id" = "facilities"."id" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2043]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.6ms) SELECT "services"."id" FROM "services" WHERE "services"."facility_id" = $1 [["facility_id", 2]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : Service Load (0.7ms) SELECT "services".* FROM "services" WHERE "services"."id" IN ($1, $2, $3) [["id", 69], ["id", 51], ["id", 103]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.8ms) SELECT "facilities"."id" FROM "facilities" INNER JOIN "facilities_users" ON "facilities"."id" = "facilities_users"."facility_id" WHERE "facilities"."deleted_at" IS NULL AND "facilities_users"."user_id" = $1 [["user_id", 2043]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2043]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (0.8ms) SELECT "work_categories"."id" FROM "work_categories" INNER JOIN "work_categories_groups" ON "work_categories_groups"."work_category_id" = "work_categories"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "work_categories_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "users"."id" = $1 [["id", 2043]]
- D, [2021-11-09 14:05:19#53] DEBUG -- : (1.1ms) SELECT "buildings"."id" FROM "buildings" INNER JOIN "buildings_work_groups" ON "buildings_work_groups"."building_id" = "buildings"."id" INNER JOIN "work_groups" ON "work_groups"."deleted_at" IS NULL AND "work_groups"."id" = "buildings_work_groups"."work_group_id" INNER JOIN "users_work_groups" ON "users_work_groups"."work_group_id" = "work_groups"."id" INNER JOIN "users" ON "users"."deleted_at" IS NULL AND "users"."id" = "users_work_groups"."user_id" WHERE "buildings"."deleted_at" IS NULL AND "users"."id" = $1 [["id", 2043]]
- I, [2021-11-09 14:05:19#53] INFO -- : Query attributes:
- I, [2021-11-09 14:05:19#53] INFO -- : {:user_id=>2043, :filters=>nil, :except_filters=>nil, :policy_filters=>{"facility_id"=>[2], "work_category_id"=>[217]}, :policy_except_filters=>{"state"=>[:closed, :rejected, :revoked, :initial]}, :page=>nil, :sort=>nil, :sort_desc=>nil}
- D, [2021-11-09 14:05:19#53] DEBUG -- : Issue Load (3.4ms) SELECT COUNT(id), service_id FROM ( SELECT DISTINCT issues.id, issues.service_id FROM issues LEFT OUTER JOIN companies ON issues.company_id = companies.id WHERE ( issues.deleted_at IS NULL AND ( ( 1=1 AND companies.facility_id IN (2) AND issues.work_category_id IN (217) AND issues.state NOT IN ('closed', 'rejected', 'revoked', 'initial') ) OR issues.user_id IN (2043) ) ) ) as issues_count GROUP BY service_id ORDER BY count DESC ;
- [[{:id=>51, :issues_count=>1}, {:id=>69, :issues_count=>0}, {:id=>103, :issues_count=>0}]]
- => [[[{:id=>8, :issues_count=>79}, {:id=>69, :issues_count=>16}, {:id=>51, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>69, :issues_count=>4}, {:id=>51, :issues_count=>0}, {:id=>8, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>8, :issues_count=>32}, {:id=>69, :issues_count=>15}, {:id=>51, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>69, :issues_count=>0}, {:id=>51, :issues_count=>0}, {:id=>8, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>8, :issues_count=>9}, {:id=>69, :issues_count=>3}, {:id=>51, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>69, :issues_count=>0}, {:id=>51, :issues_count=>0}, {:id=>8, :issues_count=>0}, {:id=>7, :issues_count=>0}, {:id=>6, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>51, :issues_count=>26}, {:id=>6, :issues_count=>22}, {:id=>69, :issues_count=>6}, {:id=>8, :issues_count=>3}, {:id=>7, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>6, :issues_count=>2}, {:id=>69, :issues_count=>0}, {:id=>51, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>51, :issues_count=>15}, {:id=>69, :issues_count=>0}, {:id=>103, :issues_count=>0}]], [[{:id=>51, :issues_count=>1}, {:id=>69, :issues_count=>0}, {:id=>103, :issues_count=>0}]]]
- irb(main):01
Advertisement
Add Comment
Please, Sign In to add comment