documentation an json-tags

This commit is contained in:
Andreas Schröpfer
2020-12-23 08:35:18 +01:00
parent 148382f70a
commit 6995f73627
2 changed files with 48 additions and 21 deletions

BIN
MatrixBerechnung.ods Normal file

Binary file not shown.

View File

@@ -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"`
}