{"action":"created","comment":{"url":"https://api.github.com/repos/loomio/loomio/pulls/comments/37016955","id":37016955,"diff_hunk":"@@ -5,52 +5,57 @@ angular.module('loomioApp').controller 'DashboardPageController', ($rootScope, $\n \n   Records.votes.fetchMyRecentVotes()\n \n-  @perPage = 25\n+  @perPage = 50\n   @loaded =\n     show_all:           0\n     show_muted:         0\n-    show_proposals:     0\n     show_participating: 0\n \n+  @views =\n+    recent: {}\n+    groups: {}\n+\n   @timeframes =\n-    today:     { from: '1 second ago', to: '-10 year ago' }\n+    today:     { from: '1 second ago', to: '-10 year ago' } # into the future!\n     yesterday: { from: '1 day ago',    to: '1 second ago' }\n     thisweek:  { from: '1 week ago',   to: '1 day ago' }\n     thismonth: { from: '1 month ago',  to: '1 week ago' }\n     older:     { from: '3 month ago',  to: '1 month ago' }\n   @timeframeNames = _.map @timeframes, (timeframe, name) -> name\n-  @timeframeQueryFor = (name) -> @timeframes[name].view\n \n-  @groups = {}\n+  @recentViewNames = ['proposals', 'starred', 'today', 'yesterday', 'thisweek', 'thismonth', 'older']\n+\n   @groupThreadLimit = 5\n   @groups = -> CurrentUser.parentGroups()\n-  @groupName = (group) -> group.name\n-  @groupQueryFor = (group) -> @groups[group.key]\n-  @moreForThisGroup = (group) -> @groupQueryFor(group, { filter: @filter }).length() > @groupThreadLimit\n+  @moreForThisGroup = (group) -> @views.groups[group.key].length() > @groupThreadLimit\n \n   @displayByGroup = ->\n-    _.contains ['show_starred', 'show_muted'], @filter\n+    _.contains ['show_muted'], @filter\n \n-  @updateQueries = ->\n-    _.each @groups(), (group) =>\n-      @groups[group.key] = ThreadQueryService.groupQuery(group, { filter: @filter })\n-    _.each @timeframeNames, (name) =>\n-      @timeframes[name].view = ThreadQueryService.timeframeQuery\n-        name: name\n-        filter: @filter\n-        timeframe: @timeframes[name]\n+  @updateQueries = =>\n+    if @displayByGroup()\n+      _.each @groups(), (group) =>\n+        @views.groups[group.key] = ThreadQueryService.groupQuery(group, { filter: @filter, queryType: 'all' })\n+    else\n+      @views.recent.proposals = ThreadQueryService.filterQuery ['show_proposals', @filter], queryType: 'important'\n+      @views.recent.starred   = ThreadQueryService.filterQuery ['show_starred', 'hide_proposals', @filter], queryType: 'important'\n+      _.each @timeframeNames, (name) =>\n+        @views.recent[name] = ThreadQueryService.timeframeQuery\n+          name: name\n+          filter: @filter\n+          timeframe: @timeframes[name]\n \n   @loadMore = =>\n     from = @loaded[@filter]\n     @loaded[@filter] = @loaded[@filter] + @perPage\n \n-    Records.discussions.fetchDashboard\n+    Records.discussions.fetchDashboard(\n       filter: @filter\n       from:   from\n-      per:    @perPage\n+      per:    @perPage).then @updateQueries\n   LoadingService.applyLoadingFunction @, 'loadMore'\n \n-  @refresh = ->\n+  @refresh = =>\n     @updateQueries()","path":"lineman/app/components/dashboard_page/dashboard_page_controller.coffee","position":75,"original_position":75,"commit_id":"ebcd6b5a197ecd470470310055a68055be2909a6","original_commit_id":"ebcd6b5a197ecd470470310055a68055be2909a6","user":{"login":"robguthrie","id":486367,"avatar_url":"https://avatars.githubusercontent.com/u/486367?v=3","gravatar_id":"","url":"https://api.github.com/users/robguthrie","html_url":"https://github.com/robguthrie","followers_url":"https://api.github.com/users/robguthrie/followers","following_url":"https://api.github.com/users/robguthrie/following{/other_user}","gists_url":"https://api.github.com/users/robguthrie/gists{/gist_id}","starred_url":"https://api.github.com/users/robguthrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robguthrie/subscriptions","organizations_url":"https://api.github.com/users/robguthrie/orgs","repos_url":"https://api.github.com/users/robguthrie/repos","events_url":"https://api.github.com/users/robguthrie/events{/privacy}","received_events_url":"https://api.github.com/users/robguthrie/received_events","type":"User","site_admin":false},"body":"Hey James, just looking back over this. It's a really awesome piece of work. \r\n\r\nSo I keep wondering when a bug is going to come up with how we update records. \r\nLokiJS has this `update(obj)` function [docs](http://lokijs.org/#/docs) which it looks like you're supposed to call to tell it to rebuild indexes and views.\r\n\r\nSo I wonder if you have to call updateQueries() here because we're failing to tell Loki that we've updated a record earlier on. \r\n\r\nDo you feel like that is the case, or is something else going on here?","created_at":"2015-08-13T19:45:26Z","updated_at":"2015-08-13T19:45:26Z","html_url":"https://github.com/loomio/loomio/pull/2369#discussion_r37016955","pull_request_url":"https://api.github.com/repos/loomio/loomio/pulls/2369","_links":{"self":{"href":"https://api.github.com/repos/loomio/loomio/pulls/comments/37016955"},"html":{"href":"https://github.com/loomio/loomio/pull/2369#discussion_r37016955"},"pull_request":{"href":"https://api.github.com/repos/loomio/loomio/pulls/2369"}}},"pull_request":{"url":"https://api.github.com/repos/loomio/loomio/pulls/2369","id":41439916,"html_url":"https://github.com/loomio/loomio/pull/2369","diff_url":"https://github.com/loomio/loomio/pull/2369.diff","patch_url":"https://github.com/loomio/loomio/pull/2369.patch","issue_url":"https://api.github.com/repos/loomio/loomio/issues/2369","number":2369,"state":"open","locked":false,"title":"Dashboard shuffle (not for merging yet)","user":{"login":"gdpelican","id":750477,"avatar_url":"https://avatars.githubusercontent.com/u/750477?v=3","gravatar_id":"","url":"https://api.github.com/users/gdpelican","html_url":"https://github.com/gdpelican","followers_url":"https://api.github.com/users/gdpelican/followers","following_url":"https://api.github.com/users/gdpelican/following{/other_user}","gists_url":"https://api.github.com/users/gdpelican/gists{/gist_id}","starred_url":"https://api.github.com/users/gdpelican/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdpelican/subscriptions","organizations_url":"https://api.github.com/users/gdpelican/orgs","repos_url":"https://api.github.com/users/gdpelican/repos","events_url":"https://api.github.com/users/gdpelican/events{/privacy}","received_events_url":"https://api.github.com/users/gdpelican/received_events","type":"User","site_admin":false},"body":"Alright, this is ready for a look I think.\r\n\r\nNotable things that are still bad at the moment:\r\n\r\n- Visit inbox, then visit dashboard. No starred / proposal threads. Hit the 'recent' button again. Starred / proposal threads show up. Weep softly. (EDIT: fixed this, which takes me from `weep` to `wee!`)\r\n- The muted e2e is failing for me because it's saying no muted threads are found. Works perfectly for the participating e2e (which is activated the same way), and works fine manually in the browser. Sigh.\r\n- Need some optimization work on the dashboard query, I think because the discussion_serializer is loading up an author, group, and motion for each of 50 discussions.\r\n","created_at":"2015-08-03T07:06:23Z","updated_at":"2015-08-13T19:45:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7cca200ec796b4ee4314588924067c0ac674d75","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/loomio/loomio/pulls/2369/commits","review_comments_url":"https://api.github.com/repos/loomio/loomio/pulls/2369/comments","review_comment_url":"https://api.github.com/repos/loomio/loomio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/loomio/loomio/issues/2369/comments","statuses_url":"https://api.github.com/repos/loomio/loomio/statuses/ebcd6b5a197ecd470470310055a68055be2909a6","head":{"label":"loomio:dashboard-shuffle","ref":"dashboard-shuffle","sha":"ebcd6b5a197ecd470470310055a68055be2909a6","user":{"login":"loomio","id":1896739,"avatar_url":"https://avatars.githubusercontent.com/u/1896739?v=3","gravatar_id":"","url":"https://api.github.com/users/loomio","html_url":"https://github.com/loomio","followers_url":"https://api.github.com/users/loomio/followers","following_url":"https://api.github.com/users/loomio/following{/other_user}","gists_url":"https://api.github.com/users/loomio/gists{/gist_id}","starred_url":"https://api.github.com/users/loomio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loomio/subscriptions","organizations_url":"https://api.github.com/users/loomio/orgs","repos_url":"https://api.github.com/users/loomio/repos","events_url":"https://api.github.com/users/loomio/events{/privacy}","received_events_url":"https://api.github.com/users/loomio/received_events","type":"Organization","site_admin":false},"repo":{"id":2731301,"name":"loomio","full_name":"loomio/loomio","owner":{"login":"loomio","id":1896739,"avatar_url":"https://avatars.githubusercontent.com/u/1896739?v=3","gravatar_id":"","url":"https://api.github.com/users/loomio","html_url":"https://github.com/loomio","followers_url":"https://api.github.com/users/loomio/followers","following_url":"https://api.github.com/users/loomio/following{/other_user}","gists_url":"https://api.github.com/users/loomio/gists{/gist_id}","starred_url":"https://api.github.com/users/loomio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loomio/subscriptions","organizations_url":"https://api.github.com/users/loomio/orgs","repos_url":"https://api.github.com/users/loomio/repos","events_url":"https://api.github.com/users/loomio/events{/privacy}","received_events_url":"https://api.github.com/users/loomio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/loomio/loomio","description":"Loomio is an open-source web application that helps groups make better decisions together.","fork":false,"url":"https://api.github.com/repos/loomio/loomio","forks_url":"https://api.github.com/repos/loomio/loomio/forks","keys_url":"https://api.github.com/repos/loomio/loomio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/loomio/loomio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/loomio/loomio/teams","hooks_url":"https://api.github.com/repos/loomio/loomio/hooks","issue_events_url":"https://api.github.com/repos/loomio/loomio/issues/events{/number}","events_url":"https://api.github.com/repos/loomio/loomio/events","assignees_url":"https://api.github.com/repos/loomio/loomio/assignees{/user}","branches_url":"https://api.github.com/repos/loomio/loomio/branches{/branch}","tags_url":"https://api.github.com/repos/loomio/loomio/tags","blobs_url":"https://api.github.com/repos/loomio/loomio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/loomio/loomio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/loomio/loomio/git/refs{/sha}","trees_url":"https://api.github.com/repos/loomio/loomio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/loomio/loomio/statuses/{sha}","languages_url":"https://api.github.com/repos/loomio/loomio/languages","stargazers_url":"https://api.github.com/repos/loomio/loomio/stargazers","contributors_url":"https://api.github.com/repos/loomio/loomio/contributors","subscribers_url":"https://api.github.com/repos/loomio/loomio/subscribers","subscription_url":"https://api.github.com/repos/loomio/loomio/subscription","commits_url":"https://api.github.com/repos/loomio/loomio/commits{/sha}","git_commits_url":"https://api.github.com/repos/loomio/loomio/git/commits{/sha}","comments_url":"https://api.github.com/repos/loomio/loomio/comments{/number}","issue_comment_url":"https://api.github.com/repos/loomio/loomio/issues/comments{/number}","contents_url":"https://api.github.com/repos/loomio/loomio/contents/{+path}","compare_url":"https://api.github.com/repos/loomio/loomio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/loomio/loomio/merges","archive_url":"https://api.github.com/repos/loomio/loomio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/loomio/loomio/downloads","issues_url":"https://api.github.com/repos/loomio/loomio/issues{/number}","pulls_url":"https://api.github.com/repos/loomio/loomio/pulls{/number}","milestones_url":"https://api.github.com/repos/loomio/loomio/milestones{/number}","notifications_url":"https://api.github.com/repos/loomio/loomio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/loomio/loomio/labels{/name}","releases_url":"https://api.github.com/repos/loomio/loomio/releases{/id}","created_at":"2011-11-08T03:27:12Z","updated_at":"2015-08-13T15:57:16Z","pushed_at":"2015-08-13T19:13:59Z","git_url":"git://github.com/loomio/loomio.git","ssh_url":"git@github.com:loomio/loomio.git","clone_url":"https://github.com/loomio/loomio.git","svn_url":"https://github.com/loomio/loomio","homepage":"www.loomio.org","size":163635,"stargazers_count":964,"watchers_count":964,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":320,"mirror_url":null,"open_issues_count":79,"forks":320,"open_issues":79,"watchers":964,"default_branch":"master"}},"base":{"label":"loomio:master","ref":"master","sha":"f959838dafb483d05a72815a7b3b9a90ab1866be","user":{"login":"loomio","id":1896739,"avatar_url":"https://avatars.githubusercontent.com/u/1896739?v=3","gravatar_id":"","url":"https://api.github.com/users/loomio","html_url":"https://github.com/loomio","followers_url":"https://api.github.com/users/loomio/followers","following_url":"https://api.github.com/users/loomio/following{/other_user}","gists_url":"https://api.github.com/users/loomio/gists{/gist_id}","starred_url":"https://api.github.com/users/loomio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loomio/subscriptions","organizations_url":"https://api.github.com/users/loomio/orgs","repos_url":"https://api.github.com/users/loomio/repos","events_url":"https://api.github.com/users/loomio/events{/privacy}","received_events_url":"https://api.github.com/users/loomio/received_events","type":"Organization","site_admin":false},"repo":{"id":2731301,"name":"loomio","full_name":"loomio/loomio","owner":{"login":"loomio","id":1896739,"avatar_url":"https://avatars.githubusercontent.com/u/1896739?v=3","gravatar_id":"","url":"https://api.github.com/users/loomio","html_url":"https://github.com/loomio","followers_url":"https://api.github.com/users/loomio/followers","following_url":"https://api.github.com/users/loomio/following{/other_user}","gists_url":"https://api.github.com/users/loomio/gists{/gist_id}","starred_url":"https://api.github.com/users/loomio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loomio/subscriptions","organizations_url":"https://api.github.com/users/loomio/orgs","repos_url":"https://api.github.com/users/loomio/repos","events_url":"https://api.github.com/users/loomio/events{/privacy}","received_events_url":"https://api.github.com/users/loomio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/loomio/loomio","description":"Loomio is an open-source web application that helps groups make better decisions together.","fork":false,"url":"https://api.github.com/repos/loomio/loomio","forks_url":"https://api.github.com/repos/loomio/loomio/forks","keys_url":"https://api.github.com/repos/loomio/loomio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/loomio/loomio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/loomio/loomio/teams","hooks_url":"https://api.github.com/repos/loomio/loomio/hooks","issue_events_url":"https://api.github.com/repos/loomio/loomio/issues/events{/number}","events_url":"https://api.github.com/repos/loomio/loomio/events","assignees_url":"https://api.github.com/repos/loomio/loomio/assignees{/user}","branches_url":"https://api.github.com/repos/loomio/loomio/branches{/branch}","tags_url":"https://api.github.com/repos/loomio/loomio/tags","blobs_url":"https://api.github.com/repos/loomio/loomio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/loomio/loomio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/loomio/loomio/git/refs{/sha}","trees_url":"https://api.github.com/repos/loomio/loomio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/loomio/loomio/statuses/{sha}","languages_url":"https://api.github.com/repos/loomio/loomio/languages","stargazers_url":"https://api.github.com/repos/loomio/loomio/stargazers","contributors_url":"https://api.github.com/repos/loomio/loomio/contributors","subscribers_url":"https://api.github.com/repos/loomio/loomio/subscribers","subscription_url":"https://api.github.com/repos/loomio/loomio/subscription","commits_url":"https://api.github.com/repos/loomio/loomio/commits{/sha}","git_commits_url":"https://api.github.com/repos/loomio/loomio/git/commits{/sha}","comments_url":"https://api.github.com/repos/loomio/loomio/comments{/number}","issue_comment_url":"https://api.github.com/repos/loomio/loomio/issues/comments{/number}","contents_url":"https://api.github.com/repos/loomio/loomio/contents/{+path}","compare_url":"https://api.github.com/repos/loomio/loomio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/loomio/loomio/merges","archive_url":"https://api.github.com/repos/loomio/loomio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/loomio/loomio/downloads","issues_url":"https://api.github.com/repos/loomio/loomio/issues{/number}","pulls_url":"https://api.github.com/repos/loomio/loomio/pulls{/number}","milestones_url":"https://api.github.com/repos/loomio/loomio/milestones{/number}","notifications_url":"https://api.github.com/repos/loomio/loomio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/loomio/loomio/labels{/name}","releases_url":"https://api.github.com/repos/loomio/loomio/releases{/id}","created_at":"2011-11-08T03:27:12Z","updated_at":"2015-08-13T15:57:16Z","pushed_at":"2015-08-13T19:13:59Z","git_url":"git://github.com/loomio/loomio.git","ssh_url":"git@github.com:loomio/loomio.git","clone_url":"https://github.com/loomio/loomio.git","svn_url":"https://github.com/loomio/loomio","homepage":"www.loomio.org","size":163635,"stargazers_count":964,"watchers_count":964,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":320,"mirror_url":null,"open_issues_count":79,"forks":320,"open_issues":79,"watchers":964,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/loomio/loomio/pulls/2369"},"html":{"href":"https://github.com/loomio/loomio/pull/2369"},"issue":{"href":"https://api.github.com/repos/loomio/loomio/issues/2369"},"comments":{"href":"https://api.github.com/repos/loomio/loomio/issues/2369/comments"},"review_comments":{"href":"https://api.github.com/repos/loomio/loomio/pulls/2369/comments"},"review_comment":{"href":"https://api.github.com/repos/loomio/loomio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/loomio/loomio/pulls/2369/commits"},"statuses":{"href":"https://api.github.com/repos/loomio/loomio/statuses/ebcd6b5a197ecd470470310055a68055be2909a6"}}}}