{"action":"created","issue":{"url":"https://api.github.com/repos/Trustroots/trustroots/issues/448","repository_url":"https://api.github.com/repos/Trustroots/trustroots","labels_url":"https://api.github.com/repos/Trustroots/trustroots/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/Trustroots/trustroots/issues/448/comments","events_url":"https://api.github.com/repos/Trustroots/trustroots/issues/448/events","html_url":"https://github.com/Trustroots/trustroots/pull/448","id":189000620,"number":448,"title":"[WIP] Count user's reply statistics","user":{"login":"mrkvon","id":7449720,"avatar_url":"https://avatars.githubusercontent.com/u/7449720?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkvon","html_url":"https://github.com/mrkvon","followers_url":"https://api.github.com/users/mrkvon/followers","following_url":"https://api.github.com/users/mrkvon/following{/other_user}","gists_url":"https://api.github.com/users/mrkvon/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkvon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkvon/subscriptions","organizations_url":"https://api.github.com/users/mrkvon/orgs","repos_url":"https://api.github.com/users/mrkvon/repos","events_url":"https://api.github.com/users/mrkvon/events{/privacy}","received_events_url":"https://api.github.com/users/mrkvon/received_events","type":"User","site_admin":false},"labels":[{"id":245256340,"url":"https://api.github.com/repos/Trustroots/trustroots/labels/2%20-%20in%20progress","name":"2 - in progress","color":"ededed","default":false},{"id":198478734,"url":"https://api.github.com/repos/Trustroots/trustroots/labels/Module:Messages","name":"Module:Messages","color":"ffffff","default":false},{"id":198478784,"url":"https://api.github.com/repos/Trustroots/trustroots/labels/Module:Users","name":"Module:Users","color":"ffffff","default":false}],"state":"open","locked":false,"assignee":{"login":"simison","id":87168,"avatar_url":"https://avatars.githubusercontent.com/u/87168?v=3","gravatar_id":"","url":"https://api.github.com/users/simison","html_url":"https://github.com/simison","followers_url":"https://api.github.com/users/simison/followers","following_url":"https://api.github.com/users/simison/following{/other_user}","gists_url":"https://api.github.com/users/simison/gists{/gist_id}","starred_url":"https://api.github.com/users/simison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simison/subscriptions","organizations_url":"https://api.github.com/users/simison/orgs","repos_url":"https://api.github.com/users/simison/repos","events_url":"https://api.github.com/users/simison/events{/privacy}","received_events_url":"https://api.github.com/users/simison/received_events","type":"User","site_admin":false},"assignees":[{"login":"simison","id":87168,"avatar_url":"https://avatars.githubusercontent.com/u/87168?v=3","gravatar_id":"","url":"https://api.github.com/users/simison","html_url":"https://github.com/simison","followers_url":"https://api.github.com/users/simison/followers","following_url":"https://api.github.com/users/simison/following{/other_user}","gists_url":"https://api.github.com/users/simison/gists{/gist_id}","starred_url":"https://api.github.com/users/simison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simison/subscriptions","organizations_url":"https://api.github.com/users/simison/orgs","repos_url":"https://api.github.com/users/simison/repos","events_url":"https://api.github.com/users/simison/events{/privacy}","received_events_url":"https://api.github.com/users/simison/received_events","type":"User","site_admin":false},{"login":"mrkvon","id":7449720,"avatar_url":"https://avatars.githubusercontent.com/u/7449720?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkvon","html_url":"https://github.com/mrkvon","followers_url":"https://api.github.com/users/mrkvon/followers","following_url":"https://api.github.com/users/mrkvon/following{/other_user}","gists_url":"https://api.github.com/users/mrkvon/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkvon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkvon/subscriptions","organizations_url":"https://api.github.com/users/mrkvon/orgs","repos_url":"https://api.github.com/users/mrkvon/repos","events_url":"https://api.github.com/users/mrkvon/events{/privacy}","received_events_url":"https://api.github.com/users/mrkvon/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Trustroots/trustroots/milestones/4","html_url":"https://github.com/Trustroots/trustroots/milestones/next%20up","labels_url":"https://api.github.com/repos/Trustroots/trustroots/milestones/4/labels","id":915939,"number":4,"title":"next up","description":"please update due date when/if needed/wanted :)","creator":{"login":"guaka","id":54728,"avatar_url":"https://avatars.githubusercontent.com/u/54728?v=3","gravatar_id":"","url":"https://api.github.com/users/guaka","html_url":"https://github.com/guaka","followers_url":"https://api.github.com/users/guaka/followers","following_url":"https://api.github.com/users/guaka/following{/other_user}","gists_url":"https://api.github.com/users/guaka/gists{/gist_id}","starred_url":"https://api.github.com/users/guaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guaka/subscriptions","organizations_url":"https://api.github.com/users/guaka/orgs","repos_url":"https://api.github.com/users/guaka/repos","events_url":"https://api.github.com/users/guaka/events{/privacy}","received_events_url":"https://api.github.com/users/guaka/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":119,"state":"open","created_at":"2014-12-28T02:10:25Z","updated_at":"2016-11-21T17:54:34Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-11-13T22:39:59Z","updated_at":"2016-11-21T23:44:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Trustroots/trustroots/pulls/448","html_url":"https://github.com/Trustroots/trustroots/pull/448","diff_url":"https://github.com/Trustroots/trustroots/pull/448.diff","patch_url":"https://github.com/Trustroots/trustroots/pull/448.patch"},"body":"Counting the reply rate and reply time statistics of a user based on `MessageStat` documents of #436.\r\n\r\nThis work is done on top of #436. That should be merged first.\r\n\r\n### Overview:\r\n\r\nFor brevity we define age of `MessageStat` as a value of its `firstMessageCreated` property.\r\n\r\n1. Provided `userId` and arbitrary `timeNow` (timestamp) we search database for `messageStats` which are between `timeNow` and `timeNow - 90 days` old (`messageStats` of the user within last 3 months)\r\n2. We choose subset of the `messageStats` found:\r\n  - if we found less than 10 `messageStats`, choose all of them\r\n  - else if some of the youngest 10 `messageStats` are older than 30 days, choose the 10 youngest `messageStats`\r\n  - else choose `messageStats` which are younger than 30 days (counted from `timeNow`)\r\n3. Based on the chosen subset above, we count the `replyRate` and `replyTime` of the user\r\n  - if the subset is empty, `replyRate` and `replyTime` should be `null`\r\n  - if there are no replied `messageStats`, `replyRate` should be `0` and `replyTime` `null`\r\n  - if there are some replied `messageStats`, `replyRate` should be `0 - 1` (replied / all messages), `replyTime` should be average (mean) of `timeToFirstReply` of the replied `messageStats` (milliseconds)\r\n\r\n### TODO\r\n\r\n- [x] write a service which converts replyTime to text (i.e. 23 hours => \"within 1 day\")\r\n- [x] integrate the whole thing to the user profile routes\r\n- [x] display the statistics in client in user's profile\r\n- [ ] comment, review and improve the code\r\n- [ ] make sure it doesn't significantly slow down the displaying of profiles\r\n- [x] think about indexes, how smart introducing of indexes could improve performance"},"comment":{"url":"https://api.github.com/repos/Trustroots/trustroots/issues/comments/262103734","html_url":"https://github.com/Trustroots/trustroots/pull/448#issuecomment-262103734","issue_url":"https://api.github.com/repos/Trustroots/trustroots/issues/448","id":262103734,"user":{"login":"mrkvon","id":7449720,"avatar_url":"https://avatars.githubusercontent.com/u/7449720?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkvon","html_url":"https://github.com/mrkvon","followers_url":"https://api.github.com/users/mrkvon/followers","following_url":"https://api.github.com/users/mrkvon/following{/other_user}","gists_url":"https://api.github.com/users/mrkvon/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkvon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkvon/subscriptions","organizations_url":"https://api.github.com/users/mrkvon/orgs","repos_url":"https://api.github.com/users/mrkvon/repos","events_url":"https://api.github.com/users/mrkvon/events{/privacy}","received_events_url":"https://api.github.com/users/mrkvon/received_events","type":"User","site_admin":false},"created_at":"2016-11-21T23:44:43Z","updated_at":"2016-11-21T23:44:43Z","body":"@simison \r\ni reviewed the code now. I think to get any further i would need new points of view. Generally it should be ok and working.\r\n\r\nThere still is the very low probability of creating duplicate `MessageStats` (per `Thread`) as described above, but that may not be a big issue. The possible effects of that would not do any harm probably."}}
{"actor":{"display_login":"mrkvon"}}