{"action":"created","comment":{"url":"https://api.github.com/repos/softwareatelier4/Group1/pulls/comments/112042422","pull_request_review_id":33327593,"id":112042422,"diff_hunk":"@@ -79,6 +79,28 @@ Freelance.pre('save', function (next) {\n \tnext();\n \n });\n+//call of asynchronous, parallel pre\n+// method 'validate' is not executed until done() is called.\n+// validate is also called for every update, not only save.\n+Freelance.pre('validate', true, function(next, done){\n+\tvar count = 0;\n+\tnext();\n+\tif (this.reviews.length == 0) done();\n+\tfor (var item of this.reviews){\n+\t\tReview.findById(item).exec((err, review)=>{\n+\t\t\tif (err) throw err;\n+\t\t\tif (review){\n+\t\t\t\tthis.avgScore += review.score;\n+\t\t\t\tcount++;\n+\t\t\t}\n+\t\t\tif (count >= this.reviews.length) { \n+\t\t\t\tthis.avgScore = Math.round(this.avgScore/this.reviews.length); // different possibilities for rounding: floor, ceil","path":"models/Freelance.js","position":51,"original_position":51,"commit_id":"9ad4d4f5aa3f7bea170c05df5f350057eac7ca8d","original_commit_id":"9ad4d4f5aa3f7bea170c05df5f350057eac7ca8d","user":{"login":"Shelyo","id":18555828,"avatar_url":"https://avatars3.githubusercontent.com/u/18555828?v=3","gravatar_id":"","url":"https://api.github.com/users/Shelyo","html_url":"https://github.com/Shelyo","followers_url":"https://api.github.com/users/Shelyo/followers","following_url":"https://api.github.com/users/Shelyo/following{/other_user}","gists_url":"https://api.github.com/users/Shelyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Shelyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shelyo/subscriptions","organizations_url":"https://api.github.com/users/Shelyo/orgs","repos_url":"https://api.github.com/users/Shelyo/repos","events_url":"https://api.github.com/users/Shelyo/events{/privacy}","received_events_url":"https://api.github.com/users/Shelyo/received_events","type":"User","site_admin":false},"body":"We should not round the score at all. I would suggest to leave maybe one or two decimal numbers for more precise scores.","created_at":"2017-04-18T19:27:48Z","updated_at":"2017-04-18T19:27:48Z","html_url":"https://github.com/softwareatelier4/Group1/pull/21#discussion_r112042422","pull_request_url":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/softwareatelier4/Group1/pulls/comments/112042422"},"html":{"href":"https://github.com/softwareatelier4/Group1/pull/21#discussion_r112042422"},"pull_request":{"href":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21","id":116340330,"html_url":"https://github.com/softwareatelier4/Group1/pull/21","diff_url":"https://github.com/softwareatelier4/Group1/pull/21.diff","patch_url":"https://github.com/softwareatelier4/Group1/pull/21.patch","issue_url":"https://api.github.com/repos/softwareatelier4/Group1/issues/21","number":21,"state":"open","locked":false,"title":"Feature/db","user":{"login":"CrashingBrain","id":23700285,"avatar_url":"https://avatars0.githubusercontent.com/u/23700285?v=3","gravatar_id":"","url":"https://api.github.com/users/CrashingBrain","html_url":"https://github.com/CrashingBrain","followers_url":"https://api.github.com/users/CrashingBrain/followers","following_url":"https://api.github.com/users/CrashingBrain/following{/other_user}","gists_url":"https://api.github.com/users/CrashingBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/CrashingBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrashingBrain/subscriptions","organizations_url":"https://api.github.com/users/CrashingBrain/orgs","repos_url":"https://api.github.com/users/CrashingBrain/repos","events_url":"https://api.github.com/users/CrashingBrain/events{/privacy}","received_events_url":"https://api.github.com/users/CrashingBrain/received_events","type":"User","site_admin":false},"body":"The tests are missing. \r\nImplemented:\r\n + User Model\r\n + Seed users\r\n + Freelance avgScore\r\n + Freelance 'state' field","created_at":"2017-04-18T14:26:38Z","updated_at":"2017-04-18T19:27:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1bcc715493eed980625232a332649cc9a19f228b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21/commits","review_comments_url":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21/comments","review_comment_url":"https://api.github.com/repos/softwareatelier4/Group1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/softwareatelier4/Group1/issues/21/comments","statuses_url":"https://api.github.com/repos/softwareatelier4/Group1/statuses/9ad4d4f5aa3f7bea170c05df5f350057eac7ca8d","head":{"label":"softwareatelier4:feature/DB","ref":"feature/DB","sha":"9ad4d4f5aa3f7bea170c05df5f350057eac7ca8d","user":{"login":"softwareatelier4","id":25958702,"avatar_url":"https://avatars0.githubusercontent.com/u/25958702?v=3","gravatar_id":"","url":"https://api.github.com/users/softwareatelier4","html_url":"https://github.com/softwareatelier4","followers_url":"https://api.github.com/users/softwareatelier4/followers","following_url":"https://api.github.com/users/softwareatelier4/following{/other_user}","gists_url":"https://api.github.com/users/softwareatelier4/gists{/gist_id}","starred_url":"https://api.github.com/users/softwareatelier4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwareatelier4/subscriptions","organizations_url":"https://api.github.com/users/softwareatelier4/orgs","repos_url":"https://api.github.com/users/softwareatelier4/repos","events_url":"https://api.github.com/users/softwareatelier4/events{/privacy}","received_events_url":"https://api.github.com/users/softwareatelier4/received_events","type":"User","site_admin":false},"repo":{"id":82818729,"name":"Group1","full_name":"softwareatelier4/Group1","owner":{"login":"softwareatelier4","id":25958702,"avatar_url":"https://avatars0.githubusercontent.com/u/25958702?v=3","gravatar_id":"","url":"https://api.github.com/users/softwareatelier4","html_url":"https://github.com/softwareatelier4","followers_url":"https://api.github.com/users/softwareatelier4/followers","following_url":"https://api.github.com/users/softwareatelier4/following{/other_user}","gists_url":"https://api.github.com/users/softwareatelier4/gists{/gist_id}","starred_url":"https://api.github.com/users/softwareatelier4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwareatelier4/subscriptions","organizations_url":"https://api.github.com/users/softwareatelier4/orgs","repos_url":"https://api.github.com/users/softwareatelier4/repos","events_url":"https://api.github.com/users/softwareatelier4/events{/privacy}","received_events_url":"https://api.github.com/users/softwareatelier4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/softwareatelier4/Group1","description":null,"fork":false,"url":"https://api.github.com/repos/softwareatelier4/Group1","forks_url":"https://api.github.com/repos/softwareatelier4/Group1/forks","keys_url":"https://api.github.com/repos/softwareatelier4/Group1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softwareatelier4/Group1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softwareatelier4/Group1/teams","hooks_url":"https://api.github.com/repos/softwareatelier4/Group1/hooks","issue_events_url":"https://api.github.com/repos/softwareatelier4/Group1/issues/events{/number}","events_url":"https://api.github.com/repos/softwareatelier4/Group1/events","assignees_url":"https://api.github.com/repos/softwareatelier4/Group1/assignees{/user}","branches_url":"https://api.github.com/repos/softwareatelier4/Group1/branches{/branch}","tags_url":"https://api.github.com/repos/softwareatelier4/Group1/tags","blobs_url":"https://api.github.com/repos/softwareatelier4/Group1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softwareatelier4/Group1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softwareatelier4/Group1/git/refs{/sha}","trees_url":"https://api.github.com/repos/softwareatelier4/Group1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softwareatelier4/Group1/statuses/{sha}","languages_url":"https://api.github.com/repos/softwareatelier4/Group1/languages","stargazers_url":"https://api.github.com/repos/softwareatelier4/Group1/stargazers","contributors_url":"https://api.github.com/repos/softwareatelier4/Group1/contributors","subscribers_url":"https://api.github.com/repos/softwareatelier4/Group1/subscribers","subscription_url":"https://api.github.com/repos/softwareatelier4/Group1/subscription","commits_url":"https://api.github.com/repos/softwareatelier4/Group1/commits{/sha}","git_commits_url":"https://api.github.com/repos/softwareatelier4/Group1/git/commits{/sha}","comments_url":"https://api.github.com/repos/softwareatelier4/Group1/comments{/number}","issue_comment_url":"https://api.github.com/repos/softwareatelier4/Group1/issues/comments{/number}","contents_url":"https://api.github.com/repos/softwareatelier4/Group1/contents/{+path}","compare_url":"https://api.github.com/repos/softwareatelier4/Group1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softwareatelier4/Group1/merges","archive_url":"https://api.github.com/repos/softwareatelier4/Group1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softwareatelier4/Group1/downloads","issues_url":"https://api.github.com/repos/softwareatelier4/Group1/issues{/number}","pulls_url":"https://api.github.com/repos/softwareatelier4/Group1/pulls{/number}","milestones_url":"https://api.github.com/repos/softwareatelier4/Group1/milestones{/number}","notifications_url":"https://api.github.com/repos/softwareatelier4/Group1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softwareatelier4/Group1/labels{/name}","releases_url":"https://api.github.com/repos/softwareatelier4/Group1/releases{/id}","deployments_url":"https://api.github.com/repos/softwareatelier4/Group1/deployments","created_at":"2017-02-22T15:14:36Z","updated_at":"2017-03-12T17:20:05Z","pushed_at":"2017-04-18T19:19:27Z","git_url":"git://github.com/softwareatelier4/Group1.git","ssh_url":"git@github.com:softwareatelier4/Group1.git","clone_url":"https://github.com/softwareatelier4/Group1.git","svn_url":"https://github.com/softwareatelier4/Group1","homepage":null,"size":36954,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"softwareatelier4:develop","ref":"develop","sha":"ace3893234f354c857c0268ae17f4a819974117a","user":{"login":"softwareatelier4","id":25958702,"avatar_url":"https://avatars0.githubusercontent.com/u/25958702?v=3","gravatar_id":"","url":"https://api.github.com/users/softwareatelier4","html_url":"https://github.com/softwareatelier4","followers_url":"https://api.github.com/users/softwareatelier4/followers","following_url":"https://api.github.com/users/softwareatelier4/following{/other_user}","gists_url":"https://api.github.com/users/softwareatelier4/gists{/gist_id}","starred_url":"https://api.github.com/users/softwareatelier4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwareatelier4/subscriptions","organizations_url":"https://api.github.com/users/softwareatelier4/orgs","repos_url":"https://api.github.com/users/softwareatelier4/repos","events_url":"https://api.github.com/users/softwareatelier4/events{/privacy}","received_events_url":"https://api.github.com/users/softwareatelier4/received_events","type":"User","site_admin":false},"repo":{"id":82818729,"name":"Group1","full_name":"softwareatelier4/Group1","owner":{"login":"softwareatelier4","id":25958702,"avatar_url":"https://avatars0.githubusercontent.com/u/25958702?v=3","gravatar_id":"","url":"https://api.github.com/users/softwareatelier4","html_url":"https://github.com/softwareatelier4","followers_url":"https://api.github.com/users/softwareatelier4/followers","following_url":"https://api.github.com/users/softwareatelier4/following{/other_user}","gists_url":"https://api.github.com/users/softwareatelier4/gists{/gist_id}","starred_url":"https://api.github.com/users/softwareatelier4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwareatelier4/subscriptions","organizations_url":"https://api.github.com/users/softwareatelier4/orgs","repos_url":"https://api.github.com/users/softwareatelier4/repos","events_url":"https://api.github.com/users/softwareatelier4/events{/privacy}","received_events_url":"https://api.github.com/users/softwareatelier4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/softwareatelier4/Group1","description":null,"fork":false,"url":"https://api.github.com/repos/softwareatelier4/Group1","forks_url":"https://api.github.com/repos/softwareatelier4/Group1/forks","keys_url":"https://api.github.com/repos/softwareatelier4/Group1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softwareatelier4/Group1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softwareatelier4/Group1/teams","hooks_url":"https://api.github.com/repos/softwareatelier4/Group1/hooks","issue_events_url":"https://api.github.com/repos/softwareatelier4/Group1/issues/events{/number}","events_url":"https://api.github.com/repos/softwareatelier4/Group1/events","assignees_url":"https://api.github.com/repos/softwareatelier4/Group1/assignees{/user}","branches_url":"https://api.github.com/repos/softwareatelier4/Group1/branches{/branch}","tags_url":"https://api.github.com/repos/softwareatelier4/Group1/tags","blobs_url":"https://api.github.com/repos/softwareatelier4/Group1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softwareatelier4/Group1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softwareatelier4/Group1/git/refs{/sha}","trees_url":"https://api.github.com/repos/softwareatelier4/Group1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softwareatelier4/Group1/statuses/{sha}","languages_url":"https://api.github.com/repos/softwareatelier4/Group1/languages","stargazers_url":"https://api.github.com/repos/softwareatelier4/Group1/stargazers","contributors_url":"https://api.github.com/repos/softwareatelier4/Group1/contributors","subscribers_url":"https://api.github.com/repos/softwareatelier4/Group1/subscribers","subscription_url":"https://api.github.com/repos/softwareatelier4/Group1/subscription","commits_url":"https://api.github.com/repos/softwareatelier4/Group1/commits{/sha}","git_commits_url":"https://api.github.com/repos/softwareatelier4/Group1/git/commits{/sha}","comments_url":"https://api.github.com/repos/softwareatelier4/Group1/comments{/number}","issue_comment_url":"https://api.github.com/repos/softwareatelier4/Group1/issues/comments{/number}","contents_url":"https://api.github.com/repos/softwareatelier4/Group1/contents/{+path}","compare_url":"https://api.github.com/repos/softwareatelier4/Group1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softwareatelier4/Group1/merges","archive_url":"https://api.github.com/repos/softwareatelier4/Group1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softwareatelier4/Group1/downloads","issues_url":"https://api.github.com/repos/softwareatelier4/Group1/issues{/number}","pulls_url":"https://api.github.com/repos/softwareatelier4/Group1/pulls{/number}","milestones_url":"https://api.github.com/repos/softwareatelier4/Group1/milestones{/number}","notifications_url":"https://api.github.com/repos/softwareatelier4/Group1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softwareatelier4/Group1/labels{/name}","releases_url":"https://api.github.com/repos/softwareatelier4/Group1/releases{/id}","deployments_url":"https://api.github.com/repos/softwareatelier4/Group1/deployments","created_at":"2017-02-22T15:14:36Z","updated_at":"2017-03-12T17:20:05Z","pushed_at":"2017-04-18T19:19:27Z","git_url":"git://github.com/softwareatelier4/Group1.git","ssh_url":"git@github.com:softwareatelier4/Group1.git","clone_url":"https://github.com/softwareatelier4/Group1.git","svn_url":"https://github.com/softwareatelier4/Group1","homepage":null,"size":36954,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21"},"html":{"href":"https://github.com/softwareatelier4/Group1/pull/21"},"issue":{"href":"https://api.github.com/repos/softwareatelier4/Group1/issues/21"},"comments":{"href":"https://api.github.com/repos/softwareatelier4/Group1/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/softwareatelier4/Group1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/softwareatelier4/Group1/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/softwareatelier4/Group1/statuses/9ad4d4f5aa3f7bea170c05df5f350057eac7ca8d"}}}}
{"actor":{"display_login":"Shelyo"}}