Debugging- noOfRealEstates and staging tag.

This commit is contained in:
Naida Vatric
2020-02-05 21:58:45 +01:00
parent 74def9c059
commit 2d0a00b967
2 changed files with 24 additions and 2 deletions

View File

@@ -34,6 +34,11 @@ const generateNotificationEmail = (
noAllRealEstates, noAllRealEstates,
dailyNotification = false dailyNotification = false
) => { ) => {
//DEBUGGING
console.log(
"[DEBUGGING] Function generateNotificationEmail-noAllRealEstates:",
noAllRealEstates
);
const truncateList = realEstates.length > MAX_REAL_ESTATES_IN_EMAIL; const truncateList = realEstates.length > MAX_REAL_ESTATES_IN_EMAIL;
const realEstatesToShow = truncateList const realEstatesToShow = truncateList
@@ -60,7 +65,8 @@ const generateNotificationEmail = (
: "U posljednja 24h objavljena je sljedeća nekretnina koja odgovara uslovima Vaše pretrage"; : "U posljednja 24h objavljena je sljedeća nekretnina koja odgovara uslovima Vaše pretrage";
const messageBody = dailyNotification ? dailyMessageBody : asapMessageBody; const messageBody = dailyNotification ? dailyMessageBody : asapMessageBody;
//DEBUGGING
console.log("[DEBUGGING]: Function generateNotificationEmail-", stagingTag);
return `<h3>${stagingTag}Zdravo</h3> return `<h3>${stagingTag}Zdravo</h3>
<h4>${messageBody}</h4> <h4>${messageBody}</h4>
<div> <div>
@@ -120,6 +126,12 @@ const generateNewSearchRequestEmail = (searchRequest, matchingRealEstates) => {
const emailFooter = generateEmailFooter(id, emailFrequencyTitle); const emailFooter = generateEmailFooter(id, emailFrequencyTitle);
//DEBUGGING
console.log(
"[DEBUGGING]: Function generateNewSearchRequestEmail-",
stagingTag
);
return `<h3>${stagingTag}Zdravo</h3> return `<h3>${stagingTag}Zdravo</h3>
<div>Naručili ste da Vam javimo ako se nekretnina sa navedenim uslovima pojavi u oglasima:</div> <div>Naručili ste da Vam javimo ako se nekretnina sa navedenim uslovima pojavi u oglasima:</div>
<br/> <br/>
@@ -136,6 +148,9 @@ const generateNewSearchRequestEmail = (searchRequest, matchingRealEstates) => {
}; };
const generateEmailSubject = (numberOfRealEstates, singleRealEstateTitle) => { const generateEmailSubject = (numberOfRealEstates, singleRealEstateTitle) => {
//DEBUGGING
console.log("[DEBUGGING]: Function generateEmailSubject-", stagingTag);
if (numberOfRealEstates === 1) { if (numberOfRealEstates === 1) {
return `${stagingTag}Kivi: ${singleRealEstateTitle}`; return `${stagingTag}Kivi: ${singleRealEstateTitle}`;
} }

View File

@@ -35,9 +35,11 @@ const notifyForNewSearchRequest = async searchRequest => {
matchingRealEstates matchingRealEstates
); );
const { email } = searchRequest; const { email } = searchRequest;
//DEBUGGING
console.log("[DEBUGGING]: Function notifyForNewSearchRequest-", stagingTag);
await sendEmail( await sendEmail(
email, email,
`${stagingTag} Kivi - novi zahtjev za pretragu`, `${stagingTag} Kivi - novi zahtstagingjev za pretragu`,
emailContent emailContent
); );
}; };
@@ -57,6 +59,11 @@ const notifyMatches = async (matches, dailyNotification = false) => {
//New variable allRealEstates are all real estates that exists in db for search req //New variable allRealEstates are all real estates that exists in db for search req
const allRealEstates = await findRealEstatesForSearchRequest(id); const allRealEstates = await findRealEstatesForSearchRequest(id);
const noAllRealEstates = allRealEstates.length; const noAllRealEstates = allRealEstates.length;
//DEBUGGING
console.log(
"[DEBUGGING] Function notifyMatches-noAllRealEstates:",
noAllRealEstates
);
if (allMatchingRealEstates.length > 0) { if (allMatchingRealEstates.length > 0) {
const emailContent = generateNotificationEmail( const emailContent = generateNotificationEmail(