From 51c057df2e1df29738fa5e7cade802fbd5275c12 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Fri, 5 Oct 2018 19:32:17 -0700 Subject: [PATCH] Fix #6 - Make sure the year is accounted for with index comparison in memories Signed-off-by: James Ketrenos --- frontend/src/ketr-photos/ketr-photos.html | 4 ++-- server/routes/photos.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/ketr-photos/ketr-photos.html b/frontend/src/ketr-photos/ketr-photos.html index 016ba27..ab3db11 100755 --- a/frontend/src/ketr-photos/ketr-photos.html +++ b/frontend/src/ketr-photos/ketr-photos.html @@ -1175,7 +1175,7 @@ if (mode == "time") { path = ""; } else { - path = "memories/" + (this.date || ""); + path = "memories/" + (this.date.replace(/2016-/, "") || ""); } } var username = this.user ? this.user.username : ""; @@ -1190,7 +1190,7 @@ if ((username != (this.user ? this.user.username : "")) || (mode != this.mode) || ((mode == "albums") && (path != (this.path || ""))) || - ((mode == "memories") && (path != ("memories/" + (this.date || ""))))) { + ((mode == "memories") && (path != ("memories/" + (this.date.replace(/2016-/, "") || ""))))) { console.log("Skipping results for old query. Triggering re-fetch of photos for new path or mode."); this._loadPhotos(); return; diff --git a/server/routes/photos.js b/server/routes/photos.js index 5575d89..9e1cbd5 100755 --- a/server/routes/photos.js +++ b/server/routes/photos.js @@ -40,7 +40,8 @@ router.get("/memories/*", function(req, res/*, next*/) { if (id == -1) { index = "strftime('%m%d',taken)=strftime('%m%d',:date)"; } else { - index = "(strftime('%m%d',taken)=strftime('%m%d',:date) AND photos.id<"+id+ ")"; + index = "(strftime('%Y%m%d',taken)=strftime('%Y%m%d',:date) AND photos.id<"+id+ ")" + + " OR (strftime('%m%d',taken)=strftime('%m%d',:date) AND strftime('%Y',taken)!=strftime('%Y',:date))"; } let date = new Date(decodeURI(req.url).replace(/\?.*$/, ""));