#1 all ratings are maped
This commit is contained in:
@@ -94,6 +94,52 @@ func XLSX(r io.Reader, conf *Conf) (*ecalc.Ecalc, error) {
|
||||
}
|
||||
|
||||
}
|
||||
var topic ecalc.Topic
|
||||
for r := conf.Rating.StartRow; r <= conf.Rating.EndRow; r++ {
|
||||
shortName, err := xFile.GetCellValue(
|
||||
xFile.GetSheetName(conf.Rating.Sheet),
|
||||
fmt.Sprintf("%s%d", conf.Rating.ShortNameCol, r),
|
||||
)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if len(shortName) < 2 {
|
||||
continue
|
||||
} else if len(shortName) == 2 {
|
||||
if topic.ShortName != "" {
|
||||
eBalance.CompanyFacts.Rating.Topics = append(eBalance.CompanyFacts.Rating.Topics, topic)
|
||||
}
|
||||
topic = ecalc.Topic{
|
||||
ShortName: shortName,
|
||||
}
|
||||
for _, c := range conf.Rating.Cols {
|
||||
cellValue, err := xFile.GetCellValue(
|
||||
xFile.GetSheetName(conf.Rating.Sheet),
|
||||
fmt.Sprintf("%s%d", c.Col, r),
|
||||
)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
set.Field(&topic, c.Field, cellValue)
|
||||
}
|
||||
} else {
|
||||
aspect := ecalc.Aspect{
|
||||
ShortName: shortName,
|
||||
}
|
||||
for _, c := range conf.Rating.Cols {
|
||||
cellValue, err := xFile.GetCellValue(
|
||||
xFile.GetSheetName(conf.Rating.Sheet),
|
||||
fmt.Sprintf("%s%d", c.Col, r),
|
||||
)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
set.Field(&aspect, c.Field, cellValue)
|
||||
}
|
||||
topic.Aspects = append(topic.Aspects, aspect)
|
||||
}
|
||||
}
|
||||
eBalance.CompanyFacts.Rating.Topics = append(eBalance.CompanyFacts.Rating.Topics, topic)
|
||||
// TODO: error handling of errs
|
||||
return eBalance, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user