Checking to see if memories is returning replicated entries
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
7b846eb2b4
commit
cf4102373b
@ -40,17 +40,14 @@ router.get("/memories/*", function(req, res/*, next*/) {
|
|||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
index = "";
|
index = "";
|
||||||
} else {
|
} else {
|
||||||
if (id != -1) {
|
index = " AND ((taken=DATE(:cursor) AND id<"+id+ ") OR taken<DATE(:cursor))";
|
||||||
index = " AND ((taken=DATE(:cursor) AND id<"+id+ ") OR taken<DATE(:cursor))";
|
|
||||||
} else {
|
|
||||||
index = " AND (taken<=DATE(:cursor))";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let date = new Date(decodeURI(req.url).replace(/\?.*$/, ""));
|
let date = new Date(decodeURI(req.url).replace(/\?.*$/, ""));
|
||||||
let query = "SELECT * FROM photos WHERE strftime('%m%d',taken)=strftime('%m%d',:date) " + index + " ORDER BY taken DESC,id DESC LIMIT " + (limit * 2 + 1);
|
let query = "SELECT * FROM photos WHERE strftime('%m%d',taken)=strftime('%m%d',:date) " + index + " ORDER BY taken DESC,id DESC LIMIT " + (limit * 2 + 1);
|
||||||
|
|
||||||
console.log("Memories for " + date.toISOString().replace(/T.*/, ""));
|
console.log("Memories for " + date.toISOString().replace(/T.*/, ""));
|
||||||
|
console.log(query);
|
||||||
|
|
||||||
return photoDB.sequelize.query(query, {
|
return photoDB.sequelize.query(query, {
|
||||||
replacements: {
|
replacements: {
|
||||||
@ -112,11 +109,7 @@ router.get("/*", function(req, res/*, next*/) {
|
|||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
index = "";
|
index = "";
|
||||||
} else {
|
} else {
|
||||||
if (id != -1) {
|
index = " AND ((taken=DATE(:cursor) AND id<"+id+ ") OR taken<DATE(:cursor))";
|
||||||
index = " AND ((taken=DATE(:cursor) AND id<"+id+ ") OR taken<DATE(:cursor))";
|
|
||||||
} else {
|
|
||||||
index = " AND (taken<=DATE(:cursor))";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = decodeURI(req.url).replace(/\?.*$/, ""),
|
let path = decodeURI(req.url).replace(/\?.*$/, ""),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user