Removed debugg logs. Smal fixes.

This commit is contained in:
Naida Vatric
2020-02-06 22:40:56 +01:00
parent 91a1c6a91e
commit 97724a47a1
3 changed files with 3 additions and 32 deletions

View File

@@ -218,7 +218,7 @@ class SaljicCrawler {
}
async scrapeAd(url, adType) {
console.log("[SALJIC] Scraping : ", url);
// console.log("[SALJIC] Scraping : ", url);
try {
const adPageSource = await fetch(url);
const body = await adPageSource.text();
@@ -543,7 +543,6 @@ class SaljicCrawler {
distanceToRiver,
numberOfViewsAgency
};
console.log(data);
return data;
} catch (e) {
console.error("Exception caught: " + e.message, "\r\nURL:", url);

View File

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

View File

@@ -21,8 +21,6 @@ const {
const { sendEmail } = require("../services/emailService");
const notifyForNewRealEstates = async newRealEstates => {
//
console.log("[DEBUGGING] Function notifyForNewRealEstates started.");
const matches = await matchRealEstates(newRealEstates);
await notifyMatches(matches);
};
@@ -37,8 +35,7 @@ const notifyForNewSearchRequest = async searchRequest => {
matchingRealEstates
);
const { email } = searchRequest;
//DEBUGGING
console.log("[DEBUGGING]: Function notifyForNewSearchRequest-", stagingTag);
await sendEmail(
email,
`${stagingTag} Kivi - novi zahtjev za pretragu`,
@@ -48,17 +45,12 @@ const notifyForNewSearchRequest = async searchRequest => {
const notifyMatches = async (matches, dailyNotification = false) => {
const searchRequestsToNotify = Object.keys(matches);
//
console.log("[DEBUGGING] Function notifyMatches started.");
const asyncSendEmailActions = [];
for (const id of searchRequestsToNotify) {
const { searchRequest, notifyNow } = matches[id];
const { email, subscribed } = searchRequest;
if (notifyNow && subscribed) {
//
console.log("[DEBUGGING] Function notifyMatches - if statement true.");
const allMatchingRealEstates = matches[id].realEstates || [];
//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
const allRealEstates = await findRealEstatesForSearchRequest(id);
const noAllRealEstates = allRealEstates.length;
//DEBUGGING
console.log(
"[DEBUGGING] Function notifyMatches-noAllRealEstates:",
noAllRealEstates
);
if (allMatchingRealEstates.length > 0) {
const emailContent = generateNotificationEmail(