{"action":"created","comment":{"url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/comments/181108278","pull_request_review_id":111639927,"id":181108278,"diff_hunk":"@@ -92,21 +121,71 @@ protected Void doInBackground(Void... voids) {\n     }\n \n     public LiveData<Resource<List<Destination>>> loadDestinations() {\n-        return new AttractionNetworkBoundResource<Destination>(webservice, destinationDao, eventDao) {\n+        LiveData<Resource<List<Destination>>> data = new AttractionNetworkBoundResource<Destination>(webservice, destinationDao, eventDao) {\n             @NonNull\n             @Override\n             protected LiveData<List<Destination>> loadFromDb() {\n                 return destinationDao.getAll();\n             }\n         }.getAsLiveData();\n+        return addAttractionFlags(data, false);\n     }\n \n     public LiveData<Resource<List<Event>>> loadEvents() {\n-        return new AttractionNetworkBoundResource<Event>(webservice, destinationDao, eventDao) {\n+        LiveData<Resource<List<Event>>> data = new AttractionNetworkBoundResource<Event>(webservice, destinationDao, eventDao) {\n             @NonNull @Override\n             protected LiveData<List<Event>> loadFromDb() {\n                 return eventDao.getAll();\n             }\n         }.getAsLiveData();\n+        return addAttractionFlags(data, true);\n+    }\n+\n+    private <T extends Attraction> LiveData<T> addAttractionFlag(LiveData<T> data) {\n+        return switchMap(data, attraction -> {\n+            MutableLiveData<T> result = new MutableLiveData<>();\n+            if (attraction == null) {\n+                result.postValue(attraction);","path":"app/src/main/java/com/gophillygo/app/data/DestinationRepository.java","position":114,"original_position":114,"commit_id":"3eced7b581601991b114d3988e778babce11fe88","original_commit_id":"3eced7b581601991b114d3988e778babce11fe88","user":{"login":"flibbertigibbet","id":960264,"avatar_url":"https://avatars3.githubusercontent.com/u/960264?v=4","gravatar_id":"","url":"https://api.github.com/users/flibbertigibbet","html_url":"https://github.com/flibbertigibbet","followers_url":"https://api.github.com/users/flibbertigibbet/followers","following_url":"https://api.github.com/users/flibbertigibbet/following{/other_user}","gists_url":"https://api.github.com/users/flibbertigibbet/gists{/gist_id}","starred_url":"https://api.github.com/users/flibbertigibbet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flibbertigibbet/subscriptions","organizations_url":"https://api.github.com/users/flibbertigibbet/orgs","repos_url":"https://api.github.com/users/flibbertigibbet/repos","events_url":"https://api.github.com/users/flibbertigibbet/events{/privacy}","received_events_url":"https://api.github.com/users/flibbertigibbet/received_events","type":"User","site_admin":false},"body":"Should post `null` here to be more explicit (the linter complains about this line).","created_at":"2018-04-12T14:45:43Z","updated_at":"2018-04-12T14:53:19Z","html_url":"https://github.com/azavea/cac-tripplanner-android/pull/36#discussion_r181108278","pull_request_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/comments/181108278"},"html":{"href":"https://github.com/azavea/cac-tripplanner-android/pull/36#discussion_r181108278"},"pull_request":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36","id":180989183,"html_url":"https://github.com/azavea/cac-tripplanner-android/pull/36","diff_url":"https://github.com/azavea/cac-tripplanner-android/pull/36.diff","patch_url":"https://github.com/azavea/cac-tripplanner-android/pull/36.patch","issue_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues/36","number":36,"state":"open","locked":false,"title":"Add user flags to events and places","user":{"login":"maurizi","id":4432106,"avatar_url":"https://avatars3.githubusercontent.com/u/4432106?v=4","gravatar_id":"","url":"https://api.github.com/users/maurizi","html_url":"https://github.com/maurizi","followers_url":"https://api.github.com/users/maurizi/followers","following_url":"https://api.github.com/users/maurizi/following{/other_user}","gists_url":"https://api.github.com/users/maurizi/gists{/gist_id}","starred_url":"https://api.github.com/users/maurizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maurizi/subscriptions","organizations_url":"https://api.github.com/users/maurizi/orgs","repos_url":"https://api.github.com/users/maurizi/repos","events_url":"https://api.github.com/users/maurizi/events{/privacy}","received_events_url":"https://api.github.com/users/maurizi/received_events","type":"User","site_admin":false},"body":"## Overview\r\n\r\nStore user flags (been, like, etc.) when a user selects a flag for an event/destination from the list/detail screens, and display the correct image for already flagged events & destinations.\r\n\r\n## Demo\r\n![screenshot_1523470790](https://user-images.githubusercontent.com/4432106/38635590-de7e4908-3d93-11e8-8636-c306b5abe33f.png)\r\n![screenshot_1523470775](https://user-images.githubusercontent.com/4432106/38635591-de8a80b0-3d93-11e8-92bc-474b9b64e267.png)\r\n![screenshot_1523470763](https://user-images.githubusercontent.com/4432106/38635592-de9ad500-3d93-11e8-8477-42302cbfee2a.png)\r\n\r\n## Notes\r\n\r\n - User flags are stored in the separate `AttractionFlag` entity, to allow clearing/refetching the Event and Destination tables. Whenever events or destinations are retrieved we also retrieve the appropriate flags and set them on the model(s) for easier access.\r\n\r\nCloses #25 ","created_at":"2018-04-11T18:25:53Z","updated_at":"2018-04-12T14:53:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5c078fc7b98d7753c1115d73af1b20127aa2256","assignee":{"login":"flibbertigibbet","id":960264,"avatar_url":"https://avatars3.githubusercontent.com/u/960264?v=4","gravatar_id":"","url":"https://api.github.com/users/flibbertigibbet","html_url":"https://github.com/flibbertigibbet","followers_url":"https://api.github.com/users/flibbertigibbet/followers","following_url":"https://api.github.com/users/flibbertigibbet/following{/other_user}","gists_url":"https://api.github.com/users/flibbertigibbet/gists{/gist_id}","starred_url":"https://api.github.com/users/flibbertigibbet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flibbertigibbet/subscriptions","organizations_url":"https://api.github.com/users/flibbertigibbet/orgs","repos_url":"https://api.github.com/users/flibbertigibbet/repos","events_url":"https://api.github.com/users/flibbertigibbet/events{/privacy}","received_events_url":"https://api.github.com/users/flibbertigibbet/received_events","type":"User","site_admin":false},"assignees":[{"login":"flibbertigibbet","id":960264,"avatar_url":"https://avatars3.githubusercontent.com/u/960264?v=4","gravatar_id":"","url":"https://api.github.com/users/flibbertigibbet","html_url":"https://github.com/flibbertigibbet","followers_url":"https://api.github.com/users/flibbertigibbet/followers","following_url":"https://api.github.com/users/flibbertigibbet/following{/other_user}","gists_url":"https://api.github.com/users/flibbertigibbet/gists{/gist_id}","starred_url":"https://api.github.com/users/flibbertigibbet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flibbertigibbet/subscriptions","organizations_url":"https://api.github.com/users/flibbertigibbet/orgs","repos_url":"https://api.github.com/users/flibbertigibbet/repos","events_url":"https://api.github.com/users/flibbertigibbet/events{/privacy}","received_events_url":"https://api.github.com/users/flibbertigibbet/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":831344577,"url":"https://api.github.com/repos/azavea/cac-tripplanner-android/labels/in%20review","name":"in review","color":"e6e6e6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36/commits","review_comments_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36/comments","review_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues/36/comments","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/statuses/3eced7b581601991b114d3988e778babce11fe88","head":{"label":"maurizi:feature/mvm/user-flags","ref":"feature/mvm/user-flags","sha":"3eced7b581601991b114d3988e778babce11fe88","user":{"login":"maurizi","id":4432106,"avatar_url":"https://avatars3.githubusercontent.com/u/4432106?v=4","gravatar_id":"","url":"https://api.github.com/users/maurizi","html_url":"https://github.com/maurizi","followers_url":"https://api.github.com/users/maurizi/followers","following_url":"https://api.github.com/users/maurizi/following{/other_user}","gists_url":"https://api.github.com/users/maurizi/gists{/gist_id}","starred_url":"https://api.github.com/users/maurizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maurizi/subscriptions","organizations_url":"https://api.github.com/users/maurizi/orgs","repos_url":"https://api.github.com/users/maurizi/repos","events_url":"https://api.github.com/users/maurizi/events{/privacy}","received_events_url":"https://api.github.com/users/maurizi/received_events","type":"User","site_admin":false},"repo":{"id":128999678,"name":"cac-tripplanner-android","full_name":"maurizi/cac-tripplanner-android","owner":{"login":"maurizi","id":4432106,"avatar_url":"https://avatars3.githubusercontent.com/u/4432106?v=4","gravatar_id":"","url":"https://api.github.com/users/maurizi","html_url":"https://github.com/maurizi","followers_url":"https://api.github.com/users/maurizi/followers","following_url":"https://api.github.com/users/maurizi/following{/other_user}","gists_url":"https://api.github.com/users/maurizi/gists{/gist_id}","starred_url":"https://api.github.com/users/maurizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maurizi/subscriptions","organizations_url":"https://api.github.com/users/maurizi/orgs","repos_url":"https://api.github.com/users/maurizi/repos","events_url":"https://api.github.com/users/maurizi/events{/privacy}","received_events_url":"https://api.github.com/users/maurizi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maurizi/cac-tripplanner-android","description":"GoPhillyGo Android app","fork":true,"url":"https://api.github.com/repos/maurizi/cac-tripplanner-android","forks_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/forks","keys_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/teams","hooks_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/hooks","issue_events_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/issues/events{/number}","events_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/events","assignees_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/assignees{/user}","branches_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/branches{/branch}","tags_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/tags","blobs_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/statuses/{sha}","languages_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/languages","stargazers_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/stargazers","contributors_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/contributors","subscribers_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/subscribers","subscription_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/subscription","commits_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/contents/{+path}","compare_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/merges","archive_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/downloads","issues_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/issues{/number}","pulls_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/pulls{/number}","milestones_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/milestones{/number}","notifications_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/labels{/name}","releases_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/releases{/id}","deployments_url":"https://api.github.com/repos/maurizi/cac-tripplanner-android/deployments","created_at":"2018-04-10T21:58:00Z","updated_at":"2018-04-10T21:58:02Z","pushed_at":"2018-04-11T18:18:09Z","git_url":"git://github.com/maurizi/cac-tripplanner-android.git","ssh_url":"git@github.com:maurizi/cac-tripplanner-android.git","clone_url":"https://github.com/maurizi/cac-tripplanner-android.git","svn_url":"https://github.com/maurizi/cac-tripplanner-android","homepage":"https://gophillygo.org","size":430,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"azavea:develop","ref":"develop","sha":"c0d5cb601f11f261ee183edd13f4ca2c36ce8a49","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars3.githubusercontent.com/u/595231?v=4","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":118955293,"name":"cac-tripplanner-android","full_name":"azavea/cac-tripplanner-android","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars3.githubusercontent.com/u/595231?v=4","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/cac-tripplanner-android","description":"GoPhillyGo Android app","fork":false,"url":"https://api.github.com/repos/azavea/cac-tripplanner-android","forks_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/forks","keys_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/teams","hooks_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/hooks","issue_events_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/events","assignees_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/tags","blobs_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/languages","stargazers_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/stargazers","contributors_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/contributors","subscribers_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/subscribers","subscription_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/subscription","commits_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/merges","archive_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/downloads","issues_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/labels{/name}","releases_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/releases{/id}","deployments_url":"https://api.github.com/repos/azavea/cac-tripplanner-android/deployments","created_at":"2018-01-25T19:04:35Z","updated_at":"2018-04-10T15:39:13Z","pushed_at":"2018-04-11T18:25:53Z","git_url":"git://github.com/azavea/cac-tripplanner-android.git","ssh_url":"git@github.com:azavea/cac-tripplanner-android.git","clone_url":"https://github.com/azavea/cac-tripplanner-android.git","svn_url":"https://github.com/azavea/cac-tripplanner-android","homepage":"https://gophillygo.org","size":400,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2,"open_issues":15,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36"},"html":{"href":"https://github.com/azavea/cac-tripplanner-android/pull/36"},"issue":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues/36"},"comments":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/azavea/cac-tripplanner-android/statuses/3eced7b581601991b114d3988e778babce11fe88"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"flibbertigibbet"}}