Changed redirecting for VIP ads.

This commit is contained in:
Naida Vatric
2020-01-10 22:52:50 +01:00
parent 1658325c4b
commit 64e4835899
4 changed files with 32 additions and 7 deletions

View File

@@ -2,13 +2,14 @@
const {
findRealEstatesForSearchRequest
} = require("../helpers/db/searchRequestMatch");
const { AD_STATUS } = require("../common/enums");
const getRealEstates = async (req, res) => {
const searchRequestId = req.params["searchRequestId"] || "";
const realEstates = await findRealEstatesForSearchRequest(searchRequestId);
const title = "Nekretnine koje odgovaraju Vašim uslovima pretrage";
res.render("realEstates", { realEstates, title });
res.render("realEstates", { realEstates, title, AD_STATUS });
};
module.exports = {

View File

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

View File

@@ -2,6 +2,18 @@
<ul class="collection with-header">
<% for(const realEstate of realEstates) { %>
<li class="collection-item">
<% if(realEstate.adStatus === AD_STATUS.STATUS_VIP) {%>
<div>
<% //This needs to do redirecting instead of direct link to realestate
%>
<a href="/redirect/<%= realEstate.id %>" class="estates-link">
<%= realEstate.title %>
<div class="kivi-color secondary-content">
<i class="material-icons">send</i>
</div>
</a>
</div>
<%} else { %>
<div>
<a href="<%= realEstate.url %>" class="estates-link">
<%= realEstate.title %>
@@ -10,6 +22,7 @@
</div>
</a>
</div>
<% }%>
</li>
<% } %>
</ul>

View File

@@ -18,7 +18,19 @@
<br />
<% if(vipAd) { %>
<div class="center">
<h6>Work in progress....</h6>
<h6>
Ovaj oglas zahtijeva da budete član
<a href="https://prostor.ba/" rel="noreferrer">Prostor.ba</a>.
<br />
<br />
<a href="https://prostor.ba/moj-prostor/prijava" rel="noreferrer"
>Ulogujte se</a
>
ili napravite
<a href="https://prostor.ba/moj-prostor/registracija" rel="noreferrer"
>novi račun</a
>, a potom otvorite <a href="<%= redirectUrl %>" rel="noreferrer">oglas</a>.
</h6>
</div>
<% } else { %>
<div class="center">
@@ -32,6 +44,6 @@
<script>
window.onload = function() {
//document.getElementById("realEstateUrl").click();
document.getElementById("realEstateUrl").click();
};
</script>