Project

General

Profile

Feature #8559 » total-estimate.js

Bevan Rudge, 2011-06-07 23:37

 
// Load an external JS script
function loadjsfile(filename){
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
if (typeof fileref!="undefined") {
document.getElementsByTagName("head")[0].appendChild(fileref)
}
}

loadjsfile("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js");

(function ($) {
var total_hours = 0;
$('table.list.issues td.estimated_hours').each(function () {
var hours = parseFloat($(this).html());
if ( hours != 0 && hours) {
total_hours += hours;
}
});

/**
This could handle building out a percentage complete but requires calculating
against the estimated time for this task
var percent_complete = 0;
var total_rows = 0;
$('table.list.issues td.done_ratio table.progress td.closed').each(function () {
total_rows += 100;
var estimated = parseFloat($(this).css('width'));
if ( estimated != 0 && estimated) {
percent_complete += estimated;
}
});
*/

$("table.list.issues tr.group.open td").each(function () {
$(this).attr('colspan', 6);
$(this).after('<td></td><td>' + total_hours + ' hours scheduled</td>');
});

})(jQuery);
(2-2/2)