first simple test for positive aspects

This commit is contained in:
Andreas Schröpfer
2021-01-02 17:10:54 +01:00
parent d646a0d610
commit 8660dd4b88
6 changed files with 168 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
package goodcalc
import "fmt"
// Stakeholder can define a weight, which is calculated to
// all containing themes.
// No is the id like in the excel
@@ -10,6 +12,17 @@ type Stakeholder struct {
Themes []*Theme `json:"themes"`
}
func (s *Stakeholder) String() string {
var str string
str += fmt.Sprintf("\n No: %s\n", s.No)
str += fmt.Sprintf(" Weight: %.1f\n", s.Weight)
str += fmt.Sprintf(" Themes: %v\n", s.Themes)
return str
}
// calcWeight takes the weight of the stakeholder level
// and calculates that weight for each theme
// iteration 1 inside the example table
func (s *Stakeholder) calcWeight() {
for _, t := range s.Themes {
t.Calc.CalcWeight = s.Weight * t.Weight