Skip to content

Commit

Permalink
enhance: data/statictimeseries: adjust report percentage for 0
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Jun 14, 2021
1 parent 2b43eec commit 04ccca3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/statictimeseries/data_series_set_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ func (dss *DataSeriesSet) ToTable(opts *DssTableOpts) (table.Table, error) {
}
if opts.PercentInclude {
for _, seriesValue := range seriesValues {
line = append(line, fmt.Sprintf("%.10f", seriesValue/lineTotal))
if lineTotal == 0 {
line = append(line, fmt.Sprintf("%.10f", lineTotal))
} else {
line = append(line, fmt.Sprintf("%.10f", seriesValue/lineTotal))
}
}
}
tbl.Rows = append(tbl.Rows, line)
Expand Down

0 comments on commit 04ccca3

Please sign in to comment.