{"action":"reopened","issue":{"url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/97","repository_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend","labels_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/97/comments","events_url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/issues/97/events","html_url":"https://github.com/goodjoblife/WorkTimeSurvey-backend/issues/97","id":174049884,"number":97,"title":"[2] 以職稱搜尋工時資訊 後端API   (Statistics by job_title)","user":{"login":"barry800414","id":3805975,"avatar_url":"https://avatars.githubusercontent.com/u/3805975?v=3","gravatar_id":"","url":"https://api.github.com/users/barry800414","html_url":"https://github.com/barry800414","followers_url":"https://api.github.com/users/barry800414/followers","following_url":"https://api.github.com/users/barry800414/following{/other_user}","gists_url":"https://api.github.com/users/barry800414/gists{/gist_id}","starred_url":"https://api.github.com/users/barry800414/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barry800414/subscriptions","organizations_url":"https://api.github.com/users/barry800414/orgs","repos_url":"https://api.github.com/users/barry800414/repos","events_url":"https://api.github.com/users/barry800414/events{/privacy}","received_events_url":"https://api.github.com/users/barry800414/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/goodjoblife/WorkTimeSurvey-backend/labels/ready%20to%20do","name":"ready to do","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"LittleWhiteYA","id":11289529,"avatar_url":"https://avatars.githubusercontent.com/u/11289529?v=3","gravatar_id":"","url":"https://api.github.com/users/LittleWhiteYA","html_url":"https://github.com/LittleWhiteYA","followers_url":"https://api.github.com/users/LittleWhiteYA/followers","following_url":"https://api.github.com/users/LittleWhiteYA/following{/other_user}","gists_url":"https://api.github.com/users/LittleWhiteYA/gists{/gist_id}","starred_url":"https://api.github.com/users/LittleWhiteYA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LittleWhiteYA/subscriptions","organizations_url":"https://api.github.com/users/LittleWhiteYA/orgs","repos_url":"https://api.github.com/users/LittleWhiteYA/repos","events_url":"https://api.github.com/users/LittleWhiteYA/events{/privacy}","received_events_url":"https://api.github.com/users/LittleWhiteYA/received_events","type":"User","site_admin":false},"assignees":[{"login":"LittleWhiteYA","id":11289529,"avatar_url":"https://avatars.githubusercontent.com/u/11289529?v=3","gravatar_id":"","url":"https://api.github.com/users/LittleWhiteYA","html_url":"https://github.com/LittleWhiteYA","followers_url":"https://api.github.com/users/LittleWhiteYA/followers","following_url":"https://api.github.com/users/LittleWhiteYA/following{/other_user}","gists_url":"https://api.github.com/users/LittleWhiteYA/gists{/gist_id}","starred_url":"https://api.github.com/users/LittleWhiteYA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LittleWhiteYA/subscriptions","organizations_url":"https://api.github.com/users/LittleWhiteYA/orgs","repos_url":"https://api.github.com/users/LittleWhiteYA/repos","events_url":"https://api.github.com/users/LittleWhiteYA/events{/privacy}","received_events_url":"https://api.github.com/users/LittleWhiteYA/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2016-08-30T15:25:44Z","updated_at":"2016-09-02T07:56:08Z","closed_at":null,"body":"跟目前網站上「以公司搜尋」的方法類似，我們需要「以職稱搜尋」的版本\r\n請先看 #72 \r\n\r\n詳細說明:\r\ninput: <code>query</code>\r\noutput:\r\n1. 搜尋所有job_title為 \"%query%\"的工時資訊\r\n2. 這些資訊根據job_title先group一次，每一個group的資料不會互相影響\r\n3. 每一個group再根據公司名稱去統計平均工時\r\n詳細格式請見sample input & ouput\r\n\r\n\r\n### Sample input & output:\r\n```\r\ndata = [\r\n    { 'job_title': 'ABC' , company: {'name': 'DD'}, 'week_work_time': 40 },\r\n    { 'job_title': 'BC' , company: {'name': 'DD'}, 'week_work_time': 50 },\r\n    { 'job_title': 'ABC' , company: {'name': 'DD'}, 'week_work_time': 60 },\r\n    { 'job_title': 'ABC' , company: {'name': 'EE'}, 'week_work_time': 40 },\r\n    { 'job_title': 'BC' , company: {'name': 'EE'}, 'week_work_time': 60 },\r\n    { 'job_title': 'ABC' , company: {'name': 'EE'}, 'week_work_time': 50 },\r\n]\r\n```\r\n```\r\ninput = 'BC'\r\noutput = [\r\n    //group by job_title\r\n    { \r\n        '_id': { 'job_title': 'ABC' },\r\n        'companies': [\r\n        //group by company name\r\n        {\r\n            \"_id\": \"DD\",\r\n            \"week_work_times\": [\r\n                  40,\r\n                  60\r\n            ],\r\n            \"average_week_work_time\": 50,\r\n            \"count\": 2\r\n        },\r\n        {\r\n            \"_id\": \"EE\",\r\n            \"week_work_times\": [\r\n                  40,\r\n                  50\r\n            ],\r\n            \"average_week_work_time\": 45,\r\n            \"count\": 2\r\n        }\r\n     },\r\n     { \r\n        '_id': { 'job_title': 'BC' },\r\n        'companies': [\r\n        //group by company name\r\n        {\r\n            \"_id\": \"DD\",\r\n            \"week_work_times\": [\r\n                  50\r\n            ],\r\n            \"average_week_work_time\": 50,\r\n            \"count\": 1\r\n        },\r\n        {\r\n            \"_id\": \"EE\",\r\n            \"week_work_times\": [\r\n                  60\r\n            ],\r\n            \"average_week_work_time\": 60,\r\n            \"count\": 1\r\n        }\r\n     },\r\n]\r\n```\r\n"}}
{"actor":{"display_login":"mark86092"}}