Skip to content

Instantly share code, notes, and snippets.

@borkweb
Last active August 29, 2015 14:22
Show Gist options
  • Save borkweb/b2444a27ce31b1f3c717 to your computer and use it in GitHub Desktop.
Save borkweb/b2444a27ce31b1f3c717 to your computer and use it in GitHub Desktop.
// Calculate hours for any type of ticket in the next release
(function( $ ) {
var total = 0;
$('.estimated_hours').each(function() {
var $el = $( this );
var $row = $el.closest( 'tr' );
var $version = $row.find( '.fixed_version a' );
if ( 'Next Release' !== $.trim( $version.html() ) ) return;
var val = $.trim( $( this ).text() );
if ( ! val ) return;
total += parseFloat( val );
});
console.log( 'Hours estimated: ' + total );
})( jQuery );
// calculate hours for next release that aren't pending code review, smoketest, qa, or release
(function( $ ) {
var total = 0;
$('.estimated_hours').each(function() {
var $el = $( this );
var $row = $el.closest( 'tr' );
var $version = $row.find( '.fixed_version a' );
var $status = $row.find( '.status' );
var status = $.trim( $status.html() );
if ( 'Next Release' !== $.trim( $version.html() ) ) return;
if (
'Pending Code Review' === status
|| 'Pending QA' === status
|| 'Pending Smoketest' === status
|| 'Pending Release' === status
) {
return;
}
var val = $.trim( $( this ).text() );
if ( ! val ) return;
total += parseFloat( val );
});
console.log( 'Hours estimated: ' + total );
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment