Removed debugg logs. Smal fixes.
This commit is contained in:
@@ -218,7 +218,7 @@ class SaljicCrawler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async scrapeAd(url, adType) {
|
async scrapeAd(url, adType) {
|
||||||
console.log("[SALJIC] Scraping : ", url);
|
// console.log("[SALJIC] Scraping : ", url);
|
||||||
try {
|
try {
|
||||||
const adPageSource = await fetch(url);
|
const adPageSource = await fetch(url);
|
||||||
const body = await adPageSource.text();
|
const body = await adPageSource.text();
|
||||||
@@ -543,7 +543,6 @@ class SaljicCrawler {
|
|||||||
distanceToRiver,
|
distanceToRiver,
|
||||||
numberOfViewsAgency
|
numberOfViewsAgency
|
||||||
};
|
};
|
||||||
console.log(data);
|
|
||||||
return data;
|
return data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Exception caught: " + e.message, "\r\nURL:", url);
|
console.error("Exception caught: " + e.message, "\r\nURL:", url);
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ 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
|
||||||
@@ -65,8 +60,7 @@ 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>
|
||||||
@@ -126,12 +120,6 @@ 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/>
|
||||||
@@ -148,9 +136,6 @@ 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}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ const {
|
|||||||
const { sendEmail } = require("../services/emailService");
|
const { sendEmail } = require("../services/emailService");
|
||||||
|
|
||||||
const notifyForNewRealEstates = async newRealEstates => {
|
const notifyForNewRealEstates = async newRealEstates => {
|
||||||
//
|
|
||||||
console.log("[DEBUGGING] Function notifyForNewRealEstates started.");
|
|
||||||
const matches = await matchRealEstates(newRealEstates);
|
const matches = await matchRealEstates(newRealEstates);
|
||||||
await notifyMatches(matches);
|
await notifyMatches(matches);
|
||||||
};
|
};
|
||||||
@@ -37,8 +35,7 @@ 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 zahtjev za pretragu`,
|
||||||
@@ -48,17 +45,12 @@ const notifyForNewSearchRequest = async searchRequest => {
|
|||||||
|
|
||||||
const notifyMatches = async (matches, dailyNotification = false) => {
|
const notifyMatches = async (matches, dailyNotification = false) => {
|
||||||
const searchRequestsToNotify = Object.keys(matches);
|
const searchRequestsToNotify = Object.keys(matches);
|
||||||
//
|
|
||||||
console.log("[DEBUGGING] Function notifyMatches started.");
|
|
||||||
|
|
||||||
const asyncSendEmailActions = [];
|
const asyncSendEmailActions = [];
|
||||||
for (const id of searchRequestsToNotify) {
|
for (const id of searchRequestsToNotify) {
|
||||||
const { searchRequest, notifyNow } = matches[id];
|
const { searchRequest, notifyNow } = matches[id];
|
||||||
const { email, subscribed } = searchRequest;
|
const { email, subscribed } = searchRequest;
|
||||||
if (notifyNow && subscribed) {
|
if (notifyNow && subscribed) {
|
||||||
//
|
|
||||||
console.log("[DEBUGGING] Function notifyMatches - if statement true.");
|
|
||||||
|
|
||||||
const allMatchingRealEstates = matches[id].realEstates || [];
|
const allMatchingRealEstates = matches[id].realEstates || [];
|
||||||
|
|
||||||
//Variable allMatchingRealEstates are real estates that are "new" on the market
|
//Variable allMatchingRealEstates are real estates that are "new" on the market
|
||||||
@@ -66,11 +58,6 @@ 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(
|
||||||
|
|||||||
Reference in New Issue
Block a user