storyestimate.ui.js 773 B

12345678910111213141516171819202122232425262728293031
  1. window.updateAverage = function()
  2. {
  3. var $estimates = $('.story-estimate');
  4. if($('.new-estimate').length > 0) $estimates = $('.new-estimate');
  5. var summary = 0;
  6. var count = 0;
  7. var average = 0;
  8. $estimates.each(function()
  9. {
  10. var value = $(this).find('input[name^="estimate"]').val();
  11. if(value)
  12. {
  13. value = parseFloat(value);
  14. if(isNaN(value)) value = 0;
  15. if(value != 0)
  16. {
  17. summary += value;
  18. count += 1;
  19. }
  20. }
  21. })
  22. if(count) average = summary / count;
  23. $('#average').val(average.toFixed(2));
  24. }
  25. window.selectRound = function(loadUrl)
  26. {
  27. loadModal(loadUrl.replace('%s', $('input[name="round"]').val()), 'current');
  28. }