`;
const emailFooter = generateEmailFooter(searchRequestId);
const asapMessageBody =
realEstates.length > 1
@@ -70,6 +73,7 @@ const generateNewSearchRequestEmail = (searchRequest, matchingRealEstates) => {
} = searchRequest;
const realEstateLinks = generateRealEstateLinks(matchingRealEstates);
+
const instantRealEstatesText = `
U međuvremenu pogledajte neke od nedavno objavljenih nekretnina koje odgovaraju Vašim uslovima pretrage :
diff --git a/app/public/main.css b/app/public/main.css
index 8d128b7..2258be6 100644
--- a/app/public/main.css
+++ b/app/public/main.css
@@ -154,3 +154,7 @@ h3 {
margin-top: 2rem;
margin-bottom: 1rem;
}
+
+.estates-link {
+ color: rgba(0, 0, 0, 0.87);
+}
diff --git a/app/services/notificationService.js b/app/services/notificationService.js
index 7495e17..7a4a62a 100644
--- a/app/services/notificationService.js
+++ b/app/services/notificationService.js
@@ -8,7 +8,10 @@ const {
generateNewSearchRequestEmail,
generateEmailSubject
} = require("../helpers/emailContentGenerator");
-const { findNotNotifiedMatches } = require("../helpers/db/searchRequestMatch");
+const {
+ findNotNotifiedMatches,
+ findRealEstatesForSearchRequest
+} = require("../helpers/db/searchRequestMatch");
const { sendEmail } = require("../services/emailService");
const notifyForNewRealEstates = async newRealEstates => {
@@ -39,10 +42,18 @@ const notifyMatches = async (matches, dailyNotification = false) => {
const { email, subscribed } = searchRequest;
if (notifyNow && subscribed) {
const allMatchingRealEstates = matches[id].realEstates || [];
+
+ //Variable allMatchingRealEstates are real estates that are "new" on the market
+ //the ones that we notify user in this moment, not all that already exists in db
+ //New variable allRealEstates are all real estates that exists in db for search req
+ const allRealEstates = await findRealEstatesForSearchRequest(id);
+ const noAllRealEstates = allRealEstates.length;
+
if (allMatchingRealEstates.length > 0) {
const emailContent = generateNotificationEmail(
allMatchingRealEstates,
id,
+ noAllRealEstates,
dailyNotification
);
const emailSubject = generateEmailSubject(
diff --git a/app/views/realEstates.ejs b/app/views/realEstates.ejs
index a59d794..3e94a1f 100644
--- a/app/views/realEstates.ejs
+++ b/app/views/realEstates.ejs
@@ -1,13 +1,16 @@
-
+
+ <% } %>
+
+