diff --git a/MatrixBerechnung.ods b/MatrixBerechnung.ods new file mode 100644 index 0000000..fbbf201 Binary files /dev/null and b/MatrixBerechnung.ods differ diff --git a/goodcalc.go b/goodcalc.go index 1fff7d2..4c53256 100644 --- a/goodcalc.go +++ b/goodcalc.go @@ -1,42 +1,69 @@ // 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 - Stakeholders []Stakeholder + 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 - Weight float32 + 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 - Weight float32 - Aspects []Aspect - NegativeAspects []NegativeAspect - ThemeCalc // calculatet values + 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 - Weight float32 - Points int + 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 - WeightFactor float32 - MaxPoints float32 - NrPositiveAspects int - ValuationPoints int - EstPercentage float32 - blancePoints int - NegativeValuationPoints int - NegativeBlancePoints int + 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"` }