@@ -68,24 +68,22 @@ module.exports = function(UserStory) {
6868 } )
6969
7070 blueprintsResume . percentage = ( blueprintsResume . completed / blueprintsResume . total ) * 100 ;
71-
71+
7272 return blueprintsResume ;
7373 }
7474
75- //get the field lastupdated for a usterStory
75+ //get the field lastupdated for a usterStory
7676 var getLastUpdated = function ( userStory , cb ) {
7777 var Patch = app . models . Patch ;
7878 var lastUpdate = '' ;
7979
8080 Patch . latestUpdate ( userStory . source , function ( err , response , next ) {
8181 response = JSON . parse ( response . substring ( 5 ) ) ;
8282
83- console . log ( 'response' , response ) ;
84-
8583 if ( response . length > 0 ) {
8684 lastUpdate = response . map ( function each ( element ) {
8785 return element . updated
88- } ) . sort ( ) . shift ( ) ;
86+ } ) . sort ( ) . pop ( ) ;
8987 var arrayLastUpdate = lastUpdate . split ( ' ' ) ;
9088 lastUpdate = arrayLastUpdate [ 0 ] ;
9189
@@ -100,7 +98,7 @@ module.exports = function(UserStory) {
10098
10199 // Parse data from userStory
102100 var parseUserStory = function ( userStory , callback ) {
103-
101+
104102 async . waterfall ( [ function ( cb ) {
105103
106104 getLastUpdated ( userStory , cb )
@@ -112,7 +110,7 @@ module.exports = function(UserStory) {
112110 userStory . completed = getbluePrintResume ( userStory ) ;
113111
114112 cb ( null , userStory ) ;
115-
113+
116114 } , function ( userStory , cb ) {
117115
118116 var tasksName = userStory . tasks ;
@@ -289,7 +287,7 @@ module.exports = function(UserStory) {
289287
290288 }
291289
292-
290+
293291
294292 UserStory . on ( 'attached' , function ( ) {
295293
@@ -302,8 +300,7 @@ module.exports = function(UserStory) {
302300 } else {
303301 cb ( 'File does not exist' , null ) ;
304302 }
305-
306-
303+
307304 } ; //end find by id
308305
309306 UserStory . find = function ( params , cb ) {
@@ -316,7 +313,7 @@ module.exports = function(UserStory) {
316313 async . waterfall ( [ function ( cb ) {
317314 getLastUpdated ( userStory , cb )
318315 } , function ( lastUpdated , cb ) {
319-
316+
320317 var itemResult = {
321318 completed : getbluePrintResume ( userStory ) ,
322319 dateCreated : userStory . date ,
@@ -326,7 +323,7 @@ module.exports = function(UserStory) {
326323 } ;
327324
328325 cb ( null , itemResult ) ;
329-
326+
330327 } ] , function ( err , result ) {
331328 callback ( err , result ) ;
332329 } )
0 commit comments