{"action":"created","comment":{"url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/comments/40461496","id":40461496,"diff_hunk":"@@ -51,36 +42,43 @@ protected DateTime getScheduledTimeBasedOnEvent(Schedule schedule, Map<String, D\n         return eventTime;\n     }\n     \n-    protected void addTaskForEachTime(List<Task> tasks, DateTime scheduledTime) {\n+    protected void addTaskForEachTime(List<Task> tasks, ScheduleContext context, DateTime scheduledTime) {\n         if (schedule.getTimes().isEmpty()) {\n             // We're using whatever hour/minute/seconds were in the original event.\n-            addTaskForEachActivityAtTime(tasks, scheduledTime);\n+            addTaskForEachActivityAtTime(tasks, context, scheduledTime);\n         } else {\n             for (LocalTime time : schedule.getTimes()) {\n-                scheduledTime = new DateTime(scheduledTime).withTime(time);\n-                addTaskForEachActivityAtTime(tasks, scheduledTime);\n+                scheduledTime = new DateTime(scheduledTime, context.getZone()).withTime(time);\n+                addTaskForEachActivityAtTime(tasks, context, scheduledTime);\n             }\n         }\n     }\n     \n-    private void addTaskForEachActivityAtTime(List<Task> tasks, DateTime scheduledTime) {\n+    private void addTaskForEachActivityAtTime(List<Task> tasks, ScheduleContext context, DateTime scheduledTime) {\n+        // Assert that the scheduledTime was constructed by subclass implementation with the correct time zone.\n+        checkArgument(context.getZone().equals(scheduledTime.getZone()), \n+            \"Scheduled DateTime does not have requested time zone: \" + scheduledTime.getZone());\n+\n         // If this time point is outside of the schedule's active window, skip it.\n-        if (isInWindow(schedule, scheduledTime)) {\n+        if (isInWindow(scheduledTime)) {\n             // As long at the tasks are not already expired, add them.\n-            DateTime expiresOn = getExpiresOn(scheduledTime, schedule);\n-            if (expiresOn == null || expiresOn.isAfter(now)) {\n+            DateTime expiresOn = getExpiresOn(scheduledTime);\n+            if (expiresOn == null || expiresOn.isAfter(context.getNow())) {\n                 for (Activity activity : schedule.getActivities()) {\n-                    DynamoTask task = new DynamoTask();\n-                    task.setSchedulePlanGuid(schedulePlanGuid);\n+                    Task task = new DynamoTask();","path":"app/org/sagebionetworks/bridge/models/schedules/TaskScheduler.java","position":null,"original_position":93,"commit_id":"673ee8956f20cc8df1b493e9a2ba4848d22a1e5d","original_commit_id":"6dbfab9cc33f3f6c4e3f74b2bfc2c2062bff7742","user":{"login":"alxdarksage","id":5589085,"avatar_url":"https://avatars.githubusercontent.com/u/5589085?v=3","gravatar_id":"","url":"https://api.github.com/users/alxdarksage","html_url":"https://github.com/alxdarksage","followers_url":"https://api.github.com/users/alxdarksage/followers","following_url":"https://api.github.com/users/alxdarksage/following{/other_user}","gists_url":"https://api.github.com/users/alxdarksage/gists{/gist_id}","starred_url":"https://api.github.com/users/alxdarksage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alxdarksage/subscriptions","organizations_url":"https://api.github.com/users/alxdarksage/orgs","repos_url":"https://api.github.com/users/alxdarksage/repos","events_url":"https://api.github.com/users/alxdarksage/events{/privacy}","received_events_url":"https://api.github.com/users/alxdarksage/received_events","type":"User","site_admin":false},"body":"Task.create() has been done and checked in. Ultimately, we're exposing how we localize this task which as mentioned in a longer email, I would have preferred to avoid. It's also as you say, minor picky stuff.","created_at":"2015-09-25T18:33:23Z","updated_at":"2015-09-25T18:33:23Z","html_url":"https://github.com/Sage-Bionetworks/BridgePF/pull/853#discussion_r40461496","pull_request_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853","_links":{"self":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/comments/40461496"},"html":{"href":"https://github.com/Sage-Bionetworks/BridgePF/pull/853#discussion_r40461496"},"pull_request":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853"}}},"pull_request":{"url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853","id":45704039,"html_url":"https://github.com/Sage-Bionetworks/BridgePF/pull/853","diff_url":"https://github.com/Sage-Bionetworks/BridgePF/pull/853.diff","patch_url":"https://github.com/Sage-Bionetworks/BridgePF/pull/853.patch","issue_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues/853","number":853,"state":"open","locked":false,"title":"Task updates","user":{"login":"alxdarksage","id":5589085,"avatar_url":"https://avatars.githubusercontent.com/u/5589085?v=3","gravatar_id":"","url":"https://api.github.com/users/alxdarksage","html_url":"https://github.com/alxdarksage","followers_url":"https://api.github.com/users/alxdarksage/followers","following_url":"https://api.github.com/users/alxdarksage/following{/other_user}","gists_url":"https://api.github.com/users/alxdarksage/gists{/gist_id}","starred_url":"https://api.github.com/users/alxdarksage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alxdarksage/subscriptions","organizations_url":"https://api.github.com/users/alxdarksage/orgs","repos_url":"https://api.github.com/users/alxdarksage/repos","events_url":"https://api.github.com/users/alxdarksage/events{/privacy}","received_events_url":"https://api.github.com/users/alxdarksage/received_events","type":"User","site_admin":false},"body":"- fixed issue where query for existing runKey was always returning true after the first save of tasks, causing no further tasks to be saved. At the API level, it appeared that tasks were created initially, but then never updated (because calculated tasks were not being saved). Test for this is in TaskServiceTest;\r\n\r\n- added \"daysAhead/offset\" as parameters to /v3/tasks API (in preference to until parameter, which is deprecated but still supported);\r\n\r\n- consolidated user information for scheduling into a ScheduleContext object, that now includes the user's time zone at the time of the request;\r\n\r\n- changed task to store LocalDateTime for scheduledOn and expiresOn values (other date fields remain in instant times, that is, longs);\r\n\r\n- fixed some validation messages and moved some validation to a validator with a Validate call that validates non-entity objects;\r\n\r\n- SchedulerFactory replaced with Schedule.getScheduler() (cleaner API);\r\n\r\n- removed dead code about finding surveys for a task; not used now that surveys are immutable after publication;","created_at":"2015-09-22T19:10:27Z","updated_at":"2015-09-25T18:33:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d7e43536f9074fb1ee43def4caf38f8e1df7b1f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853/commits","review_comments_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853/comments","review_comment_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues/853/comments","statuses_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/statuses/673ee8956f20cc8df1b493e9a2ba4848d22a1e5d","head":{"label":"alxdarksage:task-updates","ref":"task-updates","sha":"673ee8956f20cc8df1b493e9a2ba4848d22a1e5d","user":{"login":"alxdarksage","id":5589085,"avatar_url":"https://avatars.githubusercontent.com/u/5589085?v=3","gravatar_id":"","url":"https://api.github.com/users/alxdarksage","html_url":"https://github.com/alxdarksage","followers_url":"https://api.github.com/users/alxdarksage/followers","following_url":"https://api.github.com/users/alxdarksage/following{/other_user}","gists_url":"https://api.github.com/users/alxdarksage/gists{/gist_id}","starred_url":"https://api.github.com/users/alxdarksage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alxdarksage/subscriptions","organizations_url":"https://api.github.com/users/alxdarksage/orgs","repos_url":"https://api.github.com/users/alxdarksage/repos","events_url":"https://api.github.com/users/alxdarksage/events{/privacy}","received_events_url":"https://api.github.com/users/alxdarksage/received_events","type":"User","site_admin":false},"repo":{"id":35578108,"name":"BridgePF","full_name":"alxdarksage/BridgePF","owner":{"login":"alxdarksage","id":5589085,"avatar_url":"https://avatars.githubusercontent.com/u/5589085?v=3","gravatar_id":"","url":"https://api.github.com/users/alxdarksage","html_url":"https://github.com/alxdarksage","followers_url":"https://api.github.com/users/alxdarksage/followers","following_url":"https://api.github.com/users/alxdarksage/following{/other_user}","gists_url":"https://api.github.com/users/alxdarksage/gists{/gist_id}","starred_url":"https://api.github.com/users/alxdarksage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alxdarksage/subscriptions","organizations_url":"https://api.github.com/users/alxdarksage/orgs","repos_url":"https://api.github.com/users/alxdarksage/repos","events_url":"https://api.github.com/users/alxdarksage/events{/privacy}","received_events_url":"https://api.github.com/users/alxdarksage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alxdarksage/BridgePF","description":"","fork":true,"url":"https://api.github.com/repos/alxdarksage/BridgePF","forks_url":"https://api.github.com/repos/alxdarksage/BridgePF/forks","keys_url":"https://api.github.com/repos/alxdarksage/BridgePF/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alxdarksage/BridgePF/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alxdarksage/BridgePF/teams","hooks_url":"https://api.github.com/repos/alxdarksage/BridgePF/hooks","issue_events_url":"https://api.github.com/repos/alxdarksage/BridgePF/issues/events{/number}","events_url":"https://api.github.com/repos/alxdarksage/BridgePF/events","assignees_url":"https://api.github.com/repos/alxdarksage/BridgePF/assignees{/user}","branches_url":"https://api.github.com/repos/alxdarksage/BridgePF/branches{/branch}","tags_url":"https://api.github.com/repos/alxdarksage/BridgePF/tags","blobs_url":"https://api.github.com/repos/alxdarksage/BridgePF/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alxdarksage/BridgePF/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alxdarksage/BridgePF/git/refs{/sha}","trees_url":"https://api.github.com/repos/alxdarksage/BridgePF/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alxdarksage/BridgePF/statuses/{sha}","languages_url":"https://api.github.com/repos/alxdarksage/BridgePF/languages","stargazers_url":"https://api.github.com/repos/alxdarksage/BridgePF/stargazers","contributors_url":"https://api.github.com/repos/alxdarksage/BridgePF/contributors","subscribers_url":"https://api.github.com/repos/alxdarksage/BridgePF/subscribers","subscription_url":"https://api.github.com/repos/alxdarksage/BridgePF/subscription","commits_url":"https://api.github.com/repos/alxdarksage/BridgePF/commits{/sha}","git_commits_url":"https://api.github.com/repos/alxdarksage/BridgePF/git/commits{/sha}","comments_url":"https://api.github.com/repos/alxdarksage/BridgePF/comments{/number}","issue_comment_url":"https://api.github.com/repos/alxdarksage/BridgePF/issues/comments{/number}","contents_url":"https://api.github.com/repos/alxdarksage/BridgePF/contents/{+path}","compare_url":"https://api.github.com/repos/alxdarksage/BridgePF/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alxdarksage/BridgePF/merges","archive_url":"https://api.github.com/repos/alxdarksage/BridgePF/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alxdarksage/BridgePF/downloads","issues_url":"https://api.github.com/repos/alxdarksage/BridgePF/issues{/number}","pulls_url":"https://api.github.com/repos/alxdarksage/BridgePF/pulls{/number}","milestones_url":"https://api.github.com/repos/alxdarksage/BridgePF/milestones{/number}","notifications_url":"https://api.github.com/repos/alxdarksage/BridgePF/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alxdarksage/BridgePF/labels{/name}","releases_url":"https://api.github.com/repos/alxdarksage/BridgePF/releases{/id}","created_at":"2015-05-13T22:51:13Z","updated_at":"2015-05-13T22:51:14Z","pushed_at":"2015-09-25T18:32:37Z","git_url":"git://github.com/alxdarksage/BridgePF.git","ssh_url":"git@github.com:alxdarksage/BridgePF.git","clone_url":"https://github.com/alxdarksage/BridgePF.git","svn_url":"https://github.com/alxdarksage/BridgePF","homepage":null,"size":71749,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"develop"}},"base":{"label":"Sage-Bionetworks:develop","ref":"develop","sha":"b6d71d916997a36bd7058de53c8a981516d5e556","user":{"login":"Sage-Bionetworks","id":1250897,"avatar_url":"https://avatars.githubusercontent.com/u/1250897?v=3","gravatar_id":"","url":"https://api.github.com/users/Sage-Bionetworks","html_url":"https://github.com/Sage-Bionetworks","followers_url":"https://api.github.com/users/Sage-Bionetworks/followers","following_url":"https://api.github.com/users/Sage-Bionetworks/following{/other_user}","gists_url":"https://api.github.com/users/Sage-Bionetworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Sage-Bionetworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sage-Bionetworks/subscriptions","organizations_url":"https://api.github.com/users/Sage-Bionetworks/orgs","repos_url":"https://api.github.com/users/Sage-Bionetworks/repos","events_url":"https://api.github.com/users/Sage-Bionetworks/events{/privacy}","received_events_url":"https://api.github.com/users/Sage-Bionetworks/received_events","type":"Organization","site_admin":false},"repo":{"id":18604783,"name":"BridgePF","full_name":"Sage-Bionetworks/BridgePF","owner":{"login":"Sage-Bionetworks","id":1250897,"avatar_url":"https://avatars.githubusercontent.com/u/1250897?v=3","gravatar_id":"","url":"https://api.github.com/users/Sage-Bionetworks","html_url":"https://github.com/Sage-Bionetworks","followers_url":"https://api.github.com/users/Sage-Bionetworks/followers","following_url":"https://api.github.com/users/Sage-Bionetworks/following{/other_user}","gists_url":"https://api.github.com/users/Sage-Bionetworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Sage-Bionetworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sage-Bionetworks/subscriptions","organizations_url":"https://api.github.com/users/Sage-Bionetworks/orgs","repos_url":"https://api.github.com/users/Sage-Bionetworks/repos","events_url":"https://api.github.com/users/Sage-Bionetworks/events{/privacy}","received_events_url":"https://api.github.com/users/Sage-Bionetworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sage-Bionetworks/BridgePF","description":"Server software for Bridge-based mobile applications","fork":false,"url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF","forks_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/forks","keys_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/teams","hooks_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/hooks","issue_events_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues/events{/number}","events_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/events","assignees_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/assignees{/user}","branches_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/branches{/branch}","tags_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/tags","blobs_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/statuses/{sha}","languages_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/languages","stargazers_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/stargazers","contributors_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/contributors","subscribers_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/subscribers","subscription_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/subscription","commits_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/contents/{+path}","compare_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/merges","archive_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/downloads","issues_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues{/number}","pulls_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls{/number}","milestones_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/milestones{/number}","notifications_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/labels{/name}","releases_url":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/releases{/id}","created_at":"2014-04-09T16:38:46Z","updated_at":"2015-08-30T22:35:59Z","pushed_at":"2015-09-25T18:32:38Z","git_url":"git://github.com/Sage-Bionetworks/BridgePF.git","ssh_url":"git@github.com:Sage-Bionetworks/BridgePF.git","clone_url":"https://github.com/Sage-Bionetworks/BridgePF.git","svn_url":"https://github.com/Sage-Bionetworks/BridgePF","homepage":"","size":76518,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":2,"forks":13,"open_issues":2,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853"},"html":{"href":"https://github.com/Sage-Bionetworks/BridgePF/pull/853"},"issue":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues/853"},"comments":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/issues/853/comments"},"review_comments":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853/comments"},"review_comment":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/pulls/853/commits"},"statuses":{"href":"https://api.github.com/repos/Sage-Bionetworks/BridgePF/statuses/673ee8956f20cc8df1b493e9a2ba4848d22a1e5d"}}}}