{"action":"created","comment":{"url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/comments/217514310","pull_request_review_id":155247011,"id":217514310,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzUxNDMxMA==","diff_hunk":"@@ -172,12 +174,38 @@ public function getLatestTitledCaches($limit = 10, $offset = 0)\n      */\n     public function getLatestTitledCachesCount()\n     {\n+        $params = [];\n+        $statesSqlString = $this->fillAllowedStatesInQueryParams($params);\n         $query = '\n                 SELECT COUNT(*)\n                   FROM `local_caches`\n                   INNER JOIN `cache_titled` ON `local_caches`.`cache_id` = `cache_titled`.`cache_id`\n+                  WHERE `status` IN (' . $statesSqlString . ')\n                   LIMIT 1';\n-        return $this->db->simpleQueryValue($query, 0);\n+        return $this->db->paramQueryValue($query, 0, $params);\n+    }\n+\n+    /**\n+     * Adds parameters meant to be used in OcDb::paramQuery 'status IN()' clause,\n+     * according to predefined states, creating corresponding sql fragment string\n+     *\n+     * @param array $params Parameters to update\n+     *\n+     * @return string sql fragment to be used in 'IN()' clause inside query\n+     */\n+    private function fillAllowedStatesInQueryParams(&$params)\n+    {\n+        $result = \"\";\n+        foreach (\n+            [GeoCache::STATUS_READY, GeoCache::STATUS_UNAVAILABLE] as $status\n+        ) {\n+            $varName = \"status\" . $status;\n+            $params[$varName]['value'] = $status;\n+            $params[$varName]['data_type'] = 'integer';\n+            $result .=\n+                (strlen($result)>0 ? \", \" : \"\"). \":\". $varName;","path":"lib/Objects/Neighbourhood/MyNbhSets.php","position":47,"original_position":47,"commit_id":"3151c2939547aefd8315e8b6c89a9b222869fe8f","original_commit_id":"3151c2939547aefd8315e8b6c89a9b222869fe8f","user":{"login":"rapotek","id":17698165,"node_id":"MDQ6VXNlcjE3Njk4MTY1","avatar_url":"https://avatars0.githubusercontent.com/u/17698165?v=4","gravatar_id":"","url":"https://api.github.com/users/rapotek","html_url":"https://github.com/rapotek","followers_url":"https://api.github.com/users/rapotek/followers","following_url":"https://api.github.com/users/rapotek/following{/other_user}","gists_url":"https://api.github.com/users/rapotek/gists{/gist_id}","starred_url":"https://api.github.com/users/rapotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapotek/subscriptions","organizations_url":"https://api.github.com/users/rapotek/orgs","repos_url":"https://api.github.com/users/rapotek/repos","events_url":"https://api.github.com/users/rapotek/events{/privacy}","received_events_url":"https://api.github.com/users/rapotek/received_events","type":"User","site_admin":false},"body":"Ja się generalnie zgadzam, przy czym zapytanie w 'count' po prostu wykorzystuje kod użyty w zapytaniu wyciągającym, gdzie i tak są parametry. Stałe można przerobić na zwykłego stringa, ale to i tak nie zmieni tego, że parametry w zapytaniu wyciągającym kesze zostaną, bo są potrzebne gdzie indziej.","created_at":"2018-09-13T19:58:15Z","updated_at":"2018-09-13T19:58:15Z","html_url":"https://github.com/opencaching/opencaching-pl/pull/1609#discussion_r217514310","pull_request_url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/comments/217514310"},"html":{"href":"https://github.com/opencaching/opencaching-pl/pull/1609#discussion_r217514310"},"pull_request":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609"}},"in_reply_to_id":217496750},"pull_request":{"url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609","id":212383313,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMzgzMzEz","html_url":"https://github.com/opencaching/opencaching-pl/pull/1609","diff_url":"https://github.com/opencaching/opencaching-pl/pull/1609.diff","patch_url":"https://github.com/opencaching/opencaching-pl/pull/1609.patch","issue_url":"https://api.github.com/repos/opencaching/opencaching-pl/issues/1609","number":1609,"state":"open","locked":false,"title":"Only active and temp. unavailable titled caches in MyNbh (#1450 related)","user":{"login":"rapotek","id":17698165,"node_id":"MDQ6VXNlcjE3Njk4MTY1","avatar_url":"https://avatars0.githubusercontent.com/u/17698165?v=4","gravatar_id":"","url":"https://api.github.com/users/rapotek","html_url":"https://github.com/rapotek","followers_url":"https://api.github.com/users/rapotek/followers","following_url":"https://api.github.com/users/rapotek/following{/other_user}","gists_url":"https://api.github.com/users/rapotek/gists{/gist_id}","starred_url":"https://api.github.com/users/rapotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapotek/subscriptions","organizations_url":"https://api.github.com/users/rapotek/orgs","repos_url":"https://api.github.com/users/rapotek/repos","events_url":"https://api.github.com/users/rapotek/events{/privacy}","received_events_url":"https://api.github.com/users/rapotek/received_events","type":"User","site_admin":false},"body":"There should be no more archived titled caches visible in the MyNbh list - see [this comment](https://github.com/opencaching/opencaching-pl/issues/1450#issuecomment-401496828).\r\n\r\nWhy not only active, but temp. unavailable are allowed for list too? Because IMHO 'temp. unavailable' status means the cache is still in game.\r\n\r\n","created_at":"2018-08-31T13:27:51Z","updated_at":"2018-09-13T19:58:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c26c62e42ab0a801e56c5dcb6cec686b5c7d4555","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609/commits","review_comments_url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609/comments","review_comment_url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencaching/opencaching-pl/issues/1609/comments","statuses_url":"https://api.github.com/repos/opencaching/opencaching-pl/statuses/3151c2939547aefd8315e8b6c89a9b222869fe8f","head":{"label":"rapotek:1450_exclude_archived_titled_caches","ref":"1450_exclude_archived_titled_caches","sha":"3151c2939547aefd8315e8b6c89a9b222869fe8f","user":{"login":"rapotek","id":17698165,"node_id":"MDQ6VXNlcjE3Njk4MTY1","avatar_url":"https://avatars0.githubusercontent.com/u/17698165?v=4","gravatar_id":"","url":"https://api.github.com/users/rapotek","html_url":"https://github.com/rapotek","followers_url":"https://api.github.com/users/rapotek/followers","following_url":"https://api.github.com/users/rapotek/following{/other_user}","gists_url":"https://api.github.com/users/rapotek/gists{/gist_id}","starred_url":"https://api.github.com/users/rapotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapotek/subscriptions","organizations_url":"https://api.github.com/users/rapotek/orgs","repos_url":"https://api.github.com/users/rapotek/repos","events_url":"https://api.github.com/users/rapotek/events{/privacy}","received_events_url":"https://api.github.com/users/rapotek/received_events","type":"User","site_admin":false},"repo":{"id":110103611,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAxMDM2MTE=","name":"opencaching-pl","full_name":"rapotek/opencaching-pl","owner":{"login":"rapotek","id":17698165,"node_id":"MDQ6VXNlcjE3Njk4MTY1","avatar_url":"https://avatars0.githubusercontent.com/u/17698165?v=4","gravatar_id":"","url":"https://api.github.com/users/rapotek","html_url":"https://github.com/rapotek","followers_url":"https://api.github.com/users/rapotek/followers","following_url":"https://api.github.com/users/rapotek/following{/other_user}","gists_url":"https://api.github.com/users/rapotek/gists{/gist_id}","starred_url":"https://api.github.com/users/rapotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapotek/subscriptions","organizations_url":"https://api.github.com/users/rapotek/orgs","repos_url":"https://api.github.com/users/rapotek/repos","events_url":"https://api.github.com/users/rapotek/events{/privacy}","received_events_url":"https://api.github.com/users/rapotek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rapotek/opencaching-pl","description":"The source code of Opencaching.PL (and some other domains)","fork":true,"url":"https://api.github.com/repos/rapotek/opencaching-pl","forks_url":"https://api.github.com/repos/rapotek/opencaching-pl/forks","keys_url":"https://api.github.com/repos/rapotek/opencaching-pl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rapotek/opencaching-pl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rapotek/opencaching-pl/teams","hooks_url":"https://api.github.com/repos/rapotek/opencaching-pl/hooks","issue_events_url":"https://api.github.com/repos/rapotek/opencaching-pl/issues/events{/number}","events_url":"https://api.github.com/repos/rapotek/opencaching-pl/events","assignees_url":"https://api.github.com/repos/rapotek/opencaching-pl/assignees{/user}","branches_url":"https://api.github.com/repos/rapotek/opencaching-pl/branches{/branch}","tags_url":"https://api.github.com/repos/rapotek/opencaching-pl/tags","blobs_url":"https://api.github.com/repos/rapotek/opencaching-pl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rapotek/opencaching-pl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rapotek/opencaching-pl/git/refs{/sha}","trees_url":"https://api.github.com/repos/rapotek/opencaching-pl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rapotek/opencaching-pl/statuses/{sha}","languages_url":"https://api.github.com/repos/rapotek/opencaching-pl/languages","stargazers_url":"https://api.github.com/repos/rapotek/opencaching-pl/stargazers","contributors_url":"https://api.github.com/repos/rapotek/opencaching-pl/contributors","subscribers_url":"https://api.github.com/repos/rapotek/opencaching-pl/subscribers","subscription_url":"https://api.github.com/repos/rapotek/opencaching-pl/subscription","commits_url":"https://api.github.com/repos/rapotek/opencaching-pl/commits{/sha}","git_commits_url":"https://api.github.com/repos/rapotek/opencaching-pl/git/commits{/sha}","comments_url":"https://api.github.com/repos/rapotek/opencaching-pl/comments{/number}","issue_comment_url":"https://api.github.com/repos/rapotek/opencaching-pl/issues/comments{/number}","contents_url":"https://api.github.com/repos/rapotek/opencaching-pl/contents/{+path}","compare_url":"https://api.github.com/repos/rapotek/opencaching-pl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rapotek/opencaching-pl/merges","archive_url":"https://api.github.com/repos/rapotek/opencaching-pl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rapotek/opencaching-pl/downloads","issues_url":"https://api.github.com/repos/rapotek/opencaching-pl/issues{/number}","pulls_url":"https://api.github.com/repos/rapotek/opencaching-pl/pulls{/number}","milestones_url":"https://api.github.com/repos/rapotek/opencaching-pl/milestones{/number}","notifications_url":"https://api.github.com/repos/rapotek/opencaching-pl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rapotek/opencaching-pl/labels{/name}","releases_url":"https://api.github.com/repos/rapotek/opencaching-pl/releases{/id}","deployments_url":"https://api.github.com/repos/rapotek/opencaching-pl/deployments","created_at":"2017-11-09T10:53:38Z","updated_at":"2018-09-06T13:19:33Z","pushed_at":"2018-09-13T13:41:15Z","git_url":"git://github.com/rapotek/opencaching-pl.git","ssh_url":"git@github.com:rapotek/opencaching-pl.git","clone_url":"https://github.com/rapotek/opencaching-pl.git","svn_url":"https://github.com/rapotek/opencaching-pl","homepage":"https://opencaching.pl/","size":144724,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opencaching:master","ref":"master","sha":"fcb973116f81e4b9adc8416509109621cdf85bcf","user":{"login":"opencaching","id":13405646,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDA1NjQ2","avatar_url":"https://avatars0.githubusercontent.com/u/13405646?v=4","gravatar_id":"","url":"https://api.github.com/users/opencaching","html_url":"https://github.com/opencaching","followers_url":"https://api.github.com/users/opencaching/followers","following_url":"https://api.github.com/users/opencaching/following{/other_user}","gists_url":"https://api.github.com/users/opencaching/gists{/gist_id}","starred_url":"https://api.github.com/users/opencaching/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencaching/subscriptions","organizations_url":"https://api.github.com/users/opencaching/orgs","repos_url":"https://api.github.com/users/opencaching/repos","events_url":"https://api.github.com/users/opencaching/events{/privacy}","received_events_url":"https://api.github.com/users/opencaching/received_events","type":"Organization","site_admin":false},"repo":{"id":39498924,"node_id":"MDEwOlJlcG9zaXRvcnkzOTQ5ODkyNA==","name":"opencaching-pl","full_name":"opencaching/opencaching-pl","owner":{"login":"opencaching","id":13405646,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDA1NjQ2","avatar_url":"https://avatars0.githubusercontent.com/u/13405646?v=4","gravatar_id":"","url":"https://api.github.com/users/opencaching","html_url":"https://github.com/opencaching","followers_url":"https://api.github.com/users/opencaching/followers","following_url":"https://api.github.com/users/opencaching/following{/other_user}","gists_url":"https://api.github.com/users/opencaching/gists{/gist_id}","starred_url":"https://api.github.com/users/opencaching/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencaching/subscriptions","organizations_url":"https://api.github.com/users/opencaching/orgs","repos_url":"https://api.github.com/users/opencaching/repos","events_url":"https://api.github.com/users/opencaching/events{/privacy}","received_events_url":"https://api.github.com/users/opencaching/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opencaching/opencaching-pl","description":"The source code of Opencaching.PL (and some other domains)","fork":false,"url":"https://api.github.com/repos/opencaching/opencaching-pl","forks_url":"https://api.github.com/repos/opencaching/opencaching-pl/forks","keys_url":"https://api.github.com/repos/opencaching/opencaching-pl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencaching/opencaching-pl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencaching/opencaching-pl/teams","hooks_url":"https://api.github.com/repos/opencaching/opencaching-pl/hooks","issue_events_url":"https://api.github.com/repos/opencaching/opencaching-pl/issues/events{/number}","events_url":"https://api.github.com/repos/opencaching/opencaching-pl/events","assignees_url":"https://api.github.com/repos/opencaching/opencaching-pl/assignees{/user}","branches_url":"https://api.github.com/repos/opencaching/opencaching-pl/branches{/branch}","tags_url":"https://api.github.com/repos/opencaching/opencaching-pl/tags","blobs_url":"https://api.github.com/repos/opencaching/opencaching-pl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencaching/opencaching-pl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencaching/opencaching-pl/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencaching/opencaching-pl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencaching/opencaching-pl/statuses/{sha}","languages_url":"https://api.github.com/repos/opencaching/opencaching-pl/languages","stargazers_url":"https://api.github.com/repos/opencaching/opencaching-pl/stargazers","contributors_url":"https://api.github.com/repos/opencaching/opencaching-pl/contributors","subscribers_url":"https://api.github.com/repos/opencaching/opencaching-pl/subscribers","subscription_url":"https://api.github.com/repos/opencaching/opencaching-pl/subscription","commits_url":"https://api.github.com/repos/opencaching/opencaching-pl/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencaching/opencaching-pl/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencaching/opencaching-pl/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencaching/opencaching-pl/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencaching/opencaching-pl/contents/{+path}","compare_url":"https://api.github.com/repos/opencaching/opencaching-pl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencaching/opencaching-pl/merges","archive_url":"https://api.github.com/repos/opencaching/opencaching-pl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencaching/opencaching-pl/downloads","issues_url":"https://api.github.com/repos/opencaching/opencaching-pl/issues{/number}","pulls_url":"https://api.github.com/repos/opencaching/opencaching-pl/pulls{/number}","milestones_url":"https://api.github.com/repos/opencaching/opencaching-pl/milestones{/number}","notifications_url":"https://api.github.com/repos/opencaching/opencaching-pl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencaching/opencaching-pl/labels{/name}","releases_url":"https://api.github.com/repos/opencaching/opencaching-pl/releases{/id}","deployments_url":"https://api.github.com/repos/opencaching/opencaching-pl/deployments","created_at":"2015-07-22T09:59:54Z","updated_at":"2018-09-13T00:25:14Z","pushed_at":"2018-09-13T13:55:33Z","git_url":"git://github.com/opencaching/opencaching-pl.git","ssh_url":"git@github.com:opencaching/opencaching-pl.git","clone_url":"https://github.com/opencaching/opencaching-pl.git","svn_url":"https://github.com/opencaching/opencaching-pl","homepage":"https://opencaching.pl/","size":144412,"stargazers_count":12,"watchers_count":12,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":293,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":26,"open_issues":293,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609"},"html":{"href":"https://github.com/opencaching/opencaching-pl/pull/1609"},"issue":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/issues/1609"},"comments":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/issues/1609/comments"},"review_comments":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609/comments"},"review_comment":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/pulls/1609/commits"},"statuses":{"href":"https://api.github.com/repos/opencaching/opencaching-pl/statuses/3151c2939547aefd8315e8b6c89a9b222869fe8f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rapotek"}}