Skip to content

Commit

Permalink
Don't count view if user is logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbrn committed Jan 27, 2020
1 parent da6b847 commit 91ef203
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,13 @@ app.get('/referral/:url', (request, response, next) => {
database.get("accounts", {url: request.params.url}, {}, 1, function (matching_accounts) {
if (matching_accounts.length == 0) { next(); return; } //404
var account = matching_accounts[0];
database.insert("logs", [
{event_type: "view", code: account.code, date: new Date()}
], (inserted_logs) => {
response.render("referral", {
layout: "main.hbs",
loggedIn: request.loggedIn,
title: account.code,
url: "https://activate.publicmobile.ca/?raf="+account.code,
code: account.code
});
if (!request.loggedIn) database.insert("logs", [{event_type: "view", code: account.code, date: new Date()}], (inserted_logs) => {});
response.render("referral", {
layout: "main.hbs",
loggedIn: request.loggedIn,
title: account.code,
url: "https://activate.publicmobile.ca/?raf="+account.code,
code: account.code
});
}, (err) => response.send(err));
});
Expand Down

0 comments on commit 91ef203

Please sign in to comment.