2021-01-03 08:08:10 +01:00
2020-12-23 08:16:08 +01:00
2021-01-03 08:08:10 +01:00
2020-12-23 07:44:40 +01:00
2021-01-03 08:08:10 +01:00
2021-01-02 20:01:24 +01:00
2021-01-03 08:08:10 +01:00
2021-01-03 08:08:10 +01:00

# goodcalc

import "."

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.

Usage

type Aspect

type Aspect struct {
	No              string  `json:"no"`
	Weight          float32 `json:"weight"`
	ValuationPoints int     `json:"valuation_points"`
}

Aspect does contain the valuation of the company.

type Matrix

type Matrix struct {
	MaxPoints             int            `json:"max_points"`
	MaxValuationPoints    int            `json:"max_valuation_points"`     // 10
	MaxNegValuationPoints int            `json:"max_neg_valuation_points"` // -200
	NegPointsFactor       int            `json:"neg_points_factor"`        // 50
	Stakeholders          []*Stakeholder `json:"stakeholders"`
	Calculation           *MatrixCalc    `json:"calculation"`
}

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.

func (*Matrix) BalancePoints

func (m *Matrix) BalancePoints() int

BalancePoints calculates the ecogood points for the matrix

func (*Matrix) String

func (m *Matrix) String() string

type MatrixCalc

type MatrixCalc struct {
	SumCalcWeight float32 `json:"sum_calc_weight"`
	WeightFactor  float32 `json:"weight_factor"`
}

MatrixCalc contains calculated values

type NegativeAspect

type NegativeAspect struct {
	Aspect
}

NegativeAspect has the same fields like Aspect. But the business logic requieres a different handling.

type Stakeholder

type Stakeholder struct {
	No     string   `json:"no"`
	Weight float32  `json:"weight"`
	Themes []*Theme `json:"themes"`
}

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

func (*Stakeholder) String

func (s *Stakeholder) String() string

type Theme

type Theme struct {
	No              string           `json:"no"`
	Weight          float32          `json:"weight"`
	Aspects         []Aspect         `json:"aspects"`
	NegativeAspects []NegativeAspect `json:"negative_aspects"`
	Calc            *ThemeCalc       `json:"calculation"`
}

Theme is the basic element of the matrix. No defines the id of the excel balance. A1 for Human dignity in the supply chain

func (*Theme) String

func (t *Theme) String() string

type ThemeCalc

type ThemeCalc struct {
	CalcWeight              float32 `json:"calc_weight"`
	WeightFactor            float32 `json:"weight_factor"`
	MaxBalancePoints        float32 `json:"max_points"`
	NrPositiveAspects       int     `json:"nr_positive_aspects"`
	ValuationPoints         int     `json:"valuation_points"`
	MaxValuationPoints      int     `json:"max_valuation_points"`
	EstPercentage           float32 `json:"est_percentage"`
	BalancePoints           float32 `json:"balance_points"`
	NegativeValuationPoints int     `json:"negative_valuation_points"`
	NegativeBlancePoints    float32 `json:"negative_blance_points"`
}

ThemeCalc contains the different calculation steps.

func (*ThemeCalc) String

func (tc *ThemeCalc) String() string
Description
Prototype for calculating the ecogood balance points.
Readme 83 KiB
Languages
Go 100%