{"action":"created","issue":{"url":"https://api.github.com/repos/metabase/metabase/issues/1646","labels_url":"https://api.github.com/repos/metabase/metabase/issues/1646/labels{/name}","comments_url":"https://api.github.com/repos/metabase/metabase/issues/1646/comments","events_url":"https://api.github.com/repos/metabase/metabase/issues/1646/events","html_url":"https://github.com/metabase/metabase/pull/1646","id":120857658,"number":1646,"title":"patch-v0.13.1","user":{"login":"tlrobinson","id":18193,"avatar_url":"https://avatars.githubusercontent.com/u/18193?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrobinson","html_url":"https://github.com/tlrobinson","followers_url":"https://api.github.com/users/tlrobinson/followers","following_url":"https://api.github.com/users/tlrobinson/following{/other_user}","gists_url":"https://api.github.com/users/tlrobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrobinson/subscriptions","organizations_url":"https://api.github.com/users/tlrobinson/orgs","repos_url":"https://api.github.com/users/tlrobinson/repos","events_url":"https://api.github.com/users/tlrobinson/events{/privacy}","received_events_url":"https://api.github.com/users/tlrobinson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-12-07T20:14:10Z","updated_at":"2015-12-08T20:11:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/metabase/metabase/pulls/1646","html_url":"https://github.com/metabase/metabase/pull/1646","diff_url":"https://github.com/metabase/metabase/pull/1646.diff","patch_url":"https://github.com/metabase/metabase/pull/1646.patch"},"body":"- [x] Pulse test endpoint requires admin but is displayed to non-admins #1637\r\n- [x] Can't sort on grouping field #1641\r\n\r\nResolves #1637\r\nResolves #1641"},"comment":{"url":"https://api.github.com/repos/metabase/metabase/issues/comments/163001900","html_url":"https://github.com/metabase/metabase/pull/1646#issuecomment-163001900","issue_url":"https://api.github.com/repos/metabase/metabase/issues/1646","id":163001900,"user":{"login":"tlrobinson","id":18193,"avatar_url":"https://avatars.githubusercontent.com/u/18193?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrobinson","html_url":"https://github.com/tlrobinson","followers_url":"https://api.github.com/users/tlrobinson/followers","following_url":"https://api.github.com/users/tlrobinson/following{/other_user}","gists_url":"https://api.github.com/users/tlrobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrobinson/subscriptions","organizations_url":"https://api.github.com/users/tlrobinson/orgs","repos_url":"https://api.github.com/users/tlrobinson/repos","events_url":"https://api.github.com/users/tlrobinson/events{/privacy}","received_events_url":"https://api.github.com/users/tlrobinson/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T20:11:13Z","updated_at":"2015-12-08T20:11:13Z","body":"There's not enough information in the table view columns to get the sort clause right 100% of the time (no `fk->` info, `column.unit` is populated on date/time columns regardless of whether it was in the query), so in addition to doing my best to pick the sort correctly, in `cleanQuery` I'm now also matching sort clause target field IDs against the breakout (if a breakout is present) and replacing it with the actual breakout to ensure it's correct.\r\n\r\nThis seems to work for regular fields, `datetime_field`s, `fk->` fields, and any combination thereof. The only edge case I'm aware of is if you have two breakouts with the same target field, which is only possible if a table has 2 foreign keys to the same table and you breakout the same field in that table."}}