{"action":"created","issue":{"url":"https://api.github.com/repos/medic/medic-webapp/issues/1268","labels_url":"https://api.github.com/repos/medic/medic-webapp/issues/1268/labels{/name}","comments_url":"https://api.github.com/repos/medic/medic-webapp/issues/1268/comments","events_url":"https://api.github.com/repos/medic/medic-webapp/issues/1268/events","html_url":"https://github.com/medic/medic-webapp/issues/1268","id":104973339,"number":1268,"title":"[Tasks] Configurable start and end time","user":{"login":"abbyad","id":789512,"avatar_url":"https://avatars.githubusercontent.com/u/789512?v=3","gravatar_id":"","url":"https://api.github.com/users/abbyad","html_url":"https://github.com/abbyad","followers_url":"https://api.github.com/users/abbyad/followers","following_url":"https://api.github.com/users/abbyad/following{/other_user}","gists_url":"https://api.github.com/users/abbyad/gists{/gist_id}","starred_url":"https://api.github.com/users/abbyad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abbyad/subscriptions","organizations_url":"https://api.github.com/users/abbyad/orgs","repos_url":"https://api.github.com/users/abbyad/repos","events_url":"https://api.github.com/users/abbyad/events{/privacy}","received_events_url":"https://api.github.com/users/abbyad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/medic/medic-webapp/labels/1%20-%20Scheduled","name":"1 - Scheduled","color":"bfd4f2"},{"url":"https://api.github.com/repos/medic/medic-webapp/labels/Feature%20Request","name":"Feature Request","color":"6fc5af"}],"state":"closed","locked":false,"assignee":{"login":"garethbowen","id":2064938,"avatar_url":"https://avatars.githubusercontent.com/u/2064938?v=3","gravatar_id":"","url":"https://api.github.com/users/garethbowen","html_url":"https://github.com/garethbowen","followers_url":"https://api.github.com/users/garethbowen/followers","following_url":"https://api.github.com/users/garethbowen/following{/other_user}","gists_url":"https://api.github.com/users/garethbowen/gists{/gist_id}","starred_url":"https://api.github.com/users/garethbowen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garethbowen/subscriptions","organizations_url":"https://api.github.com/users/garethbowen/orgs","repos_url":"https://api.github.com/users/garethbowen/repos","events_url":"https://api.github.com/users/garethbowen/events{/privacy}","received_events_url":"https://api.github.com/users/garethbowen/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/medic/medic-webapp/milestones/35","html_url":"https://github.com/medic/medic-webapp/milestones/Iteration%202015-39:%20Mobile%20Application%20Ready%20for%20Internal%20Testing","labels_url":"https://api.github.com/repos/medic/medic-webapp/milestones/35/labels","id":1294425,"number":35,"title":"Iteration 2015-39: Mobile Application Ready for Internal Testing","description":"","creator":{"login":"browndav","id":763977,"avatar_url":"https://avatars.githubusercontent.com/u/763977?v=3","gravatar_id":"","url":"https://api.github.com/users/browndav","html_url":"https://github.com/browndav","followers_url":"https://api.github.com/users/browndav/followers","following_url":"https://api.github.com/users/browndav/following{/other_user}","gists_url":"https://api.github.com/users/browndav/gists{/gist_id}","starred_url":"https://api.github.com/users/browndav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/browndav/subscriptions","organizations_url":"https://api.github.com/users/browndav/orgs","repos_url":"https://api.github.com/users/browndav/repos","events_url":"https://api.github.com/users/browndav/events{/privacy}","received_events_url":"https://api.github.com/users/browndav/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":5,"state":"open","created_at":"2015-09-07T23:17:19Z","updated_at":"2015-09-25T01:17:56Z","due_on":"2015-10-05T07:00:00Z","closed_at":null},"comments":1,"created_at":"2015-09-04T21:29:46Z","updated_at":"2015-09-25T01:17:56Z","closed_at":"2015-09-25T01:17:56Z","body":"Tasks are now shown as soon as they pass a rule. We would want the task to be shown only during a particular time window. This way, a task could be configured to only show up 2 days ahead of an event, and disappear when no longer relevant (eg no point doing the 48hr followup 2 weeks later)."},"comment":{"url":"https://api.github.com/repos/medic/medic-webapp/issues/comments/143096488","html_url":"https://github.com/medic/medic-webapp/issues/1268#issuecomment-143096488","issue_url":"https://api.github.com/repos/medic/medic-webapp/issues/1268","id":143096488,"user":{"login":"garethbowen","id":2064938,"avatar_url":"https://avatars.githubusercontent.com/u/2064938?v=3","gravatar_id":"","url":"https://api.github.com/users/garethbowen","html_url":"https://github.com/garethbowen","followers_url":"https://api.github.com/users/garethbowen/followers","following_url":"https://api.github.com/users/garethbowen/following{/other_user}","gists_url":"https://api.github.com/users/garethbowen/gists{/gist_id}","starred_url":"https://api.github.com/users/garethbowen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garethbowen/subscriptions","organizations_url":"https://api.github.com/users/garethbowen/orgs","repos_url":"https://api.github.com/users/garethbowen/repos","events_url":"https://api.github.com/users/garethbowen/events{/privacy}","received_events_url":"https://api.github.com/users/garethbowen/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T01:17:56Z","updated_at":"2015-09-25T01:17:56Z","body":"I've added `start` and `end` properties to the task schedule event configuration, so each event can specify when it should be shown. Then before emitting the event you can use a new Utils function `isTimely`, eg:\r\n\r\n```js\r\nUtils.getSchedule('anc-registration').events.forEach(function(s) {\r\n  var due = Utils.addDate(Utils.getLmpDate(r.doc), s.days).toISOString();\r\n  if (Utils.isTimely(due, event)) {\r\n    emit('task', { ... });\r\n  }\r\n});\r\n```"}}