This commit is contained in:
commit
05c59d3056
|
@ -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) {
|
function shouldSendFirstOrFollowUpCloseNotification(contract: Contract) {
|
||||||
if (!contract.closeEmailsSent || contract.closeEmailsSent === 0) return true
|
if (!contract.closeEmailsSent || contract.closeEmailsSent === 0) return true
|
||||||
const { closedMultipleOfNDaysAgo, fullTimePeriodsSinceClose } =
|
const { closedMultipleOfNDaysAgo, fullTimePeriodsSinceClose } =
|
||||||
marketClosedMultipleOfNDaysAgo(contract)
|
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 (
|
return (
|
||||||
contract.closeEmailsSent > 0 &&
|
contract.closeEmailsSent > 0 &&
|
||||||
closedMultipleOfNDaysAgo &&
|
closedMultipleOfNDaysAgo &&
|
||||||
|
|
Loading…
Reference in New Issue
Block a user