Fixed days query
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
0065f26b10
commit
4e6288455e
@ -27,10 +27,10 @@ const router = express.Router();
|
|||||||
router.get("/*", function(req, res/*, next*/) {
|
router.get("/*", function(req, res/*, next*/) {
|
||||||
const path = decodeURI(req.url).replace(/\?.*$/, "").replace(/^\//, "");
|
const path = decodeURI(req.url).replace(/\?.*$/, "").replace(/^\//, "");
|
||||||
|
|
||||||
console.log("Looking for daily photo counts in " + path);
|
console.log("Looking for daily photo counts in '" + path + "'");
|
||||||
return photoDB.sequelize.query(
|
return photoDB.sequelize.query(
|
||||||
"SELECT DATE(photos.taken) AS date,COUNT(photos.id) AS count FROM albums " +
|
"SELECT DATE(photos.taken) AS date,COUNT(photos.id) AS count FROM albums " +
|
||||||
"JOIN photos ON photos.deleted!=1 AND photos.duplicate=0 AND photos.albumId=albums.id AND photos.taken NOT NULL" +
|
"JOIN photos ON photos.deleted!=1 AND photos.duplicate=0 AND photos.albumId=albums.id AND photos.taken IS NOT NULL " +
|
||||||
"WHERE albums.path LIKE :path GROUP BY DATE(photos.taken) ORDER BY date DESC", {
|
"WHERE albums.path LIKE :path GROUP BY DATE(photos.taken) ORDER BY date DESC", {
|
||||||
replacements: {
|
replacements: {
|
||||||
path: path + "%"
|
path: path + "%"
|
||||||
@ -40,7 +40,6 @@ router.get("/*", function(req, res/*, next*/) {
|
|||||||
}).then(function(days) {
|
}).then(function(days) {
|
||||||
return res.status(200).json(days);
|
return res.status(200).json(days);
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
console.error("Query failed: " + query);
|
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user