{"action":"created","comment":{"url":"https://api.github.com/repos/fidals/shopelectro/pulls/comments/69300549","id":69300549,"diff_hunk":"@@ -0,0 +1,65 @@\n+from collections import OrderedDict\n+\n+def define_price(cart):\n+    \"\"\"\n+    Function defines what type of price should use in cart and if need changes this\n+    price to the actual.\n+\n+    If the sum of products prices on column wholesale type price greater than 15 000 rub,\n+    40 000 rub and 100 000 rub then price for every product equated actual price.\n+    :param: cart is instance of Cart class from ecommerce.\n+    :return: modified cart instance\n+    \"\"\"\n+    def get_data_about_wholesale_types():\n+        \"\"\"\n+        Get total sums for every wholesale price type from cart objects.\n+        \"\"\"\n+        WHOLESALE_TYPES = {\n+            \"wholesale_small\": 15000,\n+            \"wholesale_medium\": 40000,\n+            \"wholesale_large\": 100000\n+        }\n+\n+        TOTAL_WHOLESALE_PRICES_FOR_EVERY_COLUMN = {\n+            wholesale_price_type: sum(\n+                getattr(item['product'], wholesale_price_type) *\n+                int(item['quantity'])\n+                for item in cart\n+            )\n+            for wholesale_price_type in WHOLESALE_TYPES\n+        }\n+\n+        return WHOLESALE_TYPES, TOTAL_WHOLESALE_PRICES_FOR_EVERY_COLUMN\n+\n+    def define_price_type(types, total_price):\n+        \"\"\"\n+        Define price type.\n+        If price is not wholesale, then return None.\n+        \"\"\"\n+\n+        WHOLESALE_PRICE = OrderedDict(sorted(types.items(),","path":"shopelectro/cart.py","position":40,"original_position":40,"commit_id":"a00a1f399fd0bd624037a6c1af049e64bd75e02b","original_commit_id":"a00a1f399fd0bd624037a6c1af049e64bd75e02b","user":{"login":"duker33","id":3526796,"avatar_url":"https://avatars.githubusercontent.com/u/3526796?v=3","gravatar_id":"","url":"https://api.github.com/users/duker33","html_url":"https://github.com/duker33","followers_url":"https://api.github.com/users/duker33/followers","following_url":"https://api.github.com/users/duker33/following{/other_user}","gists_url":"https://api.github.com/users/duker33/gists{/gist_id}","starred_url":"https://api.github.com/users/duker33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duker33/subscriptions","organizations_url":"https://api.github.com/users/duker33/orgs","repos_url":"https://api.github.com/users/duker33/repos","events_url":"https://api.github.com/users/duker33/events{/privacy}","received_events_url":"https://api.github.com/users/duker33/received_events","type":"User","site_admin":false},"body":"а зачем это писать заглавными? Это считается хорошим стилем?","created_at":"2016-07-01T13:39:48Z","updated_at":"2016-07-01T13:39:48Z","html_url":"https://github.com/fidals/shopelectro/pull/33#discussion_r69300549","pull_request_url":"https://api.github.com/repos/fidals/shopelectro/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/fidals/shopelectro/pulls/comments/69300549"},"html":{"href":"https://github.com/fidals/shopelectro/pull/33#discussion_r69300549"},"pull_request":{"href":"https://api.github.com/repos/fidals/shopelectro/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/fidals/shopelectro/pulls/33","id":75977214,"html_url":"https://github.com/fidals/shopelectro/pull/33","diff_url":"https://github.com/fidals/shopelectro/pull/33.diff","patch_url":"https://github.com/fidals/shopelectro/pull/33.patch","issue_url":"https://api.github.com/repos/fidals/shopelectro/issues/33","number":33,"state":"open","locked":false,"title":"[ dev-747 ] Wholesale prices for SE","user":{"login":"wrtds2","id":13870342,"avatar_url":"https://avatars.githubusercontent.com/u/13870342?v=3","gravatar_id":"","url":"https://api.github.com/users/wrtds2","html_url":"https://github.com/wrtds2","followers_url":"https://api.github.com/users/wrtds2/followers","following_url":"https://api.github.com/users/wrtds2/following{/other_user}","gists_url":"https://api.github.com/users/wrtds2/gists{/gist_id}","starred_url":"https://api.github.com/users/wrtds2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wrtds2/subscriptions","organizations_url":"https://api.github.com/users/wrtds2/orgs","repos_url":"https://api.github.com/users/wrtds2/repos","events_url":"https://api.github.com/users/wrtds2/events{/privacy}","received_events_url":"https://api.github.com/users/wrtds2/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-01T13:07:39Z","updated_at":"2016-07-01T13:39:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"916b07573883712f40a5c875b88522a0b57f1e67","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/fidals/shopelectro/pulls/33/commits","review_comments_url":"https://api.github.com/repos/fidals/shopelectro/pulls/33/comments","review_comment_url":"https://api.github.com/repos/fidals/shopelectro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fidals/shopelectro/issues/33/comments","statuses_url":"https://api.github.com/repos/fidals/shopelectro/statuses/a00a1f399fd0bd624037a6c1af049e64bd75e02b","head":{"label":"fidals:dev-747","ref":"dev-747","sha":"a00a1f399fd0bd624037a6c1af049e64bd75e02b","user":{"login":"fidals","id":16228604,"avatar_url":"https://avatars.githubusercontent.com/u/16228604?v=3","gravatar_id":"","url":"https://api.github.com/users/fidals","html_url":"https://github.com/fidals","followers_url":"https://api.github.com/users/fidals/followers","following_url":"https://api.github.com/users/fidals/following{/other_user}","gists_url":"https://api.github.com/users/fidals/gists{/gist_id}","starred_url":"https://api.github.com/users/fidals/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fidals/subscriptions","organizations_url":"https://api.github.com/users/fidals/orgs","repos_url":"https://api.github.com/users/fidals/repos","events_url":"https://api.github.com/users/fidals/events{/privacy}","received_events_url":"https://api.github.com/users/fidals/received_events","type":"Organization","site_admin":false},"repo":{"id":57301144,"name":"shopelectro","full_name":"fidals/shopelectro","owner":{"login":"fidals","id":16228604,"avatar_url":"https://avatars.githubusercontent.com/u/16228604?v=3","gravatar_id":"","url":"https://api.github.com/users/fidals","html_url":"https://github.com/fidals","followers_url":"https://api.github.com/users/fidals/followers","following_url":"https://api.github.com/users/fidals/following{/other_user}","gists_url":"https://api.github.com/users/fidals/gists{/gist_id}","starred_url":"https://api.github.com/users/fidals/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fidals/subscriptions","organizations_url":"https://api.github.com/users/fidals/orgs","repos_url":"https://api.github.com/users/fidals/repos","events_url":"https://api.github.com/users/fidals/events{/privacy}","received_events_url":"https://api.github.com/users/fidals/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fidals/shopelectro","description":"shopelectro.ru site's code","fork":false,"url":"https://api.github.com/repos/fidals/shopelectro","forks_url":"https://api.github.com/repos/fidals/shopelectro/forks","keys_url":"https://api.github.com/repos/fidals/shopelectro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fidals/shopelectro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fidals/shopelectro/teams","hooks_url":"https://api.github.com/repos/fidals/shopelectro/hooks","issue_events_url":"https://api.github.com/repos/fidals/shopelectro/issues/events{/number}","events_url":"https://api.github.com/repos/fidals/shopelectro/events","assignees_url":"https://api.github.com/repos/fidals/shopelectro/assignees{/user}","branches_url":"https://api.github.com/repos/fidals/shopelectro/branches{/branch}","tags_url":"https://api.github.com/repos/fidals/shopelectro/tags","blobs_url":"https://api.github.com/repos/fidals/shopelectro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fidals/shopelectro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fidals/shopelectro/git/refs{/sha}","trees_url":"https://api.github.com/repos/fidals/shopelectro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fidals/shopelectro/statuses/{sha}","languages_url":"https://api.github.com/repos/fidals/shopelectro/languages","stargazers_url":"https://api.github.com/repos/fidals/shopelectro/stargazers","contributors_url":"https://api.github.com/repos/fidals/shopelectro/contributors","subscribers_url":"https://api.github.com/repos/fidals/shopelectro/subscribers","subscription_url":"https://api.github.com/repos/fidals/shopelectro/subscription","commits_url":"https://api.github.com/repos/fidals/shopelectro/commits{/sha}","git_commits_url":"https://api.github.com/repos/fidals/shopelectro/git/commits{/sha}","comments_url":"https://api.github.com/repos/fidals/shopelectro/comments{/number}","issue_comment_url":"https://api.github.com/repos/fidals/shopelectro/issues/comments{/number}","contents_url":"https://api.github.com/repos/fidals/shopelectro/contents/{+path}","compare_url":"https://api.github.com/repos/fidals/shopelectro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fidals/shopelectro/merges","archive_url":"https://api.github.com/repos/fidals/shopelectro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fidals/shopelectro/downloads","issues_url":"https://api.github.com/repos/fidals/shopelectro/issues{/number}","pulls_url":"https://api.github.com/repos/fidals/shopelectro/pulls{/number}","milestones_url":"https://api.github.com/repos/fidals/shopelectro/milestones{/number}","notifications_url":"https://api.github.com/repos/fidals/shopelectro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fidals/shopelectro/labels{/name}","releases_url":"https://api.github.com/repos/fidals/shopelectro/releases{/id}","deployments_url":"https://api.github.com/repos/fidals/shopelectro/deployments","created_at":"2016-04-28T12:43:43Z","updated_at":"2016-05-12T08:41:23Z","pushed_at":"2016-07-01T13:07:39Z","git_url":"git://github.com/fidals/shopelectro.git","ssh_url":"git@github.com:fidals/shopelectro.git","clone_url":"https://github.com/fidals/shopelectro.git","svn_url":"https://github.com/fidals/shopelectro","homepage":null,"size":3298,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"fidals:master","ref":"master","sha":"e101e87f8c29035dc492fdd6cc97d93d94a85904","user":{"login":"fidals","id":16228604,"avatar_url":"https://avatars.githubusercontent.com/u/16228604?v=3","gravatar_id":"","url":"https://api.github.com/users/fidals","html_url":"https://github.com/fidals","followers_url":"https://api.github.com/users/fidals/followers","following_url":"https://api.github.com/users/fidals/following{/other_user}","gists_url":"https://api.github.com/users/fidals/gists{/gist_id}","starred_url":"https://api.github.com/users/fidals/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fidals/subscriptions","organizations_url":"https://api.github.com/users/fidals/orgs","repos_url":"https://api.github.com/users/fidals/repos","events_url":"https://api.github.com/users/fidals/events{/privacy}","received_events_url":"https://api.github.com/users/fidals/received_events","type":"Organization","site_admin":false},"repo":{"id":57301144,"name":"shopelectro","full_name":"fidals/shopelectro","owner":{"login":"fidals","id":16228604,"avatar_url":"https://avatars.githubusercontent.com/u/16228604?v=3","gravatar_id":"","url":"https://api.github.com/users/fidals","html_url":"https://github.com/fidals","followers_url":"https://api.github.com/users/fidals/followers","following_url":"https://api.github.com/users/fidals/following{/other_user}","gists_url":"https://api.github.com/users/fidals/gists{/gist_id}","starred_url":"https://api.github.com/users/fidals/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fidals/subscriptions","organizations_url":"https://api.github.com/users/fidals/orgs","repos_url":"https://api.github.com/users/fidals/repos","events_url":"https://api.github.com/users/fidals/events{/privacy}","received_events_url":"https://api.github.com/users/fidals/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fidals/shopelectro","description":"shopelectro.ru site's code","fork":false,"url":"https://api.github.com/repos/fidals/shopelectro","forks_url":"https://api.github.com/repos/fidals/shopelectro/forks","keys_url":"https://api.github.com/repos/fidals/shopelectro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fidals/shopelectro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fidals/shopelectro/teams","hooks_url":"https://api.github.com/repos/fidals/shopelectro/hooks","issue_events_url":"https://api.github.com/repos/fidals/shopelectro/issues/events{/number}","events_url":"https://api.github.com/repos/fidals/shopelectro/events","assignees_url":"https://api.github.com/repos/fidals/shopelectro/assignees{/user}","branches_url":"https://api.github.com/repos/fidals/shopelectro/branches{/branch}","tags_url":"https://api.github.com/repos/fidals/shopelectro/tags","blobs_url":"https://api.github.com/repos/fidals/shopelectro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fidals/shopelectro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fidals/shopelectro/git/refs{/sha}","trees_url":"https://api.github.com/repos/fidals/shopelectro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fidals/shopelectro/statuses/{sha}","languages_url":"https://api.github.com/repos/fidals/shopelectro/languages","stargazers_url":"https://api.github.com/repos/fidals/shopelectro/stargazers","contributors_url":"https://api.github.com/repos/fidals/shopelectro/contributors","subscribers_url":"https://api.github.com/repos/fidals/shopelectro/subscribers","subscription_url":"https://api.github.com/repos/fidals/shopelectro/subscription","commits_url":"https://api.github.com/repos/fidals/shopelectro/commits{/sha}","git_commits_url":"https://api.github.com/repos/fidals/shopelectro/git/commits{/sha}","comments_url":"https://api.github.com/repos/fidals/shopelectro/comments{/number}","issue_comment_url":"https://api.github.com/repos/fidals/shopelectro/issues/comments{/number}","contents_url":"https://api.github.com/repos/fidals/shopelectro/contents/{+path}","compare_url":"https://api.github.com/repos/fidals/shopelectro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fidals/shopelectro/merges","archive_url":"https://api.github.com/repos/fidals/shopelectro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fidals/shopelectro/downloads","issues_url":"https://api.github.com/repos/fidals/shopelectro/issues{/number}","pulls_url":"https://api.github.com/repos/fidals/shopelectro/pulls{/number}","milestones_url":"https://api.github.com/repos/fidals/shopelectro/milestones{/number}","notifications_url":"https://api.github.com/repos/fidals/shopelectro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fidals/shopelectro/labels{/name}","releases_url":"https://api.github.com/repos/fidals/shopelectro/releases{/id}","deployments_url":"https://api.github.com/repos/fidals/shopelectro/deployments","created_at":"2016-04-28T12:43:43Z","updated_at":"2016-05-12T08:41:23Z","pushed_at":"2016-07-01T13:07:39Z","git_url":"git://github.com/fidals/shopelectro.git","ssh_url":"git@github.com:fidals/shopelectro.git","clone_url":"https://github.com/fidals/shopelectro.git","svn_url":"https://github.com/fidals/shopelectro","homepage":null,"size":3298,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fidals/shopelectro/pulls/33"},"html":{"href":"https://github.com/fidals/shopelectro/pull/33"},"issue":{"href":"https://api.github.com/repos/fidals/shopelectro/issues/33"},"comments":{"href":"https://api.github.com/repos/fidals/shopelectro/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/fidals/shopelectro/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/fidals/shopelectro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fidals/shopelectro/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/fidals/shopelectro/statuses/a00a1f399fd0bd624037a6c1af049e64bd75e02b"}}}}
{"actor":{"display_login":"duker33"}}