main
main copied to clipboard
Person/membership import broken
Our importing is broken again. This is waht i get on PR 283... but i think it's a broader problem...
Running via Spring preloader in process 19646 Loading development environment (Rails 5.0.1) irb(main):001:0> g = Group.find(2) Group Load (0.8ms) SELECT "groups".* FROM "groups" WHERE "groups"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] => #<Group id: 2, origin_system: nil, name: "Affiliate Group", description: nil, summary: nil, browser_url: nil, featured_image_url: nil, creator_id: 4, modified_by_id: nil, created_at: "2017-06-07 19:33:01", updated_at: "2017-06-07 19:40:21", an_api_key: "7697d3813267b9ea9550648064dbc90b", synced_at: "2017-06-07 19:40:15", address_id: nil> irb(main):002:0> g.members Person Load (1.4ms) SELECT "people".* FROM "people" INNER JOIN "memberships" ON "people"."id" = "memberships"."person_id" WHERE "memberships"."group_id" = $1 [["group_id", 2]] => #<ActiveRecord::Associations::CollectionProxy []> irb(main):003:0> g.memberships Membership Load (0.7ms) SELECT "memberships".* FROM "memberships" WHERE "memberships"."group_id" = $1 [["group_id", 2]] => #<ActiveRecord::Associations::CollectionProxy []> irb(main):004:0> g.import_members Api::ActionNetwork::People#import! from https://actionnetwork.org/api/v2/people?filter=modified_date%20gt%20%272017-06-07T19:40:15Z%27 (28.2ms) BEGIN Module#import! resources: 0 page: 1 Api::ActionNetwork::People#import! new: 0 existing: 8 updated: 0 (15.0ms) COMMIT => true irb(main):005:0> g.memberships => #<ActiveRecord::Associations::CollectionProxy []> irb(main):006:0> g.synced_at = nil => nil irb(main):007:0> g.save (0.2ms) BEGIN Group Exists (2.4ms) SELECT 1 AS one FROM "groups" WHERE "groups"."an_api_key" = $1 AND ("groups"."id" != $2) LIMIT $3 [["an_api_key", "7697d3813267b9ea9550648064dbc90b"], ["id", 2], ["LIMIT", 1]] SQL (22.7ms) UPDATE "groups" SET "updated_at" = $1, "synced_at" = $2 WHERE "groups"."id" = $3 [["updated_at", 2017-06-07 21:01:27 UTC], ["synced_at", nil], ["id", 2]] ActsAsTaggableOn::Tagging Load (5.6ms) SELECT "taggings".* FROM "taggings" WHERE "taggings"."taggable_id" = $1 AND "taggings"."taggable_type" = $2 [["taggable_id", 2], ["taggable_type", "Group"]] (28.1ms) COMMIT => true irb(main):008:0> g.import_members Api::ActionNetwork::People#import! from https://actionnetwork.org/api/v2/people (0.2ms) BEGIN Module#import! resources: 1 page: 1 Person Exists (1.3ms) SELECT 1 AS one FROM "people" WHERE ('action_network:ad3518e7-51d9-457d-95e0-102a82256148' = any (identifiers)) LIMIT $1 [["LIMIT", 1]] Person Exists (0.7ms) SELECT 1 AS one FROM "people" WHERE ('action_network:ad3518e7-51d9-457d-95e0-102a82256148' = any (identifiers)) LIMIT $1 [["LIMIT", 1]] Person Load (25.9ms) SELECT "people".* FROM "people" WHERE ('action_network:ad3518e7-51d9-457d-95e0-102a82256148' = any (identifiers)) AND (updated_at < '2017-05-25 19:59:47') ORDER BY "people"."id" ASC LIMIT $1 [["LIMIT", 1]] Module#import! resources: 0 page: 2 Api::ActionNetwork::People#import! new: 0 existing: 16 updated: 0 (0.4ms) COMMIT => true irb(main):009:0> g.members => #<ActiveRecord::Associations::CollectionProxy []> irb(main):010:0>
@rabble can you explain a bit more what the issue is? You are trying to import data from AN but nothing is stored?
I created (locally) the same group with the same an_api_key and ran the import_members method. 3 member were imported from AN.