Code is not picking the last update date - fix
- Sorted dates to pick up the last one - Changed url on grunt file for development environment config Signed-off-by: Teresita de Jesus Guerrero Vela <teresita.guerrero.vela@intel.com>
This commit is contained in:
parent
f2a471f285
commit
b2e41cf7ad
|
@ -71,11 +71,11 @@ module.exports = function(UserStory) {
|
||||||
})
|
})
|
||||||
|
|
||||||
blueprintsResume.percentage = (blueprintsResume.completed/blueprintsResume.total)*100;
|
blueprintsResume.percentage = (blueprintsResume.completed/blueprintsResume.total)*100;
|
||||||
|
|
||||||
return blueprintsResume;
|
return blueprintsResume;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the field lastupdated for a usterStory
|
//get the field lastupdated for a usterStory
|
||||||
var getLastUpdated = function(userStory, cb){
|
var getLastUpdated = function(userStory, cb){
|
||||||
var Patch = app.models.Patch;
|
var Patch = app.models.Patch;
|
||||||
var lastUpdate = '';
|
var lastUpdate = '';
|
||||||
|
@ -83,12 +83,10 @@ module.exports = function(UserStory) {
|
||||||
Patch.latestUpdate(userStory.source, function (err, response, next) {
|
Patch.latestUpdate(userStory.source, function (err, response, next) {
|
||||||
response = JSON.parse(response.substring(5));
|
response = JSON.parse(response.substring(5));
|
||||||
|
|
||||||
console.log('response', response);
|
|
||||||
|
|
||||||
if(response.length > 0){
|
if(response.length > 0){
|
||||||
lastUpdate = response.map( function each (element){
|
lastUpdate = response.map( function each (element){
|
||||||
return element.updated
|
return element.updated
|
||||||
}).sort().shift();
|
}).sort().pop();
|
||||||
var arrayLastUpdate = lastUpdate.split(' ');
|
var arrayLastUpdate = lastUpdate.split(' ');
|
||||||
lastUpdate = arrayLastUpdate[0];
|
lastUpdate = arrayLastUpdate[0];
|
||||||
|
|
||||||
|
@ -103,7 +101,7 @@ module.exports = function(UserStory) {
|
||||||
|
|
||||||
// Parse data from userStory
|
// Parse data from userStory
|
||||||
var parseUserStory = function(userStory, callback){
|
var parseUserStory = function(userStory, callback){
|
||||||
|
|
||||||
async.waterfall([function(cb){
|
async.waterfall([function(cb){
|
||||||
|
|
||||||
getLastUpdated(userStory, cb)
|
getLastUpdated(userStory, cb)
|
||||||
|
@ -115,7 +113,7 @@ module.exports = function(UserStory) {
|
||||||
userStory.completed = getbluePrintResume(userStory);
|
userStory.completed = getbluePrintResume(userStory);
|
||||||
|
|
||||||
cb(null, userStory);
|
cb(null, userStory);
|
||||||
|
|
||||||
},function(userStory, cb){
|
},function(userStory, cb){
|
||||||
|
|
||||||
var tasksName = userStory.tasks;
|
var tasksName = userStory.tasks;
|
||||||
|
@ -292,7 +290,7 @@ module.exports = function(UserStory) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UserStory.on('attached',function(){
|
UserStory.on('attached',function(){
|
||||||
|
|
||||||
|
@ -300,7 +298,7 @@ module.exports = function(UserStory) {
|
||||||
|
|
||||||
var userStory = getFileById(id);
|
var userStory = getFileById(id);
|
||||||
parseUserStory(userStory, cb);
|
parseUserStory(userStory, cb);
|
||||||
|
|
||||||
};//end find by id
|
};//end find by id
|
||||||
|
|
||||||
UserStory.find = function(params, cb){
|
UserStory.find = function(params, cb){
|
||||||
|
@ -313,7 +311,7 @@ module.exports = function(UserStory) {
|
||||||
async.waterfall([function(cb){
|
async.waterfall([function(cb){
|
||||||
getLastUpdated(userStory, cb)
|
getLastUpdated(userStory, cb)
|
||||||
},function(lastUpdated, cb){
|
},function(lastUpdated, cb){
|
||||||
|
|
||||||
var itemResult = {
|
var itemResult = {
|
||||||
completed: getbluePrintResume(userStory),
|
completed: getbluePrintResume(userStory),
|
||||||
dateCreated: userStory.date,
|
dateCreated: userStory.date,
|
||||||
|
@ -323,7 +321,7 @@ module.exports = function(UserStory) {
|
||||||
};
|
};
|
||||||
|
|
||||||
cb(null, itemResult);
|
cb(null, itemResult);
|
||||||
|
|
||||||
}],function(err,result){
|
}],function(err,result){
|
||||||
callback( err, result);
|
callback( err, result);
|
||||||
})
|
})
|
||||||
|
|
|
@ -314,7 +314,7 @@ module.exports = function (grunt) {
|
||||||
development: {
|
development: {
|
||||||
constants: function() {
|
constants: function() {
|
||||||
var config = require('./' + grunt.config.get('ngconstant.options.configPath'))
|
var config = require('./' + grunt.config.get('ngconstant.options.configPath'))
|
||||||
config.apiBaseUrl = 'http://localhost:3004';
|
config.apiBaseUrl = 'http://localhost:3004/api';
|
||||||
return { appConfig : config};
|
return { appConfig : config};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue