{"action":"created","issue":{"url":"https://api.github.com/repos/dinhtienthuan/mbs/issues/9","labels_url":"https://api.github.com/repos/dinhtienthuan/mbs/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/dinhtienthuan/mbs/issues/9/comments","events_url":"https://api.github.com/repos/dinhtienthuan/mbs/issues/9/events","html_url":"https://github.com/dinhtienthuan/mbs/issues/9","id":56991800,"number":9,"title":"#9 Create homepage for user (not admin)","user":{"login":"dinhtienthuan","id":6536554,"avatar_url":"https://avatars.githubusercontent.com/u/6536554?v=3","gravatar_id":"","url":"https://api.github.com/users/dinhtienthuan","html_url":"https://github.com/dinhtienthuan","followers_url":"https://api.github.com/users/dinhtienthuan/followers","following_url":"https://api.github.com/users/dinhtienthuan/following{/other_user}","gists_url":"https://api.github.com/users/dinhtienthuan/gists{/gist_id}","starred_url":"https://api.github.com/users/dinhtienthuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinhtienthuan/subscriptions","organizations_url":"https://api.github.com/users/dinhtienthuan/orgs","repos_url":"https://api.github.com/users/dinhtienthuan/repos","events_url":"https://api.github.com/users/dinhtienthuan/events{/privacy}","received_events_url":"https://api.github.com/users/dinhtienthuan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dinhtienthuan/mbs/labels/new%20feature","name":"new feature","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"dinhtienthuan","id":6536554,"avatar_url":"https://avatars.githubusercontent.com/u/6536554?v=3","gravatar_id":"","url":"https://api.github.com/users/dinhtienthuan","html_url":"https://github.com/dinhtienthuan","followers_url":"https://api.github.com/users/dinhtienthuan/followers","following_url":"https://api.github.com/users/dinhtienthuan/following{/other_user}","gists_url":"https://api.github.com/users/dinhtienthuan/gists{/gist_id}","starred_url":"https://api.github.com/users/dinhtienthuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinhtienthuan/subscriptions","organizations_url":"https://api.github.com/users/dinhtienthuan/orgs","repos_url":"https://api.github.com/users/dinhtienthuan/repos","events_url":"https://api.github.com/users/dinhtienthuan/events{/privacy}","received_events_url":"https://api.github.com/users/dinhtienthuan/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-02-09T05:52:41Z","updated_at":"2015-02-11T12:35:45Z","closed_at":null,"body":"Create homepage for user has some information such as:\r\n- Navigation\r\n- Quick menu (go to another menu quickly)\r\n- A list of food (menu): an image and number of ordered number on each item on the current day"},"comment":{"url":"https://api.github.com/repos/dinhtienthuan/mbs/issues/comments/73874348","html_url":"https://github.com/dinhtienthuan/mbs/issues/9#issuecomment-73874348","issue_url":"https://api.github.com/repos/dinhtienthuan/mbs/issues/9","id":73874348,"user":{"login":"dinhtienthuan","id":6536554,"avatar_url":"https://avatars.githubusercontent.com/u/6536554?v=3","gravatar_id":"","url":"https://api.github.com/users/dinhtienthuan","html_url":"https://github.com/dinhtienthuan","followers_url":"https://api.github.com/users/dinhtienthuan/followers","following_url":"https://api.github.com/users/dinhtienthuan/following{/other_user}","gists_url":"https://api.github.com/users/dinhtienthuan/gists{/gist_id}","starred_url":"https://api.github.com/users/dinhtienthuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinhtienthuan/subscriptions","organizations_url":"https://api.github.com/users/dinhtienthuan/orgs","repos_url":"https://api.github.com/users/dinhtienthuan/repos","events_url":"https://api.github.com/users/dinhtienthuan/events{/privacy}","received_events_url":"https://api.github.com/users/dinhtienthuan/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T12:35:45Z","updated_at":"2015-02-11T12:35:45Z","body":"31d71b11048f25057988d6f891c3715697bc7ad4\r\nModified the query as the following (using native mysql):\r\n```SQL\r\nSELECT \r\n    m.id,\r\n    m.name,\r\n    m.image,\r\n    CASE\r\n        WHEN om.serving_date IS NULL THEN 0\r\n        ELSE COUNT(m.id)\r\n    END\r\nFROM\r\n    (SELECT \r\n        *\r\n    FROM\r\n        ordered_meals\r\n    WHERE\r\n        serving_date = DATE_FORMAT(:servingDate, '%Y-%m-%D')) om\r\n        RIGHT OUTER JOIN\r\n    meals m ON m.id = om.meal_id\r\nGROUP BY m.id , om.serving_date\r\nORDER BY m.id , om.serving_date;\r\n```\r\nNeed to check again, but I think it's OK.\r\nThe following is a screen shot from result when used the above query.\r\n![selection_006](https://cloud.githubusercontent.com/assets/6536554/6146950/fd5c3b62-b224-11e4-8f30-8c6a3996361c.png)\r\n"}}