{"action":"created","comment":{"url":"https://api.github.com/repos/antonbobkov/potato_game/pulls/comments/222878162","pull_request_review_id":161872905,"id":222878162,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjg3ODE2Mg==","diff_hunk":"@@ -0,0 +1,81 @@\n+-module(pending_transactions_test).\n+\n+-include_lib(\"stdlib/include/assert.hrl\").\n+-include_lib(\"eunit/include/eunit.hrl\").\n+\n+-include(\"../src/potato_records.hrl\").\n+\n+fold_transactions(T, {PendingTx, _Status}) when is_map(T) ->\n+    pending_transactions:add_transaction(T, PendingTx);\n+fold_transactions({Nonce, Id}, Acc) ->\n+    fold_transactions(#{nonce => Nonce, player_id => Id}, Acc);\n+fold_transactions({Nonce, Id, Data}, Acc) ->\n+    fold_transactions(#{nonce => Nonce, player_id => Id, game_data => Data}, Acc);\n+fold_transactions(Nonce, Acc) ->\n+    fold_transactions(#{nonce => Nonce, player_id => default_id}, Acc).\n+\n+apply_transactions(TxList, PendingTx) ->\n+    lists:foldl(fun fold_transactions/2, {PendingTx, dummy}, TxList).\n+\n+apply_transactions(TxList) -> apply_transactions(TxList, pending_transactions:init()).\n+\n+get_nonce_counter_list(PlayerId, #pending_tx{player_map = PlMap}) ->\n+    TxMap = maps:get(PlayerId, PlMap),\n+    NonceList = lists:sort(maps:keys(TxMap)), \n+    lists:map(fun(Nonce) -> \n+\t\t      {Counter, T} = maps:get(Nonce, TxMap),\n+\t\t      Nonce = maps:get(nonce, T),\n+\t\t      {Nonce, Counter} \n+\t      end, \n+\t      NonceList).\n+\n+get_nonce_counter_list(PT) -> get_nonce_counter_list(default_id, PT).\n+\n+get_nonce_list(PlayerId, PT) ->\n+    lists:map(fun({Nonce, _Counter}) -> Nonce end, get_nonce_counter_list(PlayerId, PT)).\n+    \n+get_nonce_list(PT) -> get_nonce_list(default_id, PT).\n+\n+get_final_nonces(List) ->\n+    {PT1, _} = apply_transactions(List),\n+    get_nonce_list(PT1).\n+\n+get_final_nonces_counters(List) ->\n+    {PT1, _} = apply_transactions(List),\n+    get_nonce_counter_list(PT1).\n+\n+no_repeats(List) ->\n+    array:to_list(","path":"test/pending_transactions_test.erl","position":48,"original_position":48,"commit_id":"f6b44f4c950941fddb12a5ea38c320bd1fa7e271","original_commit_id":"f6b44f4c950941fddb12a5ea38c320bd1fa7e271","user":{"login":"pdlla","id":108157,"node_id":"MDQ6VXNlcjEwODE1Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/108157?v=4","gravatar_id":"","url":"https://api.github.com/users/pdlla","html_url":"https://github.com/pdlla","followers_url":"https://api.github.com/users/pdlla/followers","following_url":"https://api.github.com/users/pdlla/following{/other_user}","gists_url":"https://api.github.com/users/pdlla/gists{/gist_id}","starred_url":"https://api.github.com/users/pdlla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdlla/subscriptions","organizations_url":"https://api.github.com/users/pdlla/orgs","repos_url":"https://api.github.com/users/pdlla/repos","events_url":"https://api.github.com/users/pdlla/events{/privacy}","received_events_url":"https://api.github.com/users/pdlla/received_events","type":"User","site_admin":false},"body":"😱 ","created_at":"2018-10-05T02:28:24Z","updated_at":"2018-10-05T02:28:25Z","html_url":"https://github.com/antonbobkov/potato_game/pull/29#discussion_r222878162","pull_request_url":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/antonbobkov/potato_game/pulls/comments/222878162"},"html":{"href":"https://github.com/antonbobkov/potato_game/pull/29#discussion_r222878162"},"pull_request":{"href":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29","id":220476724,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNDc2NzI0","html_url":"https://github.com/antonbobkov/potato_game/pull/29","diff_url":"https://github.com/antonbobkov/potato_game/pull/29.diff","patch_url":"https://github.com/antonbobkov/potato_game/pull/29.patch","issue_url":"https://api.github.com/repos/antonbobkov/potato_game/issues/29","number":29,"state":"open","locked":false,"title":"boop: tests and fixes","user":{"login":"antonbobkov","id":5906474,"node_id":"MDQ6VXNlcjU5MDY0NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5906474?v=4","gravatar_id":"","url":"https://api.github.com/users/antonbobkov","html_url":"https://github.com/antonbobkov","followers_url":"https://api.github.com/users/antonbobkov/followers","following_url":"https://api.github.com/users/antonbobkov/following{/other_user}","gists_url":"https://api.github.com/users/antonbobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/antonbobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonbobkov/subscriptions","organizations_url":"https://api.github.com/users/antonbobkov/orgs","repos_url":"https://api.github.com/users/antonbobkov/repos","events_url":"https://api.github.com/users/antonbobkov/events{/privacy}","received_events_url":"https://api.github.com/users/antonbobkov/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-04T18:37:01Z","updated_at":"2018-10-05T02:28:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b30548f8e41500a7a8f36ee870ab46a1a1ca9ed","assignee":{"login":"pdlla","id":108157,"node_id":"MDQ6VXNlcjEwODE1Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/108157?v=4","gravatar_id":"","url":"https://api.github.com/users/pdlla","html_url":"https://github.com/pdlla","followers_url":"https://api.github.com/users/pdlla/followers","following_url":"https://api.github.com/users/pdlla/following{/other_user}","gists_url":"https://api.github.com/users/pdlla/gists{/gist_id}","starred_url":"https://api.github.com/users/pdlla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdlla/subscriptions","organizations_url":"https://api.github.com/users/pdlla/orgs","repos_url":"https://api.github.com/users/pdlla/repos","events_url":"https://api.github.com/users/pdlla/events{/privacy}","received_events_url":"https://api.github.com/users/pdlla/received_events","type":"User","site_admin":false},"assignees":[{"login":"pdlla","id":108157,"node_id":"MDQ6VXNlcjEwODE1Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/108157?v=4","gravatar_id":"","url":"https://api.github.com/users/pdlla","html_url":"https://github.com/pdlla","followers_url":"https://api.github.com/users/pdlla/followers","following_url":"https://api.github.com/users/pdlla/following{/other_user}","gists_url":"https://api.github.com/users/pdlla/gists{/gist_id}","starred_url":"https://api.github.com/users/pdlla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdlla/subscriptions","organizations_url":"https://api.github.com/users/pdlla/orgs","repos_url":"https://api.github.com/users/pdlla/repos","events_url":"https://api.github.com/users/pdlla/events{/privacy}","received_events_url":"https://api.github.com/users/pdlla/received_events","type":"User","site_admin":false},{"login":"antonbobkov","id":5906474,"node_id":"MDQ6VXNlcjU5MDY0NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5906474?v=4","gravatar_id":"","url":"https://api.github.com/users/antonbobkov","html_url":"https://github.com/antonbobkov","followers_url":"https://api.github.com/users/antonbobkov/followers","following_url":"https://api.github.com/users/antonbobkov/following{/other_user}","gists_url":"https://api.github.com/users/antonbobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/antonbobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonbobkov/subscriptions","organizations_url":"https://api.github.com/users/antonbobkov/orgs","repos_url":"https://api.github.com/users/antonbobkov/repos","events_url":"https://api.github.com/users/antonbobkov/events{/privacy}","received_events_url":"https://api.github.com/users/antonbobkov/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29/commits","review_comments_url":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29/comments","review_comment_url":"https://api.github.com/repos/antonbobkov/potato_game/pulls/comments{/number}","comments_url":"https://api.github.com/repos/antonbobkov/potato_game/issues/29/comments","statuses_url":"https://api.github.com/repos/antonbobkov/potato_game/statuses/f6b44f4c950941fddb12a5ea38c320bd1fa7e271","head":{"label":"antonbobkov:pending","ref":"pending","sha":"f6b44f4c950941fddb12a5ea38c320bd1fa7e271","user":{"login":"antonbobkov","id":5906474,"node_id":"MDQ6VXNlcjU5MDY0NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5906474?v=4","gravatar_id":"","url":"https://api.github.com/users/antonbobkov","html_url":"https://github.com/antonbobkov","followers_url":"https://api.github.com/users/antonbobkov/followers","following_url":"https://api.github.com/users/antonbobkov/following{/other_user}","gists_url":"https://api.github.com/users/antonbobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/antonbobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonbobkov/subscriptions","organizations_url":"https://api.github.com/users/antonbobkov/orgs","repos_url":"https://api.github.com/users/antonbobkov/repos","events_url":"https://api.github.com/users/antonbobkov/events{/privacy}","received_events_url":"https://api.github.com/users/antonbobkov/received_events","type":"User","site_admin":false},"repo":{"id":143477769,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM0Nzc3Njk=","name":"potato_game","full_name":"antonbobkov/potato_game","private":false,"owner":{"login":"antonbobkov","id":5906474,"node_id":"MDQ6VXNlcjU5MDY0NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5906474?v=4","gravatar_id":"","url":"https://api.github.com/users/antonbobkov","html_url":"https://github.com/antonbobkov","followers_url":"https://api.github.com/users/antonbobkov/followers","following_url":"https://api.github.com/users/antonbobkov/following{/other_user}","gists_url":"https://api.github.com/users/antonbobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/antonbobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonbobkov/subscriptions","organizations_url":"https://api.github.com/users/antonbobkov/orgs","repos_url":"https://api.github.com/users/antonbobkov/repos","events_url":"https://api.github.com/users/antonbobkov/events{/privacy}","received_events_url":"https://api.github.com/users/antonbobkov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/antonbobkov/potato_game","description":null,"fork":false,"url":"https://api.github.com/repos/antonbobkov/potato_game","forks_url":"https://api.github.com/repos/antonbobkov/potato_game/forks","keys_url":"https://api.github.com/repos/antonbobkov/potato_game/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antonbobkov/potato_game/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antonbobkov/potato_game/teams","hooks_url":"https://api.github.com/repos/antonbobkov/potato_game/hooks","issue_events_url":"https://api.github.com/repos/antonbobkov/potato_game/issues/events{/number}","events_url":"https://api.github.com/repos/antonbobkov/potato_game/events","assignees_url":"https://api.github.com/repos/antonbobkov/potato_game/assignees{/user}","branches_url":"https://api.github.com/repos/antonbobkov/potato_game/branches{/branch}","tags_url":"https://api.github.com/repos/antonbobkov/potato_game/tags","blobs_url":"https://api.github.com/repos/antonbobkov/potato_game/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antonbobkov/potato_game/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antonbobkov/potato_game/git/refs{/sha}","trees_url":"https://api.github.com/repos/antonbobkov/potato_game/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antonbobkov/potato_game/statuses/{sha}","languages_url":"https://api.github.com/repos/antonbobkov/potato_game/languages","stargazers_url":"https://api.github.com/repos/antonbobkov/potato_game/stargazers","contributors_url":"https://api.github.com/repos/antonbobkov/potato_game/contributors","subscribers_url":"https://api.github.com/repos/antonbobkov/potato_game/subscribers","subscription_url":"https://api.github.com/repos/antonbobkov/potato_game/subscription","commits_url":"https://api.github.com/repos/antonbobkov/potato_game/commits{/sha}","git_commits_url":"https://api.github.com/repos/antonbobkov/potato_game/git/commits{/sha}","comments_url":"https://api.github.com/repos/antonbobkov/potato_game/comments{/number}","issue_comment_url":"https://api.github.com/repos/antonbobkov/potato_game/issues/comments{/number}","contents_url":"https://api.github.com/repos/antonbobkov/potato_game/contents/{+path}","compare_url":"https://api.github.com/repos/antonbobkov/potato_game/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antonbobkov/potato_game/merges","archive_url":"https://api.github.com/repos/antonbobkov/potato_game/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antonbobkov/potato_game/downloads","issues_url":"https://api.github.com/repos/antonbobkov/potato_game/issues{/number}","pulls_url":"https://api.github.com/repos/antonbobkov/potato_game/pulls{/number}","milestones_url":"https://api.github.com/repos/antonbobkov/potato_game/milestones{/number}","notifications_url":"https://api.github.com/repos/antonbobkov/potato_game/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antonbobkov/potato_game/labels{/name}","releases_url":"https://api.github.com/repos/antonbobkov/potato_game/releases{/id}","deployments_url":"https://api.github.com/repos/antonbobkov/potato_game/deployments","created_at":"2018-08-03T22:15:41Z","updated_at":"2018-10-03T22:59:30Z","pushed_at":"2018-10-04T18:37:02Z","git_url":"git://github.com/antonbobkov/potato_game.git","ssh_url":"git@github.com:antonbobkov/potato_game.git","clone_url":"https://github.com/antonbobkov/potato_game.git","svn_url":"https://github.com/antonbobkov/potato_game","homepage":null,"size":171,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"antonbobkov:master","ref":"master","sha":"d787b689445b9e0c74f745db6e42f623edb5f4d2","user":{"login":"antonbobkov","id":5906474,"node_id":"MDQ6VXNlcjU5MDY0NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5906474?v=4","gravatar_id":"","url":"https://api.github.com/users/antonbobkov","html_url":"https://github.com/antonbobkov","followers_url":"https://api.github.com/users/antonbobkov/followers","following_url":"https://api.github.com/users/antonbobkov/following{/other_user}","gists_url":"https://api.github.com/users/antonbobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/antonbobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonbobkov/subscriptions","organizations_url":"https://api.github.com/users/antonbobkov/orgs","repos_url":"https://api.github.com/users/antonbobkov/repos","events_url":"https://api.github.com/users/antonbobkov/events{/privacy}","received_events_url":"https://api.github.com/users/antonbobkov/received_events","type":"User","site_admin":false},"repo":{"id":143477769,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM0Nzc3Njk=","name":"potato_game","full_name":"antonbobkov/potato_game","private":false,"owner":{"login":"antonbobkov","id":5906474,"node_id":"MDQ6VXNlcjU5MDY0NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5906474?v=4","gravatar_id":"","url":"https://api.github.com/users/antonbobkov","html_url":"https://github.com/antonbobkov","followers_url":"https://api.github.com/users/antonbobkov/followers","following_url":"https://api.github.com/users/antonbobkov/following{/other_user}","gists_url":"https://api.github.com/users/antonbobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/antonbobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonbobkov/subscriptions","organizations_url":"https://api.github.com/users/antonbobkov/orgs","repos_url":"https://api.github.com/users/antonbobkov/repos","events_url":"https://api.github.com/users/antonbobkov/events{/privacy}","received_events_url":"https://api.github.com/users/antonbobkov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/antonbobkov/potato_game","description":null,"fork":false,"url":"https://api.github.com/repos/antonbobkov/potato_game","forks_url":"https://api.github.com/repos/antonbobkov/potato_game/forks","keys_url":"https://api.github.com/repos/antonbobkov/potato_game/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antonbobkov/potato_game/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antonbobkov/potato_game/teams","hooks_url":"https://api.github.com/repos/antonbobkov/potato_game/hooks","issue_events_url":"https://api.github.com/repos/antonbobkov/potato_game/issues/events{/number}","events_url":"https://api.github.com/repos/antonbobkov/potato_game/events","assignees_url":"https://api.github.com/repos/antonbobkov/potato_game/assignees{/user}","branches_url":"https://api.github.com/repos/antonbobkov/potato_game/branches{/branch}","tags_url":"https://api.github.com/repos/antonbobkov/potato_game/tags","blobs_url":"https://api.github.com/repos/antonbobkov/potato_game/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antonbobkov/potato_game/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antonbobkov/potato_game/git/refs{/sha}","trees_url":"https://api.github.com/repos/antonbobkov/potato_game/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antonbobkov/potato_game/statuses/{sha}","languages_url":"https://api.github.com/repos/antonbobkov/potato_game/languages","stargazers_url":"https://api.github.com/repos/antonbobkov/potato_game/stargazers","contributors_url":"https://api.github.com/repos/antonbobkov/potato_game/contributors","subscribers_url":"https://api.github.com/repos/antonbobkov/potato_game/subscribers","subscription_url":"https://api.github.com/repos/antonbobkov/potato_game/subscription","commits_url":"https://api.github.com/repos/antonbobkov/potato_game/commits{/sha}","git_commits_url":"https://api.github.com/repos/antonbobkov/potato_game/git/commits{/sha}","comments_url":"https://api.github.com/repos/antonbobkov/potato_game/comments{/number}","issue_comment_url":"https://api.github.com/repos/antonbobkov/potato_game/issues/comments{/number}","contents_url":"https://api.github.com/repos/antonbobkov/potato_game/contents/{+path}","compare_url":"https://api.github.com/repos/antonbobkov/potato_game/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antonbobkov/potato_game/merges","archive_url":"https://api.github.com/repos/antonbobkov/potato_game/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antonbobkov/potato_game/downloads","issues_url":"https://api.github.com/repos/antonbobkov/potato_game/issues{/number}","pulls_url":"https://api.github.com/repos/antonbobkov/potato_game/pulls{/number}","milestones_url":"https://api.github.com/repos/antonbobkov/potato_game/milestones{/number}","notifications_url":"https://api.github.com/repos/antonbobkov/potato_game/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antonbobkov/potato_game/labels{/name}","releases_url":"https://api.github.com/repos/antonbobkov/potato_game/releases{/id}","deployments_url":"https://api.github.com/repos/antonbobkov/potato_game/deployments","created_at":"2018-08-03T22:15:41Z","updated_at":"2018-10-03T22:59:30Z","pushed_at":"2018-10-04T18:37:02Z","git_url":"git://github.com/antonbobkov/potato_game.git","ssh_url":"git@github.com:antonbobkov/potato_game.git","clone_url":"https://github.com/antonbobkov/potato_game.git","svn_url":"https://github.com/antonbobkov/potato_game","homepage":null,"size":171,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29"},"html":{"href":"https://github.com/antonbobkov/potato_game/pull/29"},"issue":{"href":"https://api.github.com/repos/antonbobkov/potato_game/issues/29"},"comments":{"href":"https://api.github.com/repos/antonbobkov/potato_game/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/antonbobkov/potato_game/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/antonbobkov/potato_game/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/antonbobkov/potato_game/statuses/f6b44f4c950941fddb12a5ea38c320bd1fa7e271"}},"author_association":"OWNER"}}
{"actor":{"display_login":"pdlla"}}