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 // 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 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 { type Matrix struct {
MaxPoints int MaxPoints int `json:"max_points,omitempty"`
Stakeholders []Stakeholder 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 { type Stakeholder struct {
No string No string `json:"no,omitempty"`
Weight float32 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 { type Theme struct {
No string No string `json:"no,omitempty"`
Weight float32 Weight float32 `json:"weight,omitempty"`
Aspects []Aspect Aspects []Aspect `json:"aspects,omitempty"`
NegativeAspects []NegativeAspect NegativeAspects []NegativeAspect `json:"negative_aspects,omitempty"`
ThemeCalc // calculatet values Calculation ThemeCalc `json:"calculation,omitempty"`
} }
// Aspect does contain the valuation of the company.
type Aspect struct { type Aspect struct {
No string No string `json:"no,omitempty"`
Weight float32 Weight float32 `json:"weight,omitempty"`
Points int ValuationPoints int `json:"valuation_points,omitempty"`
} }
// NegativeAspect has the same fields like Aspect. But the
// business logic requieres a different handling.
type NegativeAspect struct { type NegativeAspect struct {
Aspect Aspect
} }
// ThemeCalc contains the different calculation
// steps.
type ThemeCalc struct { type ThemeCalc struct {
CalcWeight float32 CalcWeight float32 `json:"calc_weight,omitempty"`
WeightFactor float32 WeightFactor float32 `json:"weight_factor,omitempty"`
MaxPoints float32 MaxPoints float32 `json:"max_points,omitempty"`
NrPositiveAspects int NrPositiveAspects int `json:"nr_positive_aspects,omitempty"`
ValuationPoints int ValuationPoints int `json:"valuation_points,omitempty"`
EstPercentage float32 EstPercentage float32 `json:"est_percentage,omitempty"`
blancePoints int BalancePoints int `json:"balance_points,omitempty"`
NegativeValuationPoints int NegativeValuationPoints int `json:"negative_valuation_points,omitempty"`
NegativeBlancePoints int NegativeBlancePoints int `json:"negative_blance_points,omitempty"`
} }