@@ -306,7 +306,6 @@ botsService.getBotsHistory = function getBotsHistory(botId,botsQuery,callback){
306306botsService . updateSavedTimePerBots = function updateSavedTimePerBots ( botId , callback ) {
307307 var query = {
308308 auditType : 'BOTs' ,
309- actionStatus : 'success' ,
310309 isDeleted : false ,
311310 auditId : botId
312311 } ;
@@ -319,7 +318,9 @@ botsService.updateSavedTimePerBots = function updateSavedTimePerBots(botId,callb
319318 var totalTimeInSeconds = 0 ;
320319 for ( var m = 0 ; m < botAuditTrail . length ; m ++ ) {
321320 if ( botAuditTrail [ m ] . endedOn && botAuditTrail [ m ] . endedOn !== null
322- && botAuditTrail [ m ] . auditTrailConfig . manualExecutionTime && botAuditTrail [ m ] . auditTrailConfig . manualExecutionTime !== null ) {
321+ && botAuditTrail [ m ] . auditTrailConfig . manualExecutionTime
322+ && botAuditTrail [ m ] . auditTrailConfig . manualExecutionTime !== null
323+ && botAuditTrail [ m ] . actionStatus === 'success' ) {
323324 var executionTime = getExecutionTime ( botAuditTrail [ m ] . endedOn , botAuditTrail [ m ] . startedOn ) ;
324325 totalTimeInSeconds = totalTimeInSeconds + ( ( botAuditTrail [ m ] . auditTrailConfig . manualExecutionTime * 60 ) - executionTime ) ;
325326 }
@@ -329,7 +330,7 @@ botsService.updateSavedTimePerBots = function updateSavedTimePerBots(botId,callb
329330 hours : Math . floor ( totalTimeInMinutes / 60 ) ,
330331 minutes : totalTimeInMinutes % 60
331332 }
332- bots . updateBotsDetail ( botId , { savedTime : result } , function ( err , data ) {
333+ bots . updateBotsDetail ( botId , { savedTime : result , executionCount : botAuditTrail . length } , function ( err , data ) {
333334 if ( err ) {
334335 logger . error ( err ) ;
335336 callback ( err , null ) ;
0 commit comments