first calculation logic
This commit is contained in:
57
goodcalc.go
57
goodcalc.go
@@ -5,47 +5,12 @@
|
||||
// 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"`
|
||||
No string `json:"no"`
|
||||
Weight float32 `json:"weight"`
|
||||
MaxValuationPoints int `json:"max_valuation_points"`
|
||||
ValuationPoints int `json:"valuation_points"`
|
||||
}
|
||||
|
||||
// NegativeAspect has the same fields like Aspect. But the
|
||||
@@ -53,17 +18,3 @@ type Aspect struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user