{"action":"created","comment":{"url":"https://api.github.com/repos/patovala/kpos/pulls/comments/43543107","id":43543107,"diff_hunk":"@@ -0,0 +1,50 @@\n+'use strict';\n+\n+var _ = require('lodash');\n+var config = require('../../config/environment');\n+\n+var MongoClient,\n+    url = config.mongo.uri;\n+\n+var exports = module.exports = {};\n+\n+MongoClient = require('mongodb').MongoClient;\n+\n+/*\n+ * Get discounts for clients, only to client\n+ * that buys coffee\n+ * */\n+var totalItem,discountsItem,sum=0;\n+exports.discountsClients = function (cart, cb){\n+\n+  if (cart.pendingDiscounts && _.contains(cart.pendingDiscounts, 'DC')){\n+\n+    MongoClient.connect(url, {}, function(err, db) {\n+\n+      var discounts = db.collection('discounts');\n+\n+      discounts.findOne({_id: 'DC'}, function(err, d){\n+        db.close();\n+        if(d){\n+          // buscar en la carta los items que tengan categoria d.applyToCategory\n+          var elems = _.filter(cart.items, function(i){return i.category === d.applyToCategory;});\n+          if (elems.length) {\n+            sum=0;\n+              _.forEach(elems, function(i){","path":"server/components/discountsmachine/discountsclient.js","position":33,"original_position":33,"commit_id":"7074cae95861a41de0a1c4d8454f5b0e37253767","original_commit_id":"7074cae95861a41de0a1c4d8454f5b0e37253767","user":{"login":"patovala","id":1739789,"avatar_url":"https://avatars.githubusercontent.com/u/1739789?v=3","gravatar_id":"","url":"https://api.github.com/users/patovala","html_url":"https://github.com/patovala","followers_url":"https://api.github.com/users/patovala/followers","following_url":"https://api.github.com/users/patovala/following{/other_user}","gists_url":"https://api.github.com/users/patovala/gists{/gist_id}","starred_url":"https://api.github.com/users/patovala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patovala/subscriptions","organizations_url":"https://api.github.com/users/patovala/orgs","repos_url":"https://api.github.com/users/patovala/repos","events_url":"https://api.github.com/users/patovala/events{/privacy}","received_events_url":"https://api.github.com/users/patovala/received_events","type":"User","site_admin":false},"body":"linea 33 y linea 38 no estan alineados a la linea 32","created_at":"2015-10-30T19:30:17Z","updated_at":"2015-10-30T19:30:17Z","html_url":"https://github.com/patovala/kpos/pull/100#discussion_r43543107","pull_request_url":"https://api.github.com/repos/patovala/kpos/pulls/100","_links":{"self":{"href":"https://api.github.com/repos/patovala/kpos/pulls/comments/43543107"},"html":{"href":"https://github.com/patovala/kpos/pull/100#discussion_r43543107"},"pull_request":{"href":"https://api.github.com/repos/patovala/kpos/pulls/100"}}},"pull_request":{"url":"https://api.github.com/repos/patovala/kpos/pulls/100","id":49292699,"html_url":"https://github.com/patovala/kpos/pull/100","diff_url":"https://github.com/patovala/kpos/pull/100.diff","patch_url":"https://github.com/patovala/kpos/pull/100.patch","issue_url":"https://api.github.com/repos/patovala/kpos/issues/100","number":100,"state":"open","locked":false,"title":"create client discounts","user":{"login":"macrisguncay","id":14335336,"avatar_url":"https://avatars.githubusercontent.com/u/14335336?v=3","gravatar_id":"","url":"https://api.github.com/users/macrisguncay","html_url":"https://github.com/macrisguncay","followers_url":"https://api.github.com/users/macrisguncay/followers","following_url":"https://api.github.com/users/macrisguncay/following{/other_user}","gists_url":"https://api.github.com/users/macrisguncay/gists{/gist_id}","starred_url":"https://api.github.com/users/macrisguncay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macrisguncay/subscriptions","organizations_url":"https://api.github.com/users/macrisguncay/orgs","repos_url":"https://api.github.com/users/macrisguncay/repos","events_url":"https://api.github.com/users/macrisguncay/events{/privacy}","received_events_url":"https://api.github.com/users/macrisguncay/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-30T16:40:31Z","updated_at":"2015-10-30T19:30:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a416d01defd679279a213f2f80294c2f8952b7e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/patovala/kpos/pulls/100/commits","review_comments_url":"https://api.github.com/repos/patovala/kpos/pulls/100/comments","review_comment_url":"https://api.github.com/repos/patovala/kpos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/patovala/kpos/issues/100/comments","statuses_url":"https://api.github.com/repos/patovala/kpos/statuses/7074cae95861a41de0a1c4d8454f5b0e37253767","head":{"label":"macrisguncay:development","ref":"development","sha":"7074cae95861a41de0a1c4d8454f5b0e37253767","user":{"login":"macrisguncay","id":14335336,"avatar_url":"https://avatars.githubusercontent.com/u/14335336?v=3","gravatar_id":"","url":"https://api.github.com/users/macrisguncay","html_url":"https://github.com/macrisguncay","followers_url":"https://api.github.com/users/macrisguncay/followers","following_url":"https://api.github.com/users/macrisguncay/following{/other_user}","gists_url":"https://api.github.com/users/macrisguncay/gists{/gist_id}","starred_url":"https://api.github.com/users/macrisguncay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macrisguncay/subscriptions","organizations_url":"https://api.github.com/users/macrisguncay/orgs","repos_url":"https://api.github.com/users/macrisguncay/repos","events_url":"https://api.github.com/users/macrisguncay/events{/privacy}","received_events_url":"https://api.github.com/users/macrisguncay/received_events","type":"User","site_admin":false},"repo":{"id":42677298,"name":"kpos","full_name":"macrisguncay/kpos","owner":{"login":"macrisguncay","id":14335336,"avatar_url":"https://avatars.githubusercontent.com/u/14335336?v=3","gravatar_id":"","url":"https://api.github.com/users/macrisguncay","html_url":"https://github.com/macrisguncay","followers_url":"https://api.github.com/users/macrisguncay/followers","following_url":"https://api.github.com/users/macrisguncay/following{/other_user}","gists_url":"https://api.github.com/users/macrisguncay/gists{/gist_id}","starred_url":"https://api.github.com/users/macrisguncay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macrisguncay/subscriptions","organizations_url":"https://api.github.com/users/macrisguncay/orgs","repos_url":"https://api.github.com/users/macrisguncay/repos","events_url":"https://api.github.com/users/macrisguncay/events{/privacy}","received_events_url":"https://api.github.com/users/macrisguncay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/macrisguncay/kpos","description":"Punto de Venta (POS) simple usando MEAN","fork":true,"url":"https://api.github.com/repos/macrisguncay/kpos","forks_url":"https://api.github.com/repos/macrisguncay/kpos/forks","keys_url":"https://api.github.com/repos/macrisguncay/kpos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macrisguncay/kpos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macrisguncay/kpos/teams","hooks_url":"https://api.github.com/repos/macrisguncay/kpos/hooks","issue_events_url":"https://api.github.com/repos/macrisguncay/kpos/issues/events{/number}","events_url":"https://api.github.com/repos/macrisguncay/kpos/events","assignees_url":"https://api.github.com/repos/macrisguncay/kpos/assignees{/user}","branches_url":"https://api.github.com/repos/macrisguncay/kpos/branches{/branch}","tags_url":"https://api.github.com/repos/macrisguncay/kpos/tags","blobs_url":"https://api.github.com/repos/macrisguncay/kpos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macrisguncay/kpos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macrisguncay/kpos/git/refs{/sha}","trees_url":"https://api.github.com/repos/macrisguncay/kpos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macrisguncay/kpos/statuses/{sha}","languages_url":"https://api.github.com/repos/macrisguncay/kpos/languages","stargazers_url":"https://api.github.com/repos/macrisguncay/kpos/stargazers","contributors_url":"https://api.github.com/repos/macrisguncay/kpos/contributors","subscribers_url":"https://api.github.com/repos/macrisguncay/kpos/subscribers","subscription_url":"https://api.github.com/repos/macrisguncay/kpos/subscription","commits_url":"https://api.github.com/repos/macrisguncay/kpos/commits{/sha}","git_commits_url":"https://api.github.com/repos/macrisguncay/kpos/git/commits{/sha}","comments_url":"https://api.github.com/repos/macrisguncay/kpos/comments{/number}","issue_comment_url":"https://api.github.com/repos/macrisguncay/kpos/issues/comments{/number}","contents_url":"https://api.github.com/repos/macrisguncay/kpos/contents/{+path}","compare_url":"https://api.github.com/repos/macrisguncay/kpos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macrisguncay/kpos/merges","archive_url":"https://api.github.com/repos/macrisguncay/kpos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macrisguncay/kpos/downloads","issues_url":"https://api.github.com/repos/macrisguncay/kpos/issues{/number}","pulls_url":"https://api.github.com/repos/macrisguncay/kpos/pulls{/number}","milestones_url":"https://api.github.com/repos/macrisguncay/kpos/milestones{/number}","notifications_url":"https://api.github.com/repos/macrisguncay/kpos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macrisguncay/kpos/labels{/name}","releases_url":"https://api.github.com/repos/macrisguncay/kpos/releases{/id}","created_at":"2015-09-17T19:32:58Z","updated_at":"2015-09-17T19:32:59Z","pushed_at":"2015-10-30T16:39:11Z","git_url":"git://github.com/macrisguncay/kpos.git","ssh_url":"git@github.com:macrisguncay/kpos.git","clone_url":"https://github.com/macrisguncay/kpos.git","svn_url":"https://github.com/macrisguncay/kpos","homepage":null,"size":3252,"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":"patovala:development","ref":"development","sha":"655fd6fbf2a6a0a32a59fe0b3c17b42d913fb6da","user":{"login":"patovala","id":1739789,"avatar_url":"https://avatars.githubusercontent.com/u/1739789?v=3","gravatar_id":"","url":"https://api.github.com/users/patovala","html_url":"https://github.com/patovala","followers_url":"https://api.github.com/users/patovala/followers","following_url":"https://api.github.com/users/patovala/following{/other_user}","gists_url":"https://api.github.com/users/patovala/gists{/gist_id}","starred_url":"https://api.github.com/users/patovala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patovala/subscriptions","organizations_url":"https://api.github.com/users/patovala/orgs","repos_url":"https://api.github.com/users/patovala/repos","events_url":"https://api.github.com/users/patovala/events{/privacy}","received_events_url":"https://api.github.com/users/patovala/received_events","type":"User","site_admin":false},"repo":{"id":41163838,"name":"kpos","full_name":"patovala/kpos","owner":{"login":"patovala","id":1739789,"avatar_url":"https://avatars.githubusercontent.com/u/1739789?v=3","gravatar_id":"","url":"https://api.github.com/users/patovala","html_url":"https://github.com/patovala","followers_url":"https://api.github.com/users/patovala/followers","following_url":"https://api.github.com/users/patovala/following{/other_user}","gists_url":"https://api.github.com/users/patovala/gists{/gist_id}","starred_url":"https://api.github.com/users/patovala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patovala/subscriptions","organizations_url":"https://api.github.com/users/patovala/orgs","repos_url":"https://api.github.com/users/patovala/repos","events_url":"https://api.github.com/users/patovala/events{/privacy}","received_events_url":"https://api.github.com/users/patovala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/patovala/kpos","description":"Punto de Venta (POS) simple usando MEAN","fork":false,"url":"https://api.github.com/repos/patovala/kpos","forks_url":"https://api.github.com/repos/patovala/kpos/forks","keys_url":"https://api.github.com/repos/patovala/kpos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/patovala/kpos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/patovala/kpos/teams","hooks_url":"https://api.github.com/repos/patovala/kpos/hooks","issue_events_url":"https://api.github.com/repos/patovala/kpos/issues/events{/number}","events_url":"https://api.github.com/repos/patovala/kpos/events","assignees_url":"https://api.github.com/repos/patovala/kpos/assignees{/user}","branches_url":"https://api.github.com/repos/patovala/kpos/branches{/branch}","tags_url":"https://api.github.com/repos/patovala/kpos/tags","blobs_url":"https://api.github.com/repos/patovala/kpos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/patovala/kpos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/patovala/kpos/git/refs{/sha}","trees_url":"https://api.github.com/repos/patovala/kpos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/patovala/kpos/statuses/{sha}","languages_url":"https://api.github.com/repos/patovala/kpos/languages","stargazers_url":"https://api.github.com/repos/patovala/kpos/stargazers","contributors_url":"https://api.github.com/repos/patovala/kpos/contributors","subscribers_url":"https://api.github.com/repos/patovala/kpos/subscribers","subscription_url":"https://api.github.com/repos/patovala/kpos/subscription","commits_url":"https://api.github.com/repos/patovala/kpos/commits{/sha}","git_commits_url":"https://api.github.com/repos/patovala/kpos/git/commits{/sha}","comments_url":"https://api.github.com/repos/patovala/kpos/comments{/number}","issue_comment_url":"https://api.github.com/repos/patovala/kpos/issues/comments{/number}","contents_url":"https://api.github.com/repos/patovala/kpos/contents/{+path}","compare_url":"https://api.github.com/repos/patovala/kpos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/patovala/kpos/merges","archive_url":"https://api.github.com/repos/patovala/kpos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/patovala/kpos/downloads","issues_url":"https://api.github.com/repos/patovala/kpos/issues{/number}","pulls_url":"https://api.github.com/repos/patovala/kpos/pulls{/number}","milestones_url":"https://api.github.com/repos/patovala/kpos/milestones{/number}","notifications_url":"https://api.github.com/repos/patovala/kpos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/patovala/kpos/labels{/name}","releases_url":"https://api.github.com/repos/patovala/kpos/releases{/id}","created_at":"2015-08-21T15:39:36Z","updated_at":"2015-08-21T17:23:38Z","pushed_at":"2015-10-30T16:40:31Z","git_url":"git://github.com/patovala/kpos.git","ssh_url":"git@github.com:patovala/kpos.git","clone_url":"https://github.com/patovala/kpos.git","svn_url":"https://github.com/patovala/kpos","homepage":null,"size":3651,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":6,"forks":10,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/patovala/kpos/pulls/100"},"html":{"href":"https://github.com/patovala/kpos/pull/100"},"issue":{"href":"https://api.github.com/repos/patovala/kpos/issues/100"},"comments":{"href":"https://api.github.com/repos/patovala/kpos/issues/100/comments"},"review_comments":{"href":"https://api.github.com/repos/patovala/kpos/pulls/100/comments"},"review_comment":{"href":"https://api.github.com/repos/patovala/kpos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/patovala/kpos/pulls/100/commits"},"statuses":{"href":"https://api.github.com/repos/patovala/kpos/statuses/7074cae95861a41de0a1c4d8454f5b0e37253767"}}}}