fixed last_update in laytergroup response
This commit is contained in:
parent
4e7f92c60d
commit
e53122de7e
@ -82,9 +82,8 @@ module.exports = function(){
|
||||
};
|
||||
|
||||
me.findLastUpdated = function (username, api_key, tableNames, callback) {
|
||||
|
||||
var sql = 'SELECT EXTRACT(EPOCH FROM max(updated_at)) FROM CDB_TableMetadata WHERE m.tabname::name = any ({'
|
||||
+ tableNames.join(',') + '})';
|
||||
var sql = 'SELECT EXTRACT(EPOCH FROM max(updated_at)) as max FROM CDB_TableMetadata m WHERE m.tabname::name = any (\'{'
|
||||
+ tableNames.join(',') + '}\')';
|
||||
|
||||
// call sql api
|
||||
me.sqlQuery(username, api_key, sql, function(err, rows){
|
||||
@ -93,7 +92,11 @@ module.exports = function(){
|
||||
callback(new Error('could not find last updated timestamp: ' + msg));
|
||||
return;
|
||||
}
|
||||
var last_updated = rows[0].max;
|
||||
// when the table has not updated_at means it hasn't been changed so a default last_updated is set
|
||||
var last_updated = 0;
|
||||
if(rows.length !== 0) {
|
||||
last_updated = rows[0].max || 0;
|
||||
}
|
||||
callback(null, last_updated);
|
||||
});
|
||||
};
|
||||
|
@ -66,9 +66,9 @@ suite('multilayer', function() {
|
||||
+ '$windshaft$)'
|
||||
});
|
||||
expectedBody.last_updated = JSON.stringify({
|
||||
'q': 'SELECT EXTRACT(EPOCH FROM max(updated_at)) '
|
||||
+ 'FROM CDB_TableMetadata WHERE m.tabname::name = any ({'
|
||||
+ qTables + '})'
|
||||
'q': 'SELECT EXTRACT(EPOCH FROM max(updated_at)) as max '
|
||||
+ 'FROM CDB_TableMetadata m WHERE m.tabname::name = any (\'{'
|
||||
+ qTables + '}\')'
|
||||
});
|
||||
if ( expected_token ) {
|
||||
//assert.equal(parsedBody.layergroupid, expectedBody.layergroupid);
|
||||
|
Loading…
Reference in New Issue
Block a user