{"action":"created","comment":{"url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/comments/32467477","id":32467477,"diff_hunk":"@@ -2,53 +2,61 @@\n   'use strict';\n \n   // Manages notifications to respond to adherence prompts.\n-  function AdherenceNotifications($window, configurationCache,\n+  function AdherenceNotifications($window, $rootScope, configurationService,\n                                   localNotifications, Timing,\n-                                  adherenceNotificationsCache) {\n-    var DELAY_UNTIL_DB1_IN_MINUTES = 10;\n-\n-    this.db1PromptTime = function() {\n-      var config = configurationCache.first();\n-      var promptTime = $window.moment();\n-      promptTime.second(0);\n-      promptTime.millisecond(0);\n-      var timeParts = config.medication.time.split(':');\n-      promptTime.hour(timeParts[0]);\n-      promptTime.minute(timeParts[1]);\n-      promptTime.add(DELAY_UNTIL_DB1_IN_MINUTES, 'minutes');\n-\n-      return promptTime;\n+                                  adherenceNotificationsCache, DIALOGS, dialogs) {\n+    this.listenToDialogs = function() {\n+      var self = this;\n+\n+      $rootScope.$on(DIALOGS.EVENTS.RESPONSE, function(event, response, responseMetadata) {\n+        if (responseMetadata.category === DIALOGS.CATEGORIES.ADHERENCE &&\n+            responseMetadata.extra) {\n+          self.scheduleToday();\n+        }\n+      });\n     };\n \n-    this.schedule = function() {\n-      var config = configurationCache.first();\n-      var dateStart = $window.moment(config.startDate);\n+    this.scheduleToday = function() {\n+      var dateStart = $window.moment(configurationService.startDate());\n       var dayToday = $window.moment().diff(dateStart, 'days') + 1;\n \n-      if (dayToday <= Timing.DAYS_IN_TRIAL) {\n+      if (dayToday > Timing.DAYS_IN_TRIAL) { return; }\n+\n+      angular.forEach(dialogs.Definitions, function(definition, dialog) {\n+        if (definition.category !== DIALOGS.CATEGORIES.ADHERENCE) { return; }\n+\n+        var notificationId = parseInt('0' + definition.id + '000' + dayToday);","path":"src/js/services/AdherenceNotifications.js","position":46,"original_position":46,"commit_id":"52153daf27ce2e818ca5578218111ccf372d1049","original_commit_id":"52153daf27ce2e818ca5578218111ccf372d1049","user":{"login":"michaelwehrley","id":526136,"avatar_url":"https://avatars.githubusercontent.com/u/526136?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelwehrley","html_url":"https://github.com/michaelwehrley","followers_url":"https://api.github.com/users/michaelwehrley/followers","following_url":"https://api.github.com/users/michaelwehrley/following{/other_user}","gists_url":"https://api.github.com/users/michaelwehrley/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwehrley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwehrley/subscriptions","organizations_url":"https://api.github.com/users/michaelwehrley/orgs","repos_url":"https://api.github.com/users/michaelwehrley/repos","events_url":"https://api.github.com/users/michaelwehrley/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwehrley/received_events","type":"User","site_admin":false},"body":"This seems interesting; why this format?","created_at":"2015-06-15T21:12:39Z","updated_at":"2015-06-15T21:12:39Z","html_url":"https://github.com/cbitstech/medlink2_app/pull/16#discussion_r32467477","pull_request_url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/comments/32467477"},"html":{"href":"https://github.com/cbitstech/medlink2_app/pull/16#discussion_r32467477"},"pull_request":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16","id":37733006,"html_url":"https://github.com/cbitstech/medlink2_app/pull/16","diff_url":"https://github.com/cbitstech/medlink2_app/pull/16.diff","patch_url":"https://github.com/cbitstech/medlink2_app/pull/16.patch","issue_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues/16","number":16,"state":"open","locked":false,"title":"chedule DB3 notification on DB2b confirm","user":{"login":"ericcf","id":58693,"avatar_url":"https://avatars.githubusercontent.com/u/58693?v=3","gravatar_id":"","url":"https://api.github.com/users/ericcf","html_url":"https://github.com/ericcf","followers_url":"https://api.github.com/users/ericcf/followers","following_url":"https://api.github.com/users/ericcf/following{/other_user}","gists_url":"https://api.github.com/users/ericcf/gists{/gist_id}","starred_url":"https://api.github.com/users/ericcf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericcf/subscriptions","organizations_url":"https://api.github.com/users/ericcf/orgs","repos_url":"https://api.github.com/users/ericcf/repos","events_url":"https://api.github.com/users/ericcf/events{/privacy}","received_events_url":"https://api.github.com/users/ericcf/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-06-15T20:40:44Z","updated_at":"2015-06-15T21:12:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bdda6a3a709a58ab5ab5c6bcf0d5b9307819ab0","assignee":{"login":"michaelwehrley","id":526136,"avatar_url":"https://avatars.githubusercontent.com/u/526136?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelwehrley","html_url":"https://github.com/michaelwehrley","followers_url":"https://api.github.com/users/michaelwehrley/followers","following_url":"https://api.github.com/users/michaelwehrley/following{/other_user}","gists_url":"https://api.github.com/users/michaelwehrley/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwehrley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwehrley/subscriptions","organizations_url":"https://api.github.com/users/michaelwehrley/orgs","repos_url":"https://api.github.com/users/michaelwehrley/repos","events_url":"https://api.github.com/users/michaelwehrley/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwehrley/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16/commits","review_comments_url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16/comments","review_comment_url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues/16/comments","statuses_url":"https://api.github.com/repos/cbitstech/medlink2_app/statuses/52153daf27ce2e818ca5578218111ccf372d1049","head":{"label":"cbitstech:ecf_86158530_db3_notification","ref":"ecf_86158530_db3_notification","sha":"52153daf27ce2e818ca5578218111ccf372d1049","user":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"repo":{"id":31752224,"name":"medlink2_app","full_name":"cbitstech/medlink2_app","owner":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbitstech/medlink2_app","description":"","fork":false,"url":"https://api.github.com/repos/cbitstech/medlink2_app","forks_url":"https://api.github.com/repos/cbitstech/medlink2_app/forks","keys_url":"https://api.github.com/repos/cbitstech/medlink2_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbitstech/medlink2_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbitstech/medlink2_app/teams","hooks_url":"https://api.github.com/repos/cbitstech/medlink2_app/hooks","issue_events_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues/events{/number}","events_url":"https://api.github.com/repos/cbitstech/medlink2_app/events","assignees_url":"https://api.github.com/repos/cbitstech/medlink2_app/assignees{/user}","branches_url":"https://api.github.com/repos/cbitstech/medlink2_app/branches{/branch}","tags_url":"https://api.github.com/repos/cbitstech/medlink2_app/tags","blobs_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbitstech/medlink2_app/statuses/{sha}","languages_url":"https://api.github.com/repos/cbitstech/medlink2_app/languages","stargazers_url":"https://api.github.com/repos/cbitstech/medlink2_app/stargazers","contributors_url":"https://api.github.com/repos/cbitstech/medlink2_app/contributors","subscribers_url":"https://api.github.com/repos/cbitstech/medlink2_app/subscribers","subscription_url":"https://api.github.com/repos/cbitstech/medlink2_app/subscription","commits_url":"https://api.github.com/repos/cbitstech/medlink2_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbitstech/medlink2_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbitstech/medlink2_app/contents/{+path}","compare_url":"https://api.github.com/repos/cbitstech/medlink2_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbitstech/medlink2_app/merges","archive_url":"https://api.github.com/repos/cbitstech/medlink2_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbitstech/medlink2_app/downloads","issues_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues{/number}","pulls_url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls{/number}","milestones_url":"https://api.github.com/repos/cbitstech/medlink2_app/milestones{/number}","notifications_url":"https://api.github.com/repos/cbitstech/medlink2_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbitstech/medlink2_app/labels{/name}","releases_url":"https://api.github.com/repos/cbitstech/medlink2_app/releases{/id}","created_at":"2015-03-06T04:19:43Z","updated_at":"2015-04-21T16:51:50Z","pushed_at":"2015-06-15T20:40:45Z","git_url":"git://github.com/cbitstech/medlink2_app.git","ssh_url":"git@github.com:cbitstech/medlink2_app.git","clone_url":"https://github.com/cbitstech/medlink2_app.git","svn_url":"https://github.com/cbitstech/medlink2_app","homepage":null,"size":1020,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"cbitstech:master","ref":"master","sha":"81d9c11176b8027713eaae3f24b6bc3dc70cc41e","user":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"repo":{"id":31752224,"name":"medlink2_app","full_name":"cbitstech/medlink2_app","owner":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbitstech/medlink2_app","description":"","fork":false,"url":"https://api.github.com/repos/cbitstech/medlink2_app","forks_url":"https://api.github.com/repos/cbitstech/medlink2_app/forks","keys_url":"https://api.github.com/repos/cbitstech/medlink2_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbitstech/medlink2_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbitstech/medlink2_app/teams","hooks_url":"https://api.github.com/repos/cbitstech/medlink2_app/hooks","issue_events_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues/events{/number}","events_url":"https://api.github.com/repos/cbitstech/medlink2_app/events","assignees_url":"https://api.github.com/repos/cbitstech/medlink2_app/assignees{/user}","branches_url":"https://api.github.com/repos/cbitstech/medlink2_app/branches{/branch}","tags_url":"https://api.github.com/repos/cbitstech/medlink2_app/tags","blobs_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbitstech/medlink2_app/statuses/{sha}","languages_url":"https://api.github.com/repos/cbitstech/medlink2_app/languages","stargazers_url":"https://api.github.com/repos/cbitstech/medlink2_app/stargazers","contributors_url":"https://api.github.com/repos/cbitstech/medlink2_app/contributors","subscribers_url":"https://api.github.com/repos/cbitstech/medlink2_app/subscribers","subscription_url":"https://api.github.com/repos/cbitstech/medlink2_app/subscription","commits_url":"https://api.github.com/repos/cbitstech/medlink2_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbitstech/medlink2_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbitstech/medlink2_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbitstech/medlink2_app/contents/{+path}","compare_url":"https://api.github.com/repos/cbitstech/medlink2_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbitstech/medlink2_app/merges","archive_url":"https://api.github.com/repos/cbitstech/medlink2_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbitstech/medlink2_app/downloads","issues_url":"https://api.github.com/repos/cbitstech/medlink2_app/issues{/number}","pulls_url":"https://api.github.com/repos/cbitstech/medlink2_app/pulls{/number}","milestones_url":"https://api.github.com/repos/cbitstech/medlink2_app/milestones{/number}","notifications_url":"https://api.github.com/repos/cbitstech/medlink2_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbitstech/medlink2_app/labels{/name}","releases_url":"https://api.github.com/repos/cbitstech/medlink2_app/releases{/id}","created_at":"2015-03-06T04:19:43Z","updated_at":"2015-04-21T16:51:50Z","pushed_at":"2015-06-15T20:40:45Z","git_url":"git://github.com/cbitstech/medlink2_app.git","ssh_url":"git@github.com:cbitstech/medlink2_app.git","clone_url":"https://github.com/cbitstech/medlink2_app.git","svn_url":"https://github.com/cbitstech/medlink2_app","homepage":null,"size":1020,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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/cbitstech/medlink2_app/pulls/16"},"html":{"href":"https://github.com/cbitstech/medlink2_app/pull/16"},"issue":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/issues/16"},"comments":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/cbitstech/medlink2_app/statuses/52153daf27ce2e818ca5578218111ccf372d1049"}}}}