{"action":"created","comment":{"url":"https://api.github.com/repos/stablekernel/aqueduct/pulls/comments/81398574","pull_request_review_id":2383606,"id":81398574,"diff_hunk":"@@ -3,491 +3,568 @@ import 'package:aqueduct/aqueduct.dart';\n import 'dart:async';\n import '../../helpers.dart';\n \n+/*\n+  The test data is like so:\n+\n+           A       B       C      D\n+         /   \\     | \\     |\n+        C1    C2  C3  C4  C5\n+      / | \\    |   |\n+    T1 V1 V2  T2  V3\n+ */\n+\n void main() {\n-  group(\"HasMany relationships\", () {\n+  group(\"Happy path\", () {\n     ModelContext context = null;\n-    List<User> sourceUsers;\n-\n+    List<Parent> truth;\n     setUpAll(() async {\n-      context = await contextWithModels([User, Equipment, Location]);\n-\n-      var userNames = [\"Joe\", \"Fred\", \"Bob\", \"John\", \"Sally\"];\n-      // Create a bunch of sample data\n-      sourceUsers = await Future.wait(userNames.map((name) {\n-        var q = new Query<User>()\n-          ..values.name = name;\n-        return q.insert();\n-      }));\n-\n-      var locationCreator = (List<String> names, User u) {\n-        return names.map((name) {\n-          var q = new Query<Location>()\n-            ..values.name = name\n-            ..values.user = (new User()..id = u.id);\n-          return q.insert();\n-        });\n+      context = await contextWithModels([Child, Parent, Toy, Vaccine]);\n+      truth = await populate();\n+    });\n+\n+    tearDownAll(() async {\n+      await context?.persistentStore?.close();\n+    });\n+\n+    test(\"Fetch has-many relationship that has none returns empty OrderedSet\", () async {\n+      var q = new Query<Parent>()\n+        ..matchOn.children.includeInResultSet = true\n+        ..matchOn.name = \"D\";\n+\n+      var verifier = (Parent p) {\n+        expect(p.name, \"D\");\n+        expect(p.id, isNotNull);\n+        expect(p.children, []);\n       };\n+      verifier(await q.fetchOne());\n+      verifier((await q.fetch()).first);\n+    });\n \n-      sourceUsers[0].locations = new OrderedSet.from(await Future.wait(locationCreator([\"Crestridge\", \"SK\"], sourceUsers[0])));\n-      sourceUsers[1].locations = new OrderedSet.from(await Future.wait(locationCreator([\"Krog St\", \"Dumpster\"], sourceUsers[1])));\n-      sourceUsers[2].locations = new OrderedSet.from(await Future.wait(locationCreator([\"Omaha\"], sourceUsers[2])));\n-      sourceUsers[3].locations = new OrderedSet.from(await Future.wait(locationCreator([\"London\"], sourceUsers[3])));\n-      sourceUsers[4].locations = new OrderedSet();\n-\n-      var equipmentCreator = (List<List<String>> pairs, Location loc) {\n-        return pairs.map((pair) {\n-          var q = new Query<Equipment>()\n-            ..values.name = pair.first\n-            ..values.type = pair.last\n-            ..values.location = (new Location()..id = loc.id);\n-          return q.insert();\n-        });\n+    test(\"Fetch has-many relationship that is empty returns empty, and deeper nested relationships are ignored even when included\", () async {\n+      var q = new Query<Parent>()\n+        ..matchOn.children.includeInResultSet = true","path":"test/db/postgresql/has_many_fetch_test.dart","position":77,"original_position":77,"commit_id":"977979661ac72b8b4777a44493072a261adab91f","original_commit_id":"977979661ac72b8b4777a44493072a261adab91f","user":{"login":"rosshambrick","id":753106,"avatar_url":"https://avatars.githubusercontent.com/u/753106?v=3","gravatar_id":"","url":"https://api.github.com/users/rosshambrick","html_url":"https://github.com/rosshambrick","followers_url":"https://api.github.com/users/rosshambrick/followers","following_url":"https://api.github.com/users/rosshambrick/following{/other_user}","gists_url":"https://api.github.com/users/rosshambrick/gists{/gist_id}","starred_url":"https://api.github.com/users/rosshambrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosshambrick/subscriptions","organizations_url":"https://api.github.com/users/rosshambrick/orgs","repos_url":"https://api.github.com/users/rosshambrick/repos","events_url":"https://api.github.com/users/rosshambrick/events{/privacy}","received_events_url":"https://api.github.com/users/rosshambrick/received_events","type":"User","site_admin":false},"body":"hmm...so the `matchOn` confuses me then.  Could it be something like this?\r\n```dart\r\nvar q = new Query<Parent>()\r\n    ..eagerLoad.children;\r\n```","created_at":"2016-09-30T18:59:33Z","updated_at":"2016-09-30T18:59:33Z","html_url":"https://github.com/stablekernel/aqueduct/pull/85#discussion_r81398574","pull_request_url":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/stablekernel/aqueduct/pulls/comments/81398574"},"html":{"href":"https://github.com/stablekernel/aqueduct/pull/85#discussion_r81398574"},"pull_request":{"href":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85","id":87363666,"html_url":"https://github.com/stablekernel/aqueduct/pull/85","diff_url":"https://github.com/stablekernel/aqueduct/pull/85.diff","patch_url":"https://github.com/stablekernel/aqueduct/pull/85.patch","issue_url":"https://api.github.com/repos/stablekernel/aqueduct/issues/85","number":85,"state":"open","locked":false,"title":"Jc/robust","user":{"login":"joeconwaystk","id":1576234,"avatar_url":"https://avatars.githubusercontent.com/u/1576234?v=3","gravatar_id":"","url":"https://api.github.com/users/joeconwaystk","html_url":"https://github.com/joeconwaystk","followers_url":"https://api.github.com/users/joeconwaystk/followers","following_url":"https://api.github.com/users/joeconwaystk/following{/other_user}","gists_url":"https://api.github.com/users/joeconwaystk/gists{/gist_id}","starred_url":"https://api.github.com/users/joeconwaystk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeconwaystk/subscriptions","organizations_url":"https://api.github.com/users/joeconwaystk/orgs","repos_url":"https://api.github.com/users/joeconwaystk/repos","events_url":"https://api.github.com/users/joeconwaystk/events{/privacy}","received_events_url":"https://api.github.com/users/joeconwaystk/received_events","type":"User","site_admin":false},"body":"This PR includes a number of robust tests for executing queries, especially around join queries. And addresses a bug or two along the way.","created_at":"2016-09-29T18:06:20Z","updated_at":"2016-09-30T18:59:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dba493bdbc9ff60d0230eaf1574200401ebdd1f2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85/commits","review_comments_url":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85/comments","review_comment_url":"https://api.github.com/repos/stablekernel/aqueduct/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stablekernel/aqueduct/issues/85/comments","statuses_url":"https://api.github.com/repos/stablekernel/aqueduct/statuses/977979661ac72b8b4777a44493072a261adab91f","head":{"label":"stablekernel:jc/robust","ref":"jc/robust","sha":"977979661ac72b8b4777a44493072a261adab91f","user":{"login":"stablekernel","id":4998931,"avatar_url":"https://avatars.githubusercontent.com/u/4998931?v=3","gravatar_id":"","url":"https://api.github.com/users/stablekernel","html_url":"https://github.com/stablekernel","followers_url":"https://api.github.com/users/stablekernel/followers","following_url":"https://api.github.com/users/stablekernel/following{/other_user}","gists_url":"https://api.github.com/users/stablekernel/gists{/gist_id}","starred_url":"https://api.github.com/users/stablekernel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stablekernel/subscriptions","organizations_url":"https://api.github.com/users/stablekernel/orgs","repos_url":"https://api.github.com/users/stablekernel/repos","events_url":"https://api.github.com/users/stablekernel/events{/privacy}","received_events_url":"https://api.github.com/users/stablekernel/received_events","type":"Organization","site_admin":false},"repo":{"id":36523292,"name":"aqueduct","full_name":"stablekernel/aqueduct","owner":{"login":"stablekernel","id":4998931,"avatar_url":"https://avatars.githubusercontent.com/u/4998931?v=3","gravatar_id":"","url":"https://api.github.com/users/stablekernel","html_url":"https://github.com/stablekernel","followers_url":"https://api.github.com/users/stablekernel/followers","following_url":"https://api.github.com/users/stablekernel/following{/other_user}","gists_url":"https://api.github.com/users/stablekernel/gists{/gist_id}","starred_url":"https://api.github.com/users/stablekernel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stablekernel/subscriptions","organizations_url":"https://api.github.com/users/stablekernel/orgs","repos_url":"https://api.github.com/users/stablekernel/repos","events_url":"https://api.github.com/users/stablekernel/events{/privacy}","received_events_url":"https://api.github.com/users/stablekernel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stablekernel/aqueduct","description":"Web server convenience utilities for dart","fork":false,"url":"https://api.github.com/repos/stablekernel/aqueduct","forks_url":"https://api.github.com/repos/stablekernel/aqueduct/forks","keys_url":"https://api.github.com/repos/stablekernel/aqueduct/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stablekernel/aqueduct/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stablekernel/aqueduct/teams","hooks_url":"https://api.github.com/repos/stablekernel/aqueduct/hooks","issue_events_url":"https://api.github.com/repos/stablekernel/aqueduct/issues/events{/number}","events_url":"https://api.github.com/repos/stablekernel/aqueduct/events","assignees_url":"https://api.github.com/repos/stablekernel/aqueduct/assignees{/user}","branches_url":"https://api.github.com/repos/stablekernel/aqueduct/branches{/branch}","tags_url":"https://api.github.com/repos/stablekernel/aqueduct/tags","blobs_url":"https://api.github.com/repos/stablekernel/aqueduct/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stablekernel/aqueduct/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stablekernel/aqueduct/git/refs{/sha}","trees_url":"https://api.github.com/repos/stablekernel/aqueduct/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stablekernel/aqueduct/statuses/{sha}","languages_url":"https://api.github.com/repos/stablekernel/aqueduct/languages","stargazers_url":"https://api.github.com/repos/stablekernel/aqueduct/stargazers","contributors_url":"https://api.github.com/repos/stablekernel/aqueduct/contributors","subscribers_url":"https://api.github.com/repos/stablekernel/aqueduct/subscribers","subscription_url":"https://api.github.com/repos/stablekernel/aqueduct/subscription","commits_url":"https://api.github.com/repos/stablekernel/aqueduct/commits{/sha}","git_commits_url":"https://api.github.com/repos/stablekernel/aqueduct/git/commits{/sha}","comments_url":"https://api.github.com/repos/stablekernel/aqueduct/comments{/number}","issue_comment_url":"https://api.github.com/repos/stablekernel/aqueduct/issues/comments{/number}","contents_url":"https://api.github.com/repos/stablekernel/aqueduct/contents/{+path}","compare_url":"https://api.github.com/repos/stablekernel/aqueduct/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stablekernel/aqueduct/merges","archive_url":"https://api.github.com/repos/stablekernel/aqueduct/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stablekernel/aqueduct/downloads","issues_url":"https://api.github.com/repos/stablekernel/aqueduct/issues{/number}","pulls_url":"https://api.github.com/repos/stablekernel/aqueduct/pulls{/number}","milestones_url":"https://api.github.com/repos/stablekernel/aqueduct/milestones{/number}","notifications_url":"https://api.github.com/repos/stablekernel/aqueduct/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stablekernel/aqueduct/labels{/name}","releases_url":"https://api.github.com/repos/stablekernel/aqueduct/releases{/id}","deployments_url":"https://api.github.com/repos/stablekernel/aqueduct/deployments","created_at":"2015-05-29T18:56:06Z","updated_at":"2016-09-08T15:51:04Z","pushed_at":"2016-09-30T16:26:25Z","git_url":"git://github.com/stablekernel/aqueduct.git","ssh_url":"git@github.com:stablekernel/aqueduct.git","clone_url":"https://github.com/stablekernel/aqueduct.git","svn_url":"https://github.com/stablekernel/aqueduct","homepage":null,"size":2870,"stargazers_count":8,"watchers_count":8,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":8,"default_branch":"master"}},"base":{"label":"stablekernel:1.0","ref":"1.0","sha":"e4461e895a2116a3867ef65cf35619a2a258ab7c","user":{"login":"stablekernel","id":4998931,"avatar_url":"https://avatars.githubusercontent.com/u/4998931?v=3","gravatar_id":"","url":"https://api.github.com/users/stablekernel","html_url":"https://github.com/stablekernel","followers_url":"https://api.github.com/users/stablekernel/followers","following_url":"https://api.github.com/users/stablekernel/following{/other_user}","gists_url":"https://api.github.com/users/stablekernel/gists{/gist_id}","starred_url":"https://api.github.com/users/stablekernel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stablekernel/subscriptions","organizations_url":"https://api.github.com/users/stablekernel/orgs","repos_url":"https://api.github.com/users/stablekernel/repos","events_url":"https://api.github.com/users/stablekernel/events{/privacy}","received_events_url":"https://api.github.com/users/stablekernel/received_events","type":"Organization","site_admin":false},"repo":{"id":36523292,"name":"aqueduct","full_name":"stablekernel/aqueduct","owner":{"login":"stablekernel","id":4998931,"avatar_url":"https://avatars.githubusercontent.com/u/4998931?v=3","gravatar_id":"","url":"https://api.github.com/users/stablekernel","html_url":"https://github.com/stablekernel","followers_url":"https://api.github.com/users/stablekernel/followers","following_url":"https://api.github.com/users/stablekernel/following{/other_user}","gists_url":"https://api.github.com/users/stablekernel/gists{/gist_id}","starred_url":"https://api.github.com/users/stablekernel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stablekernel/subscriptions","organizations_url":"https://api.github.com/users/stablekernel/orgs","repos_url":"https://api.github.com/users/stablekernel/repos","events_url":"https://api.github.com/users/stablekernel/events{/privacy}","received_events_url":"https://api.github.com/users/stablekernel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stablekernel/aqueduct","description":"Web server convenience utilities for dart","fork":false,"url":"https://api.github.com/repos/stablekernel/aqueduct","forks_url":"https://api.github.com/repos/stablekernel/aqueduct/forks","keys_url":"https://api.github.com/repos/stablekernel/aqueduct/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stablekernel/aqueduct/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stablekernel/aqueduct/teams","hooks_url":"https://api.github.com/repos/stablekernel/aqueduct/hooks","issue_events_url":"https://api.github.com/repos/stablekernel/aqueduct/issues/events{/number}","events_url":"https://api.github.com/repos/stablekernel/aqueduct/events","assignees_url":"https://api.github.com/repos/stablekernel/aqueduct/assignees{/user}","branches_url":"https://api.github.com/repos/stablekernel/aqueduct/branches{/branch}","tags_url":"https://api.github.com/repos/stablekernel/aqueduct/tags","blobs_url":"https://api.github.com/repos/stablekernel/aqueduct/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stablekernel/aqueduct/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stablekernel/aqueduct/git/refs{/sha}","trees_url":"https://api.github.com/repos/stablekernel/aqueduct/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stablekernel/aqueduct/statuses/{sha}","languages_url":"https://api.github.com/repos/stablekernel/aqueduct/languages","stargazers_url":"https://api.github.com/repos/stablekernel/aqueduct/stargazers","contributors_url":"https://api.github.com/repos/stablekernel/aqueduct/contributors","subscribers_url":"https://api.github.com/repos/stablekernel/aqueduct/subscribers","subscription_url":"https://api.github.com/repos/stablekernel/aqueduct/subscription","commits_url":"https://api.github.com/repos/stablekernel/aqueduct/commits{/sha}","git_commits_url":"https://api.github.com/repos/stablekernel/aqueduct/git/commits{/sha}","comments_url":"https://api.github.com/repos/stablekernel/aqueduct/comments{/number}","issue_comment_url":"https://api.github.com/repos/stablekernel/aqueduct/issues/comments{/number}","contents_url":"https://api.github.com/repos/stablekernel/aqueduct/contents/{+path}","compare_url":"https://api.github.com/repos/stablekernel/aqueduct/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stablekernel/aqueduct/merges","archive_url":"https://api.github.com/repos/stablekernel/aqueduct/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stablekernel/aqueduct/downloads","issues_url":"https://api.github.com/repos/stablekernel/aqueduct/issues{/number}","pulls_url":"https://api.github.com/repos/stablekernel/aqueduct/pulls{/number}","milestones_url":"https://api.github.com/repos/stablekernel/aqueduct/milestones{/number}","notifications_url":"https://api.github.com/repos/stablekernel/aqueduct/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stablekernel/aqueduct/labels{/name}","releases_url":"https://api.github.com/repos/stablekernel/aqueduct/releases{/id}","deployments_url":"https://api.github.com/repos/stablekernel/aqueduct/deployments","created_at":"2015-05-29T18:56:06Z","updated_at":"2016-09-08T15:51:04Z","pushed_at":"2016-09-30T16:26:25Z","git_url":"git://github.com/stablekernel/aqueduct.git","ssh_url":"git@github.com:stablekernel/aqueduct.git","clone_url":"https://github.com/stablekernel/aqueduct.git","svn_url":"https://github.com/stablekernel/aqueduct","homepage":null,"size":2870,"stargazers_count":8,"watchers_count":8,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85"},"html":{"href":"https://github.com/stablekernel/aqueduct/pull/85"},"issue":{"href":"https://api.github.com/repos/stablekernel/aqueduct/issues/85"},"comments":{"href":"https://api.github.com/repos/stablekernel/aqueduct/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/stablekernel/aqueduct/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stablekernel/aqueduct/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/stablekernel/aqueduct/statuses/977979661ac72b8b4777a44493072a261adab91f"}}}}
{"actor":{"display_login":"rosshambrick"}}