-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sinhadotabhinav/issue-#1
closing Issue #1 per this pul request
- Loading branch information
Showing
14 changed files
with
274 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const SCHEDULE = '0 */3 * * *'; | ||
const DATE_RANGE = 10; | ||
const SCHEDULE = '0 */2 * * *'; | ||
const DATE_RANGE = 7; | ||
const DATE_FORMAT = 'DD-MM-YYYY'; | ||
|
||
module.exports = { SCHEDULE, DATE_RANGE, DATE_FORMAT }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const appConfig = require('../configs/appConfig'); | ||
const mailConfig = require('../configs/mailConfig'); | ||
const alerts = require('../utilities/alerts'); | ||
const htmlBuilder = require('../utilities/htmlBuilder'); | ||
const logger = require('../utilities/logger'); | ||
|
||
let runs = 0; | ||
let slots = []; | ||
|
||
async function prepareReport () { | ||
let regionType = Boolean(appConfig.FINDBYPINCODE) ? 'pincode' : 'district'; | ||
let region = regionType == 'pincode' ? appConfig.PINCODE : appConfig.DISTRICT; | ||
alerts.sendEmailAlert(mailConfig.DAILY_DIGEST_SUBJECT, | ||
await htmlBuilder.prepareDailyDigestEmail(runs, slots.length, regionType, region), (error, result) => { | ||
if(error) { | ||
console.log(logger.getLog(error)); | ||
} else { | ||
console.log(logger.getLog('Daily digest email alert has been sent to the recipient(s).')); | ||
} | ||
}); | ||
} | ||
|
||
async function updateRunCounter (runCounter, vaccinationSlots) { | ||
runs = runCounter; | ||
slots = vaccinationSlots; | ||
} | ||
|
||
module.exports = { prepareReport, updateRunCounter }; |
Oops, something went wrong.