Changeset 7012


Ignore:
Timestamp:
08/14/12 18:08:46 (7 years ago)
Author:
acoutinho
Message:

Ticket #3022 - Inconsistencia no percentual de conclusao de atividade

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/modules/calendar/js/activity.helpers.js

    r7011 r7012  
    463463    for (var i in tasks){ 
    464464 
    465         if(i == 'length') 
    466             continue; 
    467  
    468         statusTasks[tasks[i].status]++; 
    469  
    470         var stTime = Date.parseExact( tasks[i].startDate + " "+$.trim( tasks[i].startHour) , formatString); 
    471         var enTime = Date.parseExact( tasks[i].endDate + " "+$.trim( tasks[i].endHour), formatString ); 
    472  
    473         startDate = (startDate && startDate.compareTo(stTime) == -1) ? startDate : stTime; 
    474         endDate = endDate.compareTo(enTime) == -1 ? enTime : endDate; 
    475  
    476         if(tasks[i].dueDate != ''){ 
    477             var pvTime = Date.parseExact( tasks[i].dueDate + " "+$.trim( tasks[i].dueTime), formatString ); 
    478             dueDate = dueDate.compareTo(pvTime) == -1 ? pvTime : dueDate; 
    479         } 
    480  
    481         if(parseInt(tasks[i].percentage) > 0) 
    482             percentage += parseInt(parseInt((100 / tasks.length)) * ( parseInt(tasks[i].percentage) / 100)); 
    483     } 
     465        if(i == 'length') 
     466            continue; 
     467 
     468        statusTasks[tasks[i].status]++; 
     469 
     470        var stTime = Date.parseExact( tasks[i].startDate + " "+$.trim( tasks[i].startHour) , formatString); 
     471        var enTime = Date.parseExact( tasks[i].endDate + " "+$.trim( tasks[i].endHour), formatString ); 
     472 
     473        startDate = (startDate && startDate.compareTo(stTime) == -1) ? startDate : stTime; 
     474        endDate = endDate.compareTo(enTime) == -1 ? enTime : endDate; 
     475 
     476        if(tasks[i].dueDate != ''){ 
     477            var pvTime = Date.parseExact( tasks[i].dueDate + " "+$.trim( tasks[i].dueTime), formatString ); 
     478            dueDate = dueDate.compareTo(pvTime) == -1 ? pvTime : dueDate; 
     479        } 
     480 
     481        percentage += parseInt(tasks[i].percentage); 
     482    } 
     483 
     484 
     485    if((percentage > 0) && (tasks.length > 0)) 
     486        percentage = parseInt(percentage / tasks.length); 
     487     
    484488    var statusActivity = 1; 
    485489 
Note: See TracChangeset for help on using the changeset viewer.