Compare commits

..

1 Commits

Author SHA1 Message Date
Naida Vatric
5bdc8e149a Prostor VIP ads fixed. 2020-02-14 22:41:51 +01:00
4 changed files with 13 additions and 43 deletions

View File

@@ -191,13 +191,7 @@ class ProstorCrawler {
const { lat, lng, property_name, price, size, link, status } = realEstate; const { lat, lng, property_name, price, size, link, status } = realEstate;
//Status information is given already in realestate list //Status information is given already in realestate list
//For VIP Ads status ='' canot be used, but no VIP ads are crawled const adStatus = ProstorCrawler.getStatusId(status);
//We will make "fake" vip ad for RE that have size=55
//It is weird because yesterday it said 'VIP ponuda' ???
const adStatus =
size === "55"
? ProstorCrawler.getStatusId("VIP ponuda")
: ProstorCrawler.getStatusId(status);
const url = `https://prostor.ba${link}`; const url = `https://prostor.ba${link}`;

View File

@@ -332,14 +332,10 @@ const findRealEstatesForSearchRequest = async (searchRequest, maxResults) => {
}; };
} }
//When includeIncompleteAds are not defined - null it will consider it true
const order = [["updatedAt", "desc"]]; const order = [["updatedAt", "desc"]];
return db.RealEstate.findAll({ return db.RealEstate.findAll({
where: where: includeIncompleteAds ? queryIncludeIncomplete : query,
includeIncompleteAds || includeIncompleteAds == null
? queryIncludeIncomplete
: query,
limit: maxResults, limit: maxResults,
order order
}); });

View File

@@ -157,7 +157,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
} else { } else {
// If real estate dont have defined number of rooms ex. null // If real estate dont have defined number of rooms ex. null
//It returns requests that didn't choose number of rooms - also null //It returns requests that didn't choose number of rooms - also null
//Or ones that picked some values but also picked to includeIncomplete ads (or default) //Or ones that picked some values but also picked to includeIncomplete ads
numberOfRoomsQuery = { numberOfRoomsQuery = {
[Op.or]: [ [Op.or]: [
{ {
@@ -176,10 +176,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
}, },
{ {
includeIncompleteAds: { includeIncompleteAds: {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
} }
} }
] ]
@@ -229,10 +226,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
}, },
{ {
includeIncompleteAds: { includeIncompleteAds: {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
} }
} }
] ]
@@ -281,10 +275,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
}, },
{ {
includeIncompleteAds: { includeIncompleteAds: {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
} }
} }
] ]
@@ -322,10 +313,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
}, },
{ {
includeIncompleteAds: { includeIncompleteAds: {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
} }
} }
] ]
@@ -359,10 +347,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
}, },
{ {
includeIncompleteAds: { includeIncompleteAds: {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
} }
} }
] ]
@@ -396,10 +381,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
}, },
{ {
includeIncompleteAds: { includeIncompleteAds: {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
} }
} }
] ]
@@ -441,13 +423,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
[Op.eq]: "ANY" [Op.eq]: "ANY"
}; };
} }
//Tag to check if incomplete ads are accepted in query which is default //Tag to check if incomplete ads are accepted in query
if (checkForIncompleteWanted) { if (checkForIncompleteWanted) {
query.includeIncompleteAds = { query.includeIncompleteAds = {
[Op.or]: { [Op.eq]: true
[Op.eq]: true,
[Op.is]: null
}
}; };
} }

View File

@@ -61,8 +61,9 @@
<p class="distinguished"> <p class="distinguished">
<label class="checkbox-label"> <label class="checkbox-label">
<input type="checkbox" class="filled-in" name="includeIncompleteAds" <input type="checkbox" class="filled-in" name="includeIncompleteAds"
<% if (includeIncompleteAds) { %>
checked checked
> <% } %>>
<span>Uključi i oglase bez potpunih informacija</span> <span>Uključi i oglase bez potpunih informacija</span>
</label> </label>
</p> </p>