{"action":"created","comment":{"url":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/23948303","id":23948303,"diff_hunk":"@@ -0,0 +1,74 @@\n+var path = require('path');\n+var Cat = require(path.join(__dirname,'../models/catmodel'));\n+\n+var namesList = ['Indycule','Ignatz','Hume','Dunka','Brockie','Julie','Opie','Chaucer','Lew','Spamela','Tumbleweed'];\n+var colorList = ['red','brown','green','starbuck','blue','pink','white','gray'];\n+\n+var generateName = function () {\n+\treturn namesList[Math.floor(Math.random() * namesList.length)]\n+}\n+\n+var generateRandomAge = function (){\n+\treturn Math.ceil(20*Math.random())\n+}\n+\n+var generateListofColors = function (){\n+\tvar colorArray = [];\n+\n+\tfor (var i = 0; i < (colorList.length)-2; i++){\n+\t\tcolorArray.push(colorList[Math.floor(Math.random() * colorList.length)])\n+\t}\n+\n+\treturn colorArray;\n+}\n+\n+var catsNew = function(req,res){\n+\t\n+\tvar catX = new Cat({\n+\t\tname: generateName(), \n+\t\tage: generateRandomAge(), \n+\t\tcolorlist: generateListofColors()\n+\t});\n+\tconsole.log(catX)\n+\tcatX.save(function (err) {\n+\t  if (err) {\n+\t    console.log(\"Problem saving bob\", err);\n+\t  }\n+\t});\n+\n+\tres.render(\"newcat\",{'cat':catX});\n+}\n+\n+var catsList = function(req,res){\n+\t\n+\tCat.find({})\n+\t   .sort({age: 1})\n+  \t   .exec(function(err, cats) {\n+    \t  res.render('catlist',{'cats':cats});\n+  \t});\n+}\n+\n+var sortedWithColor = function(req,res){\n+\n+\tCat.find({colorlist:req.params.color})\n+\t   .sort({age: 1})\n+  \t   .exec(function(err, cats) {\n+    \t  res.render('catlistcolor',{'cats':cats, 'colorFilterMessage':req.params.color});\n+  \t});\n+}\n+\n+var deleteCat = function(req,res){\n+\tCat.findOneAndRemove({},{sort:{age:-1}}, function(err,cat){\n+\n+\t\tCat.find({})\n+\t\t   .sort({age:1})\n+\t\t   .exec(function (err, cats){\n+\t\t       res.render('deletecat',{newcats:cats, deadcat:cat});","path":"classes/class3/hw/routes/cat.js","position":66,"original_position":66,"commit_id":"ef90867c0db6f0fdd2d3cb6a11292b5623ca7cb3","original_commit_id":"ef90867c0db6f0fdd2d3cb6a11292b5623ca7cb3","user":{"login":"benkahle","id":3596325,"avatar_url":"https://avatars.githubusercontent.com/u/3596325?v=3","gravatar_id":"","url":"https://api.github.com/users/benkahle","html_url":"https://github.com/benkahle","followers_url":"https://api.github.com/users/benkahle/followers","following_url":"https://api.github.com/users/benkahle/following{/other_user}","gists_url":"https://api.github.com/users/benkahle/gists{/gist_id}","starred_url":"https://api.github.com/users/benkahle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benkahle/subscriptions","organizations_url":"https://api.github.com/users/benkahle/orgs","repos_url":"https://api.github.com/users/benkahle/repos","events_url":"https://api.github.com/users/benkahle/events{/privacy}","received_events_url":"https://api.github.com/users/benkahle/received_events","type":"User","site_admin":false},"body":"Handle the error","created_at":"2015-02-02T19:00:16Z","updated_at":"2015-02-02T19:00:16Z","html_url":"https://github.com/olinjs/olinjs/pull/36#discussion_r23948303","pull_request_url":"https://api.github.com/repos/olinjs/olinjs/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/23948303"},"html":{"href":"https://github.com/olinjs/olinjs/pull/36#discussion_r23948303"},"pull_request":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/olinjs/olinjs/pulls/36","id":28488583,"html_url":"https://github.com/olinjs/olinjs/pull/36","diff_url":"https://github.com/olinjs/olinjs/pull/36.diff","patch_url":"https://github.com/olinjs/olinjs/pull/36.patch","issue_url":"https://api.github.com/repos/olinjs/olinjs/issues/36","number":36,"state":"open","locked":false,"title":"Filippos - Homework3","user":{"login":"EvanDorsky","id":2582895,"avatar_url":"https://avatars.githubusercontent.com/u/2582895?v=3","gravatar_id":"","url":"https://api.github.com/users/EvanDorsky","html_url":"https://github.com/EvanDorsky","followers_url":"https://api.github.com/users/EvanDorsky/followers","following_url":"https://api.github.com/users/EvanDorsky/following{/other_user}","gists_url":"https://api.github.com/users/EvanDorsky/gists{/gist_id}","starred_url":"https://api.github.com/users/EvanDorsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EvanDorsky/subscriptions","organizations_url":"https://api.github.com/users/EvanDorsky/orgs","repos_url":"https://api.github.com/users/EvanDorsky/repos","events_url":"https://api.github.com/users/EvanDorsky/events{/privacy}","received_events_url":"https://api.github.com/users/EvanDorsky/received_events","type":"User","site_admin":false},"body":"Graded by @benkahle and @EvanDorsky","created_at":"2015-02-02T17:56:47Z","updated_at":"2015-02-02T19:00:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87cbead1de45a39e97ebe46b49be75fca2d5500e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/olinjs/olinjs/pulls/36/commits","review_comments_url":"https://api.github.com/repos/olinjs/olinjs/pulls/36/comments","review_comment_url":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/{number}","comments_url":"https://api.github.com/repos/olinjs/olinjs/issues/36/comments","statuses_url":"https://api.github.com/repos/olinjs/olinjs/statuses/ef90867c0db6f0fdd2d3cb6a11292b5623ca7cb3","head":{"label":"flymperopoulos:master","ref":"master","sha":"ef90867c0db6f0fdd2d3cb6a11292b5623ca7cb3","user":{"login":"flymperopoulos","id":6156036,"avatar_url":"https://avatars.githubusercontent.com/u/6156036?v=3","gravatar_id":"","url":"https://api.github.com/users/flymperopoulos","html_url":"https://github.com/flymperopoulos","followers_url":"https://api.github.com/users/flymperopoulos/followers","following_url":"https://api.github.com/users/flymperopoulos/following{/other_user}","gists_url":"https://api.github.com/users/flymperopoulos/gists{/gist_id}","starred_url":"https://api.github.com/users/flymperopoulos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flymperopoulos/subscriptions","organizations_url":"https://api.github.com/users/flymperopoulos/orgs","repos_url":"https://api.github.com/users/flymperopoulos/repos","events_url":"https://api.github.com/users/flymperopoulos/events{/privacy}","received_events_url":"https://api.github.com/users/flymperopoulos/received_events","type":"User","site_admin":false},"repo":{"id":29541536,"name":"olinjs","full_name":"flymperopoulos/olinjs","owner":{"login":"flymperopoulos","id":6156036,"avatar_url":"https://avatars.githubusercontent.com/u/6156036?v=3","gravatar_id":"","url":"https://api.github.com/users/flymperopoulos","html_url":"https://github.com/flymperopoulos","followers_url":"https://api.github.com/users/flymperopoulos/followers","following_url":"https://api.github.com/users/flymperopoulos/following{/other_user}","gists_url":"https://api.github.com/users/flymperopoulos/gists{/gist_id}","starred_url":"https://api.github.com/users/flymperopoulos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flymperopoulos/subscriptions","organizations_url":"https://api.github.com/users/flymperopoulos/orgs","repos_url":"https://api.github.com/users/flymperopoulos/repos","events_url":"https://api.github.com/users/flymperopoulos/events{/privacy}","received_events_url":"https://api.github.com/users/flymperopoulos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flymperopoulos/olinjs","description":"The second offering of Olin.js in the spring of 2015","fork":true,"url":"https://api.github.com/repos/flymperopoulos/olinjs","forks_url":"https://api.github.com/repos/flymperopoulos/olinjs/forks","keys_url":"https://api.github.com/repos/flymperopoulos/olinjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flymperopoulos/olinjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flymperopoulos/olinjs/teams","hooks_url":"https://api.github.com/repos/flymperopoulos/olinjs/hooks","issue_events_url":"https://api.github.com/repos/flymperopoulos/olinjs/issues/events{/number}","events_url":"https://api.github.com/repos/flymperopoulos/olinjs/events","assignees_url":"https://api.github.com/repos/flymperopoulos/olinjs/assignees{/user}","branches_url":"https://api.github.com/repos/flymperopoulos/olinjs/branches{/branch}","tags_url":"https://api.github.com/repos/flymperopoulos/olinjs/tags","blobs_url":"https://api.github.com/repos/flymperopoulos/olinjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flymperopoulos/olinjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flymperopoulos/olinjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/flymperopoulos/olinjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flymperopoulos/olinjs/statuses/{sha}","languages_url":"https://api.github.com/repos/flymperopoulos/olinjs/languages","stargazers_url":"https://api.github.com/repos/flymperopoulos/olinjs/stargazers","contributors_url":"https://api.github.com/repos/flymperopoulos/olinjs/contributors","subscribers_url":"https://api.github.com/repos/flymperopoulos/olinjs/subscribers","subscription_url":"https://api.github.com/repos/flymperopoulos/olinjs/subscription","commits_url":"https://api.github.com/repos/flymperopoulos/olinjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/flymperopoulos/olinjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/flymperopoulos/olinjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/flymperopoulos/olinjs/issues/comments/{number}","contents_url":"https://api.github.com/repos/flymperopoulos/olinjs/contents/{+path}","compare_url":"https://api.github.com/repos/flymperopoulos/olinjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flymperopoulos/olinjs/merges","archive_url":"https://api.github.com/repos/flymperopoulos/olinjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flymperopoulos/olinjs/downloads","issues_url":"https://api.github.com/repos/flymperopoulos/olinjs/issues{/number}","pulls_url":"https://api.github.com/repos/flymperopoulos/olinjs/pulls{/number}","milestones_url":"https://api.github.com/repos/flymperopoulos/olinjs/milestones{/number}","notifications_url":"https://api.github.com/repos/flymperopoulos/olinjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flymperopoulos/olinjs/labels{/name}","releases_url":"https://api.github.com/repos/flymperopoulos/olinjs/releases{/id}","created_at":"2015-01-20T17:15:16Z","updated_at":"2015-01-30T20:46:30Z","pushed_at":"2015-01-30T20:46:30Z","git_url":"git://github.com/flymperopoulos/olinjs.git","ssh_url":"git@github.com:flymperopoulos/olinjs.git","clone_url":"https://github.com/flymperopoulos/olinjs.git","svn_url":"https://github.com/flymperopoulos/olinjs","homepage":null,"size":1718,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"olinjs:master","ref":"master","sha":"8b0473a84817a9037ddd10c853d579c6eea51db6","user":{"login":"olinjs","id":3213751,"avatar_url":"https://avatars.githubusercontent.com/u/3213751?v=3","gravatar_id":"","url":"https://api.github.com/users/olinjs","html_url":"https://github.com/olinjs","followers_url":"https://api.github.com/users/olinjs/followers","following_url":"https://api.github.com/users/olinjs/following{/other_user}","gists_url":"https://api.github.com/users/olinjs/gists{/gist_id}","starred_url":"https://api.github.com/users/olinjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olinjs/subscriptions","organizations_url":"https://api.github.com/users/olinjs/orgs","repos_url":"https://api.github.com/users/olinjs/repos","events_url":"https://api.github.com/users/olinjs/events{/privacy}","received_events_url":"https://api.github.com/users/olinjs/received_events","type":"Organization","site_admin":false},"repo":{"id":28649083,"name":"olinjs","full_name":"olinjs/olinjs","owner":{"login":"olinjs","id":3213751,"avatar_url":"https://avatars.githubusercontent.com/u/3213751?v=3","gravatar_id":"","url":"https://api.github.com/users/olinjs","html_url":"https://github.com/olinjs","followers_url":"https://api.github.com/users/olinjs/followers","following_url":"https://api.github.com/users/olinjs/following{/other_user}","gists_url":"https://api.github.com/users/olinjs/gists{/gist_id}","starred_url":"https://api.github.com/users/olinjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olinjs/subscriptions","organizations_url":"https://api.github.com/users/olinjs/orgs","repos_url":"https://api.github.com/users/olinjs/repos","events_url":"https://api.github.com/users/olinjs/events{/privacy}","received_events_url":"https://api.github.com/users/olinjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/olinjs/olinjs","description":"The second offering of Olin.js in the spring of 2015","fork":false,"url":"https://api.github.com/repos/olinjs/olinjs","forks_url":"https://api.github.com/repos/olinjs/olinjs/forks","keys_url":"https://api.github.com/repos/olinjs/olinjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/olinjs/olinjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/olinjs/olinjs/teams","hooks_url":"https://api.github.com/repos/olinjs/olinjs/hooks","issue_events_url":"https://api.github.com/repos/olinjs/olinjs/issues/events{/number}","events_url":"https://api.github.com/repos/olinjs/olinjs/events","assignees_url":"https://api.github.com/repos/olinjs/olinjs/assignees{/user}","branches_url":"https://api.github.com/repos/olinjs/olinjs/branches{/branch}","tags_url":"https://api.github.com/repos/olinjs/olinjs/tags","blobs_url":"https://api.github.com/repos/olinjs/olinjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/olinjs/olinjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/olinjs/olinjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/olinjs/olinjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/olinjs/olinjs/statuses/{sha}","languages_url":"https://api.github.com/repos/olinjs/olinjs/languages","stargazers_url":"https://api.github.com/repos/olinjs/olinjs/stargazers","contributors_url":"https://api.github.com/repos/olinjs/olinjs/contributors","subscribers_url":"https://api.github.com/repos/olinjs/olinjs/subscribers","subscription_url":"https://api.github.com/repos/olinjs/olinjs/subscription","commits_url":"https://api.github.com/repos/olinjs/olinjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/olinjs/olinjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/olinjs/olinjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/olinjs/olinjs/issues/comments/{number}","contents_url":"https://api.github.com/repos/olinjs/olinjs/contents/{+path}","compare_url":"https://api.github.com/repos/olinjs/olinjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/olinjs/olinjs/merges","archive_url":"https://api.github.com/repos/olinjs/olinjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/olinjs/olinjs/downloads","issues_url":"https://api.github.com/repos/olinjs/olinjs/issues{/number}","pulls_url":"https://api.github.com/repos/olinjs/olinjs/pulls{/number}","milestones_url":"https://api.github.com/repos/olinjs/olinjs/milestones{/number}","notifications_url":"https://api.github.com/repos/olinjs/olinjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/olinjs/olinjs/labels{/name}","releases_url":"https://api.github.com/repos/olinjs/olinjs/releases{/id}","created_at":"2014-12-30T23:29:53Z","updated_at":"2015-02-01T00:38:47Z","pushed_at":"2015-02-01T00:38:46Z","git_url":"git://github.com/olinjs/olinjs.git","ssh_url":"git@github.com:olinjs/olinjs.git","clone_url":"https://github.com/olinjs/olinjs.git","svn_url":"https://github.com/olinjs/olinjs","homepage":null,"size":3897,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":10,"forks":35,"open_issues":10,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/36"},"html":{"href":"https://github.com/olinjs/olinjs/pull/36"},"issue":{"href":"https://api.github.com/repos/olinjs/olinjs/issues/36"},"comments":{"href":"https://api.github.com/repos/olinjs/olinjs/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/olinjs/olinjs/statuses/ef90867c0db6f0fdd2d3cb6a11292b5623ca7cb3"}}}}