File tree 2 files changed +18
-1
lines changed
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{} {
368
368
globalHistory , lastDay := analyser .groupSparseHistory (analyser .globalHistory , - 1 )
369
369
fileHistories := map [string ]DenseHistory {}
370
370
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
+ }
372
374
}
373
375
peopleHistories := make ([]DenseHistory , analyser .PeopleNumber )
374
376
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) {
1170
1170
assert .Equal (t , result .granularity , 30 )
1171
1171
assert .Equal (t , result .sampling , 30 )
1172
1172
}
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