This commit is contained in:
github-actions[bot] 2022-10-11 16:27:05 +00:00 committed by GitHub
commit 05c59d3056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,12 +65,14 @@ export async function sendMarketCloseEmails() {
)
}
}
// The downside of this approach is if this function goes down for the entire
// day of a multiple of the time period after the market has closed, it won't
// keep sending them notifications bc when it comes back online the time period will have passed
function shouldSendFirstOrFollowUpCloseNotification(contract: Contract) {
if (!contract.closeEmailsSent || contract.closeEmailsSent === 0) return true
const { closedMultipleOfNDaysAgo, fullTimePeriodsSinceClose } =
marketClosedMultipleOfNDaysAgo(contract)
// Sends another notification if it's been a multiple of N days since the market closed AND
// the number of close notifications we've sent is equal to the number of time periods since the market closed
return (
contract.closeEmailsSent > 0 &&
closedMultipleOfNDaysAgo &&