rating as float
This commit is contained in:
@@ -66,7 +66,7 @@ type Rating struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Topic struct {
|
type Topic struct {
|
||||||
Points int `json:"points"`
|
Points float64 `json:"points"`
|
||||||
MaxPoints float64 `json:"maxPoints"`
|
MaxPoints float64 `json:"maxPoints"`
|
||||||
ID int `json:"id,omitempty"`
|
ID int `json:"id,omitempty"`
|
||||||
ShortName string `json:"shortName"`
|
ShortName string `json:"shortName"`
|
||||||
@@ -78,7 +78,7 @@ type Topic struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Aspect struct {
|
type Aspect struct {
|
||||||
Points int `json:"points"`
|
Points float64 `json:"points"`
|
||||||
MaxPoints float64 `json:"maxPoints"`
|
MaxPoints float64 `json:"maxPoints"`
|
||||||
ID int `json:"id,omitempty"`
|
ID int `json:"id,omitempty"`
|
||||||
ShortName string `json:"shortName"`
|
ShortName string `json:"shortName"`
|
||||||
|
|||||||
@@ -181,7 +181,14 @@ func XLSX(r io.Reader, conf *Conf) (*ecalc.Ecalc, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
set.Field(&aspect, c.Field, cellValue)
|
if cellValue == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
err = set.Field(&aspect, c.Field, cellValue)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(shortName, c.Field, cellValue)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
topic.Aspects = append(topic.Aspects, aspect)
|
topic.Aspects = append(topic.Aspects, aspect)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package loader
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/matryer/is"
|
"github.com/matryer/is"
|
||||||
@@ -23,6 +24,9 @@ func TestXLSX(t *testing.T) {
|
|||||||
is.Equal(got.CompanyFacts.FinancialCosts, 12)
|
is.Equal(got.CompanyFacts.FinancialCosts, 12)
|
||||||
is.Equal(got.CompanyFacts.EmployeesFractions[1].CountryCode, "AUT")
|
is.Equal(got.CompanyFacts.EmployeesFractions[1].CountryCode, "AUT")
|
||||||
|
|
||||||
|
is.Equal(math.Round(got.CompanyFacts.Rating.Topics[0].Aspects[0].Points), math.Round(4))
|
||||||
|
is.Equal(math.Round(got.CompanyFacts.Rating.Topics[0].Aspects[1].Points), math.Round(-9))
|
||||||
|
|
||||||
is.Equal(got.Matrix.Topics[0].ShortName, "A1")
|
is.Equal(got.Matrix.Topics[0].ShortName, "A1")
|
||||||
is.Equal(got.Matrix.Topics[0].MaxPoints, 44)
|
is.Equal(got.Matrix.Topics[0].MaxPoints, 44)
|
||||||
is.Equal(got.Matrix.Topics[4].ShortName, "B1")
|
is.Equal(got.Matrix.Topics[4].ShortName, "B1")
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user