Cleanup comments

This commit is contained in:
Ian Philips 2022-10-11 10:26:37 -06:00
parent 274f7fa849
commit bfdb5ae595

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) { 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 &&