Fix #6 - Make sure the year is accounted for with index comparison in memories

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-10-05 19:32:17 -07:00
parent 568db0ad54
commit 51c057df2e
2 changed files with 4 additions and 3 deletions

View File

@ -1175,7 +1175,7 @@
if (mode == "time") { if (mode == "time") {
path = ""; path = "";
} else { } else {
path = "memories/" + (this.date || ""); path = "memories/" + (this.date.replace(/2016-/, "") || "");
} }
} }
var username = this.user ? this.user.username : ""; var username = this.user ? this.user.username : "";
@ -1190,7 +1190,7 @@
if ((username != (this.user ? this.user.username : "")) || if ((username != (this.user ? this.user.username : "")) ||
(mode != this.mode) || (mode != this.mode) ||
((mode == "albums") && (path != (this.path || ""))) || ((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."); console.log("Skipping results for old query. Triggering re-fetch of photos for new path or mode.");
this._loadPhotos(); this._loadPhotos();
return; return;

View File

@ -40,7 +40,8 @@ router.get("/memories/*", function(req, res/*, next*/) {
if (id == -1) { if (id == -1) {
index = "strftime('%m%d',taken)=strftime('%m%d',:date)"; index = "strftime('%m%d',taken)=strftime('%m%d',:date)";
} else { } 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(/\?.*$/, "")); let date = new Date(decodeURI(req.url).replace(/\?.*$/, ""));