File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -368,7 +368,9 @@ func (analyser *BurndownAnalysis) Finalize() interface{} {
368368 globalHistory , lastDay := analyser .groupSparseHistory (analyser .globalHistory , - 1 )
369369 fileHistories := map [string ]DenseHistory {}
370370 for key , history := range analyser .fileHistories {
371- fileHistories [key ], _ = analyser .groupSparseHistory (history , lastDay )
371+ if len (history ) > 0 {
372+ fileHistories [key ], _ = analyser .groupSparseHistory (history , lastDay )
373+ }
372374 }
373375 peopleHistories := make ([]DenseHistory , analyser .PeopleNumber )
374376 for i , history := range analyser .peopleHistories {
Original file line number Diff line number Diff line change @@ -1170,3 +1170,18 @@ func TestBurndownDeserialize(t *testing.T) {
11701170 assert .Equal (t , result .granularity , 30 )
11711171 assert .Equal (t , result .sampling , 30 )
11721172}
1173+
1174+ func TestBurndownEmptyFileHistory (t * testing.T ) {
1175+ burndown := & BurndownAnalysis {
1176+ Sampling : 30 ,
1177+ Granularity : 30 ,
1178+ globalHistory : sparseHistory {0 : map [int ]int64 {0 : 10 }},
1179+ fileHistories : map [string ]sparseHistory {"test.go" : {}},
1180+ }
1181+ res := burndown .Finalize ().(BurndownResult )
1182+ assert .Len (t , res .GlobalHistory , 1 )
1183+ assert .Len (t , res .FileHistories , 0 )
1184+ assert .NotNil (t , res .FileHistories )
1185+ assert .Len (t , res .PeopleHistories , 0 )
1186+ assert .NotNil (t , res .PeopleHistories )
1187+ }
You can’t perform that action at this time.
0 commit comments