Files
goodcalc/goodcalc.go
2020-12-23 08:35:18 +01:00

70 lines
2.6 KiB
Go

// Package goodcalc is a good balance calculator
// The logic of the calculation is based on the
// excel calculator. The simple steps can be found
// inside the MatrixBerechnung.ods file inside this
// repository.
package goodcalc
// Matrix contains the stakeholders and the maximal
// allowed points of the calculation. The calculation
// is pretty simple. Inside each aspect ValuationPoints
// can be defined. Over the maximal possible points
// the balancePoints are calculated.
//
// It is possible to define different weights on different
// layers (stakeholder, theme and aspect).
// This type does not contain any businesslogic of the version
// of the matrix.
type Matrix struct {
MaxPoints int `json:"max_points,omitempty"`
Stakeholders []Stakeholder `json:"stakeholders,omitempty"`
}
// Stakeholder can define a weight, which is calculated to
// all containing themes.
// No is the id like in the excel
// For example A for Suppliers
type Stakeholder struct {
No string `json:"no,omitempty"`
Weight float32 `json:"weight,omitempty"`
Themes []Theme `json:"themes,omitempty"`
}
// Theme is the basic element of the matrix.
// No defines the id of the excel balance.
// A1 for Human dignity in the supply chain
type Theme struct {
No string `json:"no,omitempty"`
Weight float32 `json:"weight,omitempty"`
Aspects []Aspect `json:"aspects,omitempty"`
NegativeAspects []NegativeAspect `json:"negative_aspects,omitempty"`
Calculation ThemeCalc `json:"calculation,omitempty"`
}
// Aspect does contain the valuation of the company.
type Aspect struct {
No string `json:"no,omitempty"`
Weight float32 `json:"weight,omitempty"`
ValuationPoints int `json:"valuation_points,omitempty"`
}
// NegativeAspect has the same fields like Aspect. But the
// business logic requieres a different handling.
type NegativeAspect struct {
Aspect
}
// ThemeCalc contains the different calculation
// steps.
type ThemeCalc struct {
CalcWeight float32 `json:"calc_weight,omitempty"`
WeightFactor float32 `json:"weight_factor,omitempty"`
MaxPoints float32 `json:"max_points,omitempty"`
NrPositiveAspects int `json:"nr_positive_aspects,omitempty"`
ValuationPoints int `json:"valuation_points,omitempty"`
EstPercentage float32 `json:"est_percentage,omitempty"`
BalancePoints int `json:"balance_points,omitempty"`
NegativeValuationPoints int `json:"negative_valuation_points,omitempty"`
NegativeBlancePoints int `json:"negative_blance_points,omitempty"`
}