{"action":"created","comment":{"url":"https://api.github.com/repos/is51/catan/pulls/comments/39928473","id":39928473,"diff_hunk":"@@ -0,0 +1,95 @@\n+'use strict';\n+\n+angular.module('catan')\n+        .factory('GameModel', ['$q', 'Remote', 'User', '$timeout', function ($q, Remote, User, $timeout) {\n+\n+            var GAME_PRIMARY_KEY = \"gameId\";\n+\n+            var STATUS_NOT_LOADED = 0,\n+                STATUS_LOADED = 1;\n+\n+            return function(idOrDetails) {\n+\n+                var id,\n+                    status = STATUS_NOT_LOADED,\n+                    details = {},\n+                    updatingTimeout = null;\n+\n+                if (typeof idOrDetails === \"number\") {\n+                    id = idOrDetails;\n+                } else if (typeof idOrDetails === \"object\") {\n+                    id = idOrDetails[GAME_PRIMARY_KEY];\n+                    details = idOrDetails;\n+                    status = STATUS_LOADED;\n+                }\n+\n+                return {\n+                    isLoaded: function() {\n+                        return status === STATUS_LOADED;\n+                    },\n+                    load: function() {\n+                        var deferred = $q.defer();\n+\n+                        Remote.game.details({gameId: id}).then(function(response) {\n+                            details = response.data;\n+                            status = STATUS_LOADED;\n+                            deferred.resolve();\n+                        }, function() {\n+                            deferred.reject();\n+                        });\n+\n+                        return deferred.promise;\n+                    },\n+                    startUpdating: function(delay, onEverySuccess, onEveryError) {\n+                        var self = this;\n+                        this.stopUpdating();","path":"src/main/webapp/features/shared/services/game/GameModel.service.js","position":45,"original_position":45,"commit_id":"c704b722ab97e8246d13f453d3fe8beeede0a6b5","original_commit_id":"c3dad48681462dfbbfdfe0bfedd154505779c626","user":{"login":"andrii-r","id":5818527,"avatar_url":"https://avatars.githubusercontent.com/u/5818527?v=3","gravatar_id":"","url":"https://api.github.com/users/andrii-r","html_url":"https://github.com/andrii-r","followers_url":"https://api.github.com/users/andrii-r/followers","following_url":"https://api.github.com/users/andrii-r/following{/other_user}","gists_url":"https://api.github.com/users/andrii-r/gists{/gist_id}","starred_url":"https://api.github.com/users/andrii-r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrii-r/subscriptions","organizations_url":"https://api.github.com/users/andrii-r/orgs","repos_url":"https://api.github.com/users/andrii-r/repos","events_url":"https://api.github.com/users/andrii-r/events{/privacy}","received_events_url":"https://api.github.com/users/andrii-r/received_events","type":"User","site_admin":false},"body":"I mean, why we call this.stopUpdating() inside  startUpdating function? as I understand, we should do it only when startUpdating function was already called and we should cancel previously created timer. so the question is it really can happen, when we call startUpdating more than one time?\r\n","created_at":"2015-09-20T10:23:32Z","updated_at":"2015-09-20T10:23:32Z","html_url":"https://github.com/is51/catan/pull/5#discussion_r39928473","pull_request_url":"https://api.github.com/repos/is51/catan/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/is51/catan/pulls/comments/39928473"},"html":{"href":"https://github.com/is51/catan/pull/5#discussion_r39928473"},"pull_request":{"href":"https://api.github.com/repos/is51/catan/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/is51/catan/pulls/5","id":42753272,"html_url":"https://github.com/is51/catan/pull/5","diff_url":"https://github.com/is51/catan/pull/5.diff","patch_url":"https://github.com/is51/catan/pull/5.patch","issue_url":"https://api.github.com/repos/is51/catan/issues/5","number":5,"state":"open","locked":false,"title":"Us 31 game dashboard and redirect","user":{"login":"skisor","id":12626297,"avatar_url":"https://avatars.githubusercontent.com/u/12626297?v=3","gravatar_id":"","url":"https://api.github.com/users/skisor","html_url":"https://github.com/skisor","followers_url":"https://api.github.com/users/skisor/followers","following_url":"https://api.github.com/users/skisor/following{/other_user}","gists_url":"https://api.github.com/users/skisor/gists{/gist_id}","starred_url":"https://api.github.com/users/skisor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skisor/subscriptions","organizations_url":"https://api.github.com/users/skisor/orgs","repos_url":"https://api.github.com/users/skisor/repos","events_url":"https://api.github.com/users/skisor/events{/privacy}","received_events_url":"https://api.github.com/users/skisor/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-18T21:48:45Z","updated_at":"2015-09-20T10:23:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b4fb5ae092e0528b9aafe7be3eae7483dd8c69e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/is51/catan/pulls/5/commits","review_comments_url":"https://api.github.com/repos/is51/catan/pulls/5/comments","review_comment_url":"https://api.github.com/repos/is51/catan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/is51/catan/issues/5/comments","statuses_url":"https://api.github.com/repos/is51/catan/statuses/c704b722ab97e8246d13f453d3fe8beeede0a6b5","head":{"label":"is51:US-31-Game-Dashboard-and-redirect","ref":"US-31-Game-Dashboard-and-redirect","sha":"c704b722ab97e8246d13f453d3fe8beeede0a6b5","user":{"login":"is51","id":13038634,"avatar_url":"https://avatars.githubusercontent.com/u/13038634?v=3","gravatar_id":"","url":"https://api.github.com/users/is51","html_url":"https://github.com/is51","followers_url":"https://api.github.com/users/is51/followers","following_url":"https://api.github.com/users/is51/following{/other_user}","gists_url":"https://api.github.com/users/is51/gists{/gist_id}","starred_url":"https://api.github.com/users/is51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/is51/subscriptions","organizations_url":"https://api.github.com/users/is51/orgs","repos_url":"https://api.github.com/users/is51/repos","events_url":"https://api.github.com/users/is51/events{/privacy}","received_events_url":"https://api.github.com/users/is51/received_events","type":"Organization","site_admin":false},"repo":{"id":38006336,"name":"catan","full_name":"is51/catan","owner":{"login":"is51","id":13038634,"avatar_url":"https://avatars.githubusercontent.com/u/13038634?v=3","gravatar_id":"","url":"https://api.github.com/users/is51","html_url":"https://github.com/is51","followers_url":"https://api.github.com/users/is51/followers","following_url":"https://api.github.com/users/is51/following{/other_user}","gists_url":"https://api.github.com/users/is51/gists{/gist_id}","starred_url":"https://api.github.com/users/is51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/is51/subscriptions","organizations_url":"https://api.github.com/users/is51/orgs","repos_url":"https://api.github.com/users/is51/repos","events_url":"https://api.github.com/users/is51/events{/privacy}","received_events_url":"https://api.github.com/users/is51/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/is51/catan","description":"","fork":false,"url":"https://api.github.com/repos/is51/catan","forks_url":"https://api.github.com/repos/is51/catan/forks","keys_url":"https://api.github.com/repos/is51/catan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/is51/catan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/is51/catan/teams","hooks_url":"https://api.github.com/repos/is51/catan/hooks","issue_events_url":"https://api.github.com/repos/is51/catan/issues/events{/number}","events_url":"https://api.github.com/repos/is51/catan/events","assignees_url":"https://api.github.com/repos/is51/catan/assignees{/user}","branches_url":"https://api.github.com/repos/is51/catan/branches{/branch}","tags_url":"https://api.github.com/repos/is51/catan/tags","blobs_url":"https://api.github.com/repos/is51/catan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/is51/catan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/is51/catan/git/refs{/sha}","trees_url":"https://api.github.com/repos/is51/catan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/is51/catan/statuses/{sha}","languages_url":"https://api.github.com/repos/is51/catan/languages","stargazers_url":"https://api.github.com/repos/is51/catan/stargazers","contributors_url":"https://api.github.com/repos/is51/catan/contributors","subscribers_url":"https://api.github.com/repos/is51/catan/subscribers","subscription_url":"https://api.github.com/repos/is51/catan/subscription","commits_url":"https://api.github.com/repos/is51/catan/commits{/sha}","git_commits_url":"https://api.github.com/repos/is51/catan/git/commits{/sha}","comments_url":"https://api.github.com/repos/is51/catan/comments{/number}","issue_comment_url":"https://api.github.com/repos/is51/catan/issues/comments{/number}","contents_url":"https://api.github.com/repos/is51/catan/contents/{+path}","compare_url":"https://api.github.com/repos/is51/catan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/is51/catan/merges","archive_url":"https://api.github.com/repos/is51/catan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/is51/catan/downloads","issues_url":"https://api.github.com/repos/is51/catan/issues{/number}","pulls_url":"https://api.github.com/repos/is51/catan/pulls{/number}","milestones_url":"https://api.github.com/repos/is51/catan/milestones{/number}","notifications_url":"https://api.github.com/repos/is51/catan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/is51/catan/labels{/name}","releases_url":"https://api.github.com/repos/is51/catan/releases{/id}","created_at":"2015-06-24T19:28:17Z","updated_at":"2015-06-26T22:01:06Z","pushed_at":"2015-09-18T16:01:54Z","git_url":"git://github.com/is51/catan.git","ssh_url":"git@github.com:is51/catan.git","clone_url":"https://github.com/is51/catan.git","svn_url":"https://github.com/is51/catan","homepage":null,"size":3196,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"is51:master","ref":"master","sha":"cdf574c605049ba15c694f781f145f972b520b94","user":{"login":"is51","id":13038634,"avatar_url":"https://avatars.githubusercontent.com/u/13038634?v=3","gravatar_id":"","url":"https://api.github.com/users/is51","html_url":"https://github.com/is51","followers_url":"https://api.github.com/users/is51/followers","following_url":"https://api.github.com/users/is51/following{/other_user}","gists_url":"https://api.github.com/users/is51/gists{/gist_id}","starred_url":"https://api.github.com/users/is51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/is51/subscriptions","organizations_url":"https://api.github.com/users/is51/orgs","repos_url":"https://api.github.com/users/is51/repos","events_url":"https://api.github.com/users/is51/events{/privacy}","received_events_url":"https://api.github.com/users/is51/received_events","type":"Organization","site_admin":false},"repo":{"id":38006336,"name":"catan","full_name":"is51/catan","owner":{"login":"is51","id":13038634,"avatar_url":"https://avatars.githubusercontent.com/u/13038634?v=3","gravatar_id":"","url":"https://api.github.com/users/is51","html_url":"https://github.com/is51","followers_url":"https://api.github.com/users/is51/followers","following_url":"https://api.github.com/users/is51/following{/other_user}","gists_url":"https://api.github.com/users/is51/gists{/gist_id}","starred_url":"https://api.github.com/users/is51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/is51/subscriptions","organizations_url":"https://api.github.com/users/is51/orgs","repos_url":"https://api.github.com/users/is51/repos","events_url":"https://api.github.com/users/is51/events{/privacy}","received_events_url":"https://api.github.com/users/is51/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/is51/catan","description":"","fork":false,"url":"https://api.github.com/repos/is51/catan","forks_url":"https://api.github.com/repos/is51/catan/forks","keys_url":"https://api.github.com/repos/is51/catan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/is51/catan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/is51/catan/teams","hooks_url":"https://api.github.com/repos/is51/catan/hooks","issue_events_url":"https://api.github.com/repos/is51/catan/issues/events{/number}","events_url":"https://api.github.com/repos/is51/catan/events","assignees_url":"https://api.github.com/repos/is51/catan/assignees{/user}","branches_url":"https://api.github.com/repos/is51/catan/branches{/branch}","tags_url":"https://api.github.com/repos/is51/catan/tags","blobs_url":"https://api.github.com/repos/is51/catan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/is51/catan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/is51/catan/git/refs{/sha}","trees_url":"https://api.github.com/repos/is51/catan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/is51/catan/statuses/{sha}","languages_url":"https://api.github.com/repos/is51/catan/languages","stargazers_url":"https://api.github.com/repos/is51/catan/stargazers","contributors_url":"https://api.github.com/repos/is51/catan/contributors","subscribers_url":"https://api.github.com/repos/is51/catan/subscribers","subscription_url":"https://api.github.com/repos/is51/catan/subscription","commits_url":"https://api.github.com/repos/is51/catan/commits{/sha}","git_commits_url":"https://api.github.com/repos/is51/catan/git/commits{/sha}","comments_url":"https://api.github.com/repos/is51/catan/comments{/number}","issue_comment_url":"https://api.github.com/repos/is51/catan/issues/comments{/number}","contents_url":"https://api.github.com/repos/is51/catan/contents/{+path}","compare_url":"https://api.github.com/repos/is51/catan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/is51/catan/merges","archive_url":"https://api.github.com/repos/is51/catan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/is51/catan/downloads","issues_url":"https://api.github.com/repos/is51/catan/issues{/number}","pulls_url":"https://api.github.com/repos/is51/catan/pulls{/number}","milestones_url":"https://api.github.com/repos/is51/catan/milestones{/number}","notifications_url":"https://api.github.com/repos/is51/catan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/is51/catan/labels{/name}","releases_url":"https://api.github.com/repos/is51/catan/releases{/id}","created_at":"2015-06-24T19:28:17Z","updated_at":"2015-06-26T22:01:06Z","pushed_at":"2015-09-18T16:01:54Z","git_url":"git://github.com/is51/catan.git","ssh_url":"git@github.com:is51/catan.git","clone_url":"https://github.com/is51/catan.git","svn_url":"https://github.com/is51/catan","homepage":null,"size":3196,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/is51/catan/pulls/5"},"html":{"href":"https://github.com/is51/catan/pull/5"},"issue":{"href":"https://api.github.com/repos/is51/catan/issues/5"},"comments":{"href":"https://api.github.com/repos/is51/catan/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/is51/catan/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/is51/catan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/is51/catan/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/is51/catan/statuses/c704b722ab97e8246d13f453d3fe8beeede0a6b5"}}}}