{"action":"created","comment":{"url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/comments/207494361","pull_request_review_id":143115864,"id":207494361,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzQ5NDM2MQ==","diff_hunk":"@@ -201,7 +207,13 @@ public IHttpActionResult DeletePromotions([FromUri] string[] ids)\n         public IHttpActionResult SearchCoupons(CouponSearchCriteria criteria)\n         {\n             var searchResult = _couponService.SearchCoupons(criteria);\n-\n+            // actualize coupon totalUsage field with out caching \n+            using (var repository = _repositoryFactory())\n+            {\n+                var ids = searchResult.Results.Select(x => x.Id).ToArray();\n+                var couponEntities = repository.GetCouponsByIds(ids);\n+                searchResult.Results.ForEach(coupon => coupon.TotalUsesCount = couponEntities.First(c => c.Id == coupon.Id).TotalUsesCount);","path":"VirtoCommerce.MarketingModule.Web/Controllers/Api/MarketingModulePromotionController.cs","position":56,"original_position":56,"commit_id":"2947d8fce7b1af651a2d8e415d3067e3971483b3","original_commit_id":"2947d8fce7b1af651a2d8e415d3067e3971483b3","user":{"login":"tatarincev","id":7566324,"node_id":"MDQ6VXNlcjc1NjYzMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7566324?v=4","gravatar_id":"","url":"https://api.github.com/users/tatarincev","html_url":"https://github.com/tatarincev","followers_url":"https://api.github.com/users/tatarincev/followers","following_url":"https://api.github.com/users/tatarincev/following{/other_user}","gists_url":"https://api.github.com/users/tatarincev/gists{/gist_id}","starred_url":"https://api.github.com/users/tatarincev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tatarincev/subscriptions","organizations_url":"https://api.github.com/users/tatarincev/orgs","repos_url":"https://api.github.com/users/tatarincev/repos","events_url":"https://api.github.com/users/tatarincev/events{/privacy}","received_events_url":"https://api.github.com/users/tatarincev/received_events","type":"User","site_admin":false},"body":"Because Coupon is  inherited from Entity class and has an override GetHashCode and Equals methods, you can replace `couponEntities.First(c => c.Id == coupon.Id)` with `couponEntities.First(c => c == coupon or c.equals(coupon))","created_at":"2018-08-03T09:42:45Z","updated_at":"2018-08-03T09:43:41Z","html_url":"https://github.com/VirtoCommerce/vc-module-marketing/pull/34#discussion_r207494361","pull_request_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/comments/207494361"},"html":{"href":"https://github.com/VirtoCommerce/vc-module-marketing/pull/34#discussion_r207494361"},"pull_request":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34","id":205940340,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1OTQwMzQw","html_url":"https://github.com/VirtoCommerce/vc-module-marketing/pull/34","diff_url":"https://github.com/VirtoCommerce/vc-module-marketing/pull/34.diff","patch_url":"https://github.com/VirtoCommerce/vc-module-marketing/pull/34.patch","issue_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/34","number":34,"state":"open","locked":false,"title":"actualize coupon totalUsage field","user":{"login":"AliveMen","id":11813599,"node_id":"MDQ6VXNlcjExODEzNTk5","avatar_url":"https://avatars1.githubusercontent.com/u/11813599?v=4","gravatar_id":"","url":"https://api.github.com/users/AliveMen","html_url":"https://github.com/AliveMen","followers_url":"https://api.github.com/users/AliveMen/followers","following_url":"https://api.github.com/users/AliveMen/following{/other_user}","gists_url":"https://api.github.com/users/AliveMen/gists{/gist_id}","starred_url":"https://api.github.com/users/AliveMen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AliveMen/subscriptions","organizations_url":"https://api.github.com/users/AliveMen/orgs","repos_url":"https://api.github.com/users/AliveMen/repos","events_url":"https://api.github.com/users/AliveMen/events{/privacy}","received_events_url":"https://api.github.com/users/AliveMen/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-03T06:50:00Z","updated_at":"2018-08-03T09:43:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b38042de412a36d8af67087ac08e9b1fda927f64","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34/commits","review_comments_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34/comments","review_comment_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/34/comments","statuses_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/statuses/2947d8fce7b1af651a2d8e415d3067e3971483b3","head":{"label":"VirtoCommerce:feature-coupon_totalUsage","ref":"feature-coupon_totalUsage","sha":"2947d8fce7b1af651a2d8e415d3067e3971483b3","user":{"login":"VirtoCommerce","id":5762443,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NjI0NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5762443?v=4","gravatar_id":"","url":"https://api.github.com/users/VirtoCommerce","html_url":"https://github.com/VirtoCommerce","followers_url":"https://api.github.com/users/VirtoCommerce/followers","following_url":"https://api.github.com/users/VirtoCommerce/following{/other_user}","gists_url":"https://api.github.com/users/VirtoCommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/VirtoCommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VirtoCommerce/subscriptions","organizations_url":"https://api.github.com/users/VirtoCommerce/orgs","repos_url":"https://api.github.com/users/VirtoCommerce/repos","events_url":"https://api.github.com/users/VirtoCommerce/events{/privacy}","received_events_url":"https://api.github.com/users/VirtoCommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":59760417,"node_id":"MDEwOlJlcG9zaXRvcnk1OTc2MDQxNw==","name":"vc-module-marketing","full_name":"VirtoCommerce/vc-module-marketing","owner":{"login":"VirtoCommerce","id":5762443,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NjI0NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5762443?v=4","gravatar_id":"","url":"https://api.github.com/users/VirtoCommerce","html_url":"https://github.com/VirtoCommerce","followers_url":"https://api.github.com/users/VirtoCommerce/followers","following_url":"https://api.github.com/users/VirtoCommerce/following{/other_user}","gists_url":"https://api.github.com/users/VirtoCommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/VirtoCommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VirtoCommerce/subscriptions","organizations_url":"https://api.github.com/users/VirtoCommerce/orgs","repos_url":"https://api.github.com/users/VirtoCommerce/repos","events_url":"https://api.github.com/users/VirtoCommerce/events{/privacy}","received_events_url":"https://api.github.com/users/VirtoCommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VirtoCommerce/vc-module-marketing","description":"Marketing module: promotions and dynamic content","fork":false,"url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing","forks_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/forks","keys_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/teams","hooks_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/hooks","issue_events_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/events{/number}","events_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/events","assignees_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/assignees{/user}","branches_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/branches{/branch}","tags_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/tags","blobs_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/refs{/sha}","trees_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/statuses/{sha}","languages_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/languages","stargazers_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/stargazers","contributors_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/contributors","subscribers_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/subscribers","subscription_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/subscription","commits_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/commits{/sha}","git_commits_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/commits{/sha}","comments_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/comments{/number}","issue_comment_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/comments{/number}","contents_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/contents/{+path}","compare_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/merges","archive_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/downloads","issues_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues{/number}","pulls_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls{/number}","milestones_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/milestones{/number}","notifications_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/labels{/name}","releases_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/releases{/id}","deployments_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/deployments","created_at":"2016-05-26T15:13:35Z","updated_at":"2018-07-25T13:54:00Z","pushed_at":"2018-08-03T09:23:57Z","git_url":"git://github.com/VirtoCommerce/vc-module-marketing.git","ssh_url":"git@github.com:VirtoCommerce/vc-module-marketing.git","clone_url":"https://github.com/VirtoCommerce/vc-module-marketing.git","svn_url":"https://github.com/VirtoCommerce/vc-module-marketing","homepage":"","size":1015,"stargazers_count":3,"watchers_count":3,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":13,"license":null,"forks":3,"open_issues":13,"watchers":3,"default_branch":"master"}},"base":{"label":"VirtoCommerce:dev","ref":"dev","sha":"ca459efa116fec4f7945e0de072bd7b9aa424b99","user":{"login":"VirtoCommerce","id":5762443,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NjI0NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5762443?v=4","gravatar_id":"","url":"https://api.github.com/users/VirtoCommerce","html_url":"https://github.com/VirtoCommerce","followers_url":"https://api.github.com/users/VirtoCommerce/followers","following_url":"https://api.github.com/users/VirtoCommerce/following{/other_user}","gists_url":"https://api.github.com/users/VirtoCommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/VirtoCommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VirtoCommerce/subscriptions","organizations_url":"https://api.github.com/users/VirtoCommerce/orgs","repos_url":"https://api.github.com/users/VirtoCommerce/repos","events_url":"https://api.github.com/users/VirtoCommerce/events{/privacy}","received_events_url":"https://api.github.com/users/VirtoCommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":59760417,"node_id":"MDEwOlJlcG9zaXRvcnk1OTc2MDQxNw==","name":"vc-module-marketing","full_name":"VirtoCommerce/vc-module-marketing","owner":{"login":"VirtoCommerce","id":5762443,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NjI0NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5762443?v=4","gravatar_id":"","url":"https://api.github.com/users/VirtoCommerce","html_url":"https://github.com/VirtoCommerce","followers_url":"https://api.github.com/users/VirtoCommerce/followers","following_url":"https://api.github.com/users/VirtoCommerce/following{/other_user}","gists_url":"https://api.github.com/users/VirtoCommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/VirtoCommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VirtoCommerce/subscriptions","organizations_url":"https://api.github.com/users/VirtoCommerce/orgs","repos_url":"https://api.github.com/users/VirtoCommerce/repos","events_url":"https://api.github.com/users/VirtoCommerce/events{/privacy}","received_events_url":"https://api.github.com/users/VirtoCommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VirtoCommerce/vc-module-marketing","description":"Marketing module: promotions and dynamic content","fork":false,"url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing","forks_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/forks","keys_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/teams","hooks_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/hooks","issue_events_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/events{/number}","events_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/events","assignees_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/assignees{/user}","branches_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/branches{/branch}","tags_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/tags","blobs_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/refs{/sha}","trees_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/statuses/{sha}","languages_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/languages","stargazers_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/stargazers","contributors_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/contributors","subscribers_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/subscribers","subscription_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/subscription","commits_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/commits{/sha}","git_commits_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/git/commits{/sha}","comments_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/comments{/number}","issue_comment_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/comments{/number}","contents_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/contents/{+path}","compare_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/merges","archive_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/downloads","issues_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues{/number}","pulls_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls{/number}","milestones_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/milestones{/number}","notifications_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/labels{/name}","releases_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/releases{/id}","deployments_url":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/deployments","created_at":"2016-05-26T15:13:35Z","updated_at":"2018-07-25T13:54:00Z","pushed_at":"2018-08-03T09:23:57Z","git_url":"git://github.com/VirtoCommerce/vc-module-marketing.git","ssh_url":"git@github.com:VirtoCommerce/vc-module-marketing.git","clone_url":"https://github.com/VirtoCommerce/vc-module-marketing.git","svn_url":"https://github.com/VirtoCommerce/vc-module-marketing","homepage":"","size":1015,"stargazers_count":3,"watchers_count":3,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":13,"license":null,"forks":3,"open_issues":13,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34"},"html":{"href":"https://github.com/VirtoCommerce/vc-module-marketing/pull/34"},"issue":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/34"},"comments":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/VirtoCommerce/vc-module-marketing/statuses/2947d8fce7b1af651a2d8e415d3067e3971483b3"}},"author_association":"NONE"}}
{"actor":{"display_login":"tatarincev"}}