From 55e6734bd1cfd02ecf03dae9a2edce46ba880f0f Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 19 Jun 2013 22:40:23 -0400 Subject: [PATCH] Fix incorrect clearing of visit history --- database.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database.js b/database.js index 187476fc..d1d4e28b 100644 --- a/database.js +++ b/database.js @@ -923,12 +923,12 @@ function recordVisit(ip, name) { // Keep most recent 5 records per IP results = db.querySync(createQuery( - ["DELETE FROM aliases WHERE visit_id NOT IN (", + ["DELETE FROM aliases WHERE ip=? AND visit_id NOT IN (", "SELECT visit_id FROM (", "SELECT visit_id,time FROM aliases WHERE ip=? ORDER BY time DESC LIMIT 5", ") foo", ");"].join(""), - [ip] + [ip, ip] )); return results;