Browse Source

Merge pull request #312 from shaunst55/complete-points-backlog

added the ability to display completed point totals on backlog sprints
Alan Hardman 2 years ago
parent
commit
c403ee05bf
2 changed files with 21 additions and 1 deletions
  1. 1 0
      app/view/backlog/index.html
  2. 20 1
      js/backlog.js

+ 1 - 0
app/view/backlog/index.html

@@ -107,6 +107,7 @@
 								<div class="panel-body {{ @key ? 'collapse' : 'in' }}" id="panel-{{ @sprint.id }}">
 									<div class="panel-head-points text-muted">
 										<span>{{ @dict.backlog_points }}:</span>
+										<span class="points-label-completed">0</span> /
 										<span class="points-label">0</span>
 									</div>
 									<ul class="list-group sortable" data-list-id="{{ @sprint.id }}">

+ 20 - 1
js/backlog.js

@@ -21,6 +21,7 @@ function getQueryVariable(variable) {
 
 function refreshPoints(){
 	$('.panel').each(function() {
+		// calculates total points in the backlog and sprints
 		var points = 0;
 		$('.list-group-item:not(.hidden-group):not(.hidden-type)', this).each(function() {
 			var val = parseInt($(this).attr('data-points'), 10);
@@ -28,14 +29,32 @@ function refreshPoints(){
 				points += val;
 			}
 		});
+		
+		// calculates completed points in sprints
+		var completedPoints = 0;
+		$('.list-group-item.completed:not(.hidden-group):not(.hidden-type)', this).each(function() {
+			var cval = parseInt($(this).attr('data-points'), 10);
+			if (cval > 0) {
+				completedPoints += cval;
+			}
+		});
+		
+		// if no total points than hide points displayed
 		if (points) {
 			$('.panel-head-points', this).show();
 		} else {
 			$('.panel-head-points', this).hide();
 		}
+		
+		// adds points to span
 		$(".points-label", this).text(points);
+		
+		// adds completed points to span
+		$(".points-label-completed", this).text(completedPoints);
 	});
-}
+	$('.panel').each(function() {
+	});
+};
 
 var Backlog = {
 	init: function() {