{"action":"created","comment":{"url":"https://api.github.com/repos/tplaner/When/pulls/comments/69652968","id":69652968,"diff_hunk":"@@ -460,48 +461,63 @@ public function getOccurrencesBetween($startDate, $endDate, $limit=NULL) {\n             return $occurrences;\n         }\n \n-        self::prepareDateElements(false);\n+        // if existing UNTIL < startDate - we have nothing\n+        if (isset($this->until) && $this->until < $startDate) {\n+            return $occurrences;\n+        }\n+        // prevent unnecessary leg-work - our endDate is our new UNTIL\n+        elseif (!isset($this->until)) {\n+            $this->until = $endDate;\n+        }\n \n-        list($startDate, $endDate) = $this->findDateRangeOverlap($startDate, $endDate);\n+        $this->generateOccurrences();\n+        $all_occurrences = $this->occurrences;\n \n-        // If we have a defined $count, we need to test from $this->startDate to ensure we stop at $count.\n-        if ($this->count and ($startDate > $this->startDate)) {\n-            $max_occurrences = $this->count - $this->countOccurrencesBefore($startDate);\n-            if ($max_occurrences <= 0) {\n-                return $occurrences;\n-            }\n-        }\n-        else {\n-            $max_occurrences = $this->count;\n+        // nothing found in $this->generateOccurrences();\n+        if (empty($all_occurrences)) {\n+            return $occurrences;\n         }\n \n-        if ($limit) {\n-            if (! $max_occurrences || ($limit < $max_occurrences)) {\n-                $max_occurrences = $limit;\n+        $last_occurrence = end($all_occurrences);\n+\n+        // if our last occurrence is is before our startDate, we have nothing\n+        if ($last_occurrence < $startDate) {","path":"src/When.php","position":46,"original_position":46,"commit_id":"c508bc4f03b153a42f2ad4a547e880aab44fd03d","original_commit_id":"c508bc4f03b153a42f2ad4a547e880aab44fd03d","user":{"login":"Blindmikey","id":115122,"avatar_url":"https://avatars.githubusercontent.com/u/115122?v=3","gravatar_id":"","url":"https://api.github.com/users/Blindmikey","html_url":"https://github.com/Blindmikey","followers_url":"https://api.github.com/users/Blindmikey/followers","following_url":"https://api.github.com/users/Blindmikey/following{/other_user}","gists_url":"https://api.github.com/users/Blindmikey/gists{/gist_id}","starred_url":"https://api.github.com/users/Blindmikey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blindmikey/subscriptions","organizations_url":"https://api.github.com/users/Blindmikey/orgs","repos_url":"https://api.github.com/users/Blindmikey/repos","events_url":"https://api.github.com/users/Blindmikey/events{/privacy}","received_events_url":"https://api.github.com/users/Blindmikey/received_events","type":"User","site_admin":false},"body":"Hmm that change is causing several other breaks in the phpunit tests. I will have to investigate further. Good catch though, I have written a test for this, and it currently fails as expected: \r\nhttps://gist.github.com/Blindmikey/d9d16caabed9cc18ec7d01b5abea5bf7","created_at":"2016-07-05T23:02:13Z","updated_at":"2016-07-05T23:02:13Z","html_url":"https://github.com/tplaner/When/pull/59#discussion_r69652968","pull_request_url":"https://api.github.com/repos/tplaner/When/pulls/59","_links":{"self":{"href":"https://api.github.com/repos/tplaner/When/pulls/comments/69652968"},"html":{"href":"https://github.com/tplaner/When/pull/59#discussion_r69652968"},"pull_request":{"href":"https://api.github.com/repos/tplaner/When/pulls/59"}}},"pull_request":{"url":"https://api.github.com/repos/tplaner/When/pulls/59","id":76078570,"html_url":"https://github.com/tplaner/When/pull/59","diff_url":"https://github.com/tplaner/When/pull/59.diff","patch_url":"https://github.com/tplaner/When/pull/59.patch","issue_url":"https://api.github.com/repos/tplaner/When/issues/59","number":59,"state":"open","locked":false,"title":"Fixes issues #55 & #58","user":{"login":"Blindmikey","id":115122,"avatar_url":"https://avatars.githubusercontent.com/u/115122?v=3","gravatar_id":"","url":"https://api.github.com/users/Blindmikey","html_url":"https://github.com/Blindmikey","followers_url":"https://api.github.com/users/Blindmikey/followers","following_url":"https://api.github.com/users/Blindmikey/following{/other_user}","gists_url":"https://api.github.com/users/Blindmikey/gists{/gist_id}","starred_url":"https://api.github.com/users/Blindmikey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blindmikey/subscriptions","organizations_url":"https://api.github.com/users/Blindmikey/orgs","repos_url":"https://api.github.com/users/Blindmikey/repos","events_url":"https://api.github.com/users/Blindmikey/events{/privacy}","received_events_url":"https://api.github.com/users/Blindmikey/received_events","type":"User","site_admin":false},"body":"Fixes issue #55 \r\nRefactored existing BYSETPOS limiting logic found in Monthly execution\r\nin generateOccurrences(); expanded to cover Yearly as well as Weekly.\r\nAdded appropriate tests as well.\r\n\r\nFixes issue #58 \r\nUpdated getOccurrencesBetween() method to utilize generateOccurrences()\r\nmethod, and thereby inherit all the existing benefits such as BYSETPOS\r\nfiltering that exist within generateOccurrences().\r\nMemory footprint has not increased. There is a slight decrease in speed; of the 183 tests there was an increase of time spent from 945ms to 1.04s; in practice this should be negligible.","created_at":"2016-07-03T01:40:45Z","updated_at":"2016-07-05T23:02:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26ef223b4eefd0ebcf91aa33c6d5e4788276e92e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tplaner/When/pulls/59/commits","review_comments_url":"https://api.github.com/repos/tplaner/When/pulls/59/comments","review_comment_url":"https://api.github.com/repos/tplaner/When/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tplaner/When/issues/59/comments","statuses_url":"https://api.github.com/repos/tplaner/When/statuses/c508bc4f03b153a42f2ad4a547e880aab44fd03d","head":{"label":"Blindmikey:bysetposbetweenfix","ref":"bysetposbetweenfix","sha":"c508bc4f03b153a42f2ad4a547e880aab44fd03d","user":{"login":"Blindmikey","id":115122,"avatar_url":"https://avatars.githubusercontent.com/u/115122?v=3","gravatar_id":"","url":"https://api.github.com/users/Blindmikey","html_url":"https://github.com/Blindmikey","followers_url":"https://api.github.com/users/Blindmikey/followers","following_url":"https://api.github.com/users/Blindmikey/following{/other_user}","gists_url":"https://api.github.com/users/Blindmikey/gists{/gist_id}","starred_url":"https://api.github.com/users/Blindmikey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blindmikey/subscriptions","organizations_url":"https://api.github.com/users/Blindmikey/orgs","repos_url":"https://api.github.com/users/Blindmikey/repos","events_url":"https://api.github.com/users/Blindmikey/events{/privacy}","received_events_url":"https://api.github.com/users/Blindmikey/received_events","type":"User","site_admin":false},"repo":{"id":62440350,"name":"When","full_name":"Blindmikey/When","owner":{"login":"Blindmikey","id":115122,"avatar_url":"https://avatars.githubusercontent.com/u/115122?v=3","gravatar_id":"","url":"https://api.github.com/users/Blindmikey","html_url":"https://github.com/Blindmikey","followers_url":"https://api.github.com/users/Blindmikey/followers","following_url":"https://api.github.com/users/Blindmikey/following{/other_user}","gists_url":"https://api.github.com/users/Blindmikey/gists{/gist_id}","starred_url":"https://api.github.com/users/Blindmikey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blindmikey/subscriptions","organizations_url":"https://api.github.com/users/Blindmikey/orgs","repos_url":"https://api.github.com/users/Blindmikey/repos","events_url":"https://api.github.com/users/Blindmikey/events{/privacy}","received_events_url":"https://api.github.com/users/Blindmikey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Blindmikey/When","description":"PHP Date Recursion library","fork":true,"url":"https://api.github.com/repos/Blindmikey/When","forks_url":"https://api.github.com/repos/Blindmikey/When/forks","keys_url":"https://api.github.com/repos/Blindmikey/When/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Blindmikey/When/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Blindmikey/When/teams","hooks_url":"https://api.github.com/repos/Blindmikey/When/hooks","issue_events_url":"https://api.github.com/repos/Blindmikey/When/issues/events{/number}","events_url":"https://api.github.com/repos/Blindmikey/When/events","assignees_url":"https://api.github.com/repos/Blindmikey/When/assignees{/user}","branches_url":"https://api.github.com/repos/Blindmikey/When/branches{/branch}","tags_url":"https://api.github.com/repos/Blindmikey/When/tags","blobs_url":"https://api.github.com/repos/Blindmikey/When/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Blindmikey/When/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Blindmikey/When/git/refs{/sha}","trees_url":"https://api.github.com/repos/Blindmikey/When/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Blindmikey/When/statuses/{sha}","languages_url":"https://api.github.com/repos/Blindmikey/When/languages","stargazers_url":"https://api.github.com/repos/Blindmikey/When/stargazers","contributors_url":"https://api.github.com/repos/Blindmikey/When/contributors","subscribers_url":"https://api.github.com/repos/Blindmikey/When/subscribers","subscription_url":"https://api.github.com/repos/Blindmikey/When/subscription","commits_url":"https://api.github.com/repos/Blindmikey/When/commits{/sha}","git_commits_url":"https://api.github.com/repos/Blindmikey/When/git/commits{/sha}","comments_url":"https://api.github.com/repos/Blindmikey/When/comments{/number}","issue_comment_url":"https://api.github.com/repos/Blindmikey/When/issues/comments{/number}","contents_url":"https://api.github.com/repos/Blindmikey/When/contents/{+path}","compare_url":"https://api.github.com/repos/Blindmikey/When/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Blindmikey/When/merges","archive_url":"https://api.github.com/repos/Blindmikey/When/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Blindmikey/When/downloads","issues_url":"https://api.github.com/repos/Blindmikey/When/issues{/number}","pulls_url":"https://api.github.com/repos/Blindmikey/When/pulls{/number}","milestones_url":"https://api.github.com/repos/Blindmikey/When/milestones{/number}","notifications_url":"https://api.github.com/repos/Blindmikey/When/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Blindmikey/When/labels{/name}","releases_url":"https://api.github.com/repos/Blindmikey/When/releases{/id}","deployments_url":"https://api.github.com/repos/Blindmikey/When/deployments","created_at":"2016-07-02T07:51:30Z","updated_at":"2016-07-02T07:51:31Z","pushed_at":"2016-07-03T04:17:36Z","git_url":"git://github.com/Blindmikey/When.git","ssh_url":"git@github.com:Blindmikey/When.git","clone_url":"https://github.com/Blindmikey/When.git","svn_url":"https://github.com/Blindmikey/When","homepage":"https://github.com/tplaner/When","size":135,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tplaner:master","ref":"master","sha":"32a0b67840ffb9c9e3b2187791865d4637014730","user":{"login":"tplaner","id":50652,"avatar_url":"https://avatars.githubusercontent.com/u/50652?v=3","gravatar_id":"","url":"https://api.github.com/users/tplaner","html_url":"https://github.com/tplaner","followers_url":"https://api.github.com/users/tplaner/followers","following_url":"https://api.github.com/users/tplaner/following{/other_user}","gists_url":"https://api.github.com/users/tplaner/gists{/gist_id}","starred_url":"https://api.github.com/users/tplaner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tplaner/subscriptions","organizations_url":"https://api.github.com/users/tplaner/orgs","repos_url":"https://api.github.com/users/tplaner/repos","events_url":"https://api.github.com/users/tplaner/events{/privacy}","received_events_url":"https://api.github.com/users/tplaner/received_events","type":"User","site_admin":false},"repo":{"id":886957,"name":"When","full_name":"tplaner/When","owner":{"login":"tplaner","id":50652,"avatar_url":"https://avatars.githubusercontent.com/u/50652?v=3","gravatar_id":"","url":"https://api.github.com/users/tplaner","html_url":"https://github.com/tplaner","followers_url":"https://api.github.com/users/tplaner/followers","following_url":"https://api.github.com/users/tplaner/following{/other_user}","gists_url":"https://api.github.com/users/tplaner/gists{/gist_id}","starred_url":"https://api.github.com/users/tplaner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tplaner/subscriptions","organizations_url":"https://api.github.com/users/tplaner/orgs","repos_url":"https://api.github.com/users/tplaner/repos","events_url":"https://api.github.com/users/tplaner/events{/privacy}","received_events_url":"https://api.github.com/users/tplaner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tplaner/When","description":"PHP Date Recursion library","fork":false,"url":"https://api.github.com/repos/tplaner/When","forks_url":"https://api.github.com/repos/tplaner/When/forks","keys_url":"https://api.github.com/repos/tplaner/When/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tplaner/When/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tplaner/When/teams","hooks_url":"https://api.github.com/repos/tplaner/When/hooks","issue_events_url":"https://api.github.com/repos/tplaner/When/issues/events{/number}","events_url":"https://api.github.com/repos/tplaner/When/events","assignees_url":"https://api.github.com/repos/tplaner/When/assignees{/user}","branches_url":"https://api.github.com/repos/tplaner/When/branches{/branch}","tags_url":"https://api.github.com/repos/tplaner/When/tags","blobs_url":"https://api.github.com/repos/tplaner/When/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tplaner/When/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tplaner/When/git/refs{/sha}","trees_url":"https://api.github.com/repos/tplaner/When/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tplaner/When/statuses/{sha}","languages_url":"https://api.github.com/repos/tplaner/When/languages","stargazers_url":"https://api.github.com/repos/tplaner/When/stargazers","contributors_url":"https://api.github.com/repos/tplaner/When/contributors","subscribers_url":"https://api.github.com/repos/tplaner/When/subscribers","subscription_url":"https://api.github.com/repos/tplaner/When/subscription","commits_url":"https://api.github.com/repos/tplaner/When/commits{/sha}","git_commits_url":"https://api.github.com/repos/tplaner/When/git/commits{/sha}","comments_url":"https://api.github.com/repos/tplaner/When/comments{/number}","issue_comment_url":"https://api.github.com/repos/tplaner/When/issues/comments{/number}","contents_url":"https://api.github.com/repos/tplaner/When/contents/{+path}","compare_url":"https://api.github.com/repos/tplaner/When/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tplaner/When/merges","archive_url":"https://api.github.com/repos/tplaner/When/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tplaner/When/downloads","issues_url":"https://api.github.com/repos/tplaner/When/issues{/number}","pulls_url":"https://api.github.com/repos/tplaner/When/pulls{/number}","milestones_url":"https://api.github.com/repos/tplaner/When/milestones{/number}","notifications_url":"https://api.github.com/repos/tplaner/When/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tplaner/When/labels{/name}","releases_url":"https://api.github.com/repos/tplaner/When/releases{/id}","deployments_url":"https://api.github.com/repos/tplaner/When/deployments","created_at":"2010-09-04T00:23:05Z","updated_at":"2016-06-29T15:37:22Z","pushed_at":"2016-07-03T04:17:37Z","git_url":"git://github.com/tplaner/When.git","ssh_url":"git@github.com:tplaner/When.git","clone_url":"https://github.com/tplaner/When.git","svn_url":"https://github.com/tplaner/When","homepage":"https://github.com/tplaner/When","size":156,"stargazers_count":230,"watchers_count":230,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":24,"forks":72,"open_issues":24,"watchers":230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tplaner/When/pulls/59"},"html":{"href":"https://github.com/tplaner/When/pull/59"},"issue":{"href":"https://api.github.com/repos/tplaner/When/issues/59"},"comments":{"href":"https://api.github.com/repos/tplaner/When/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/tplaner/When/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/tplaner/When/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tplaner/When/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/tplaner/When/statuses/c508bc4f03b153a42f2ad4a547e880aab44fd03d"}}}}
{"actor":{"display_login":"Blindmikey"}}