private fields for calculated values
This commit is contained in:
6
theme.go
6
theme.go
@@ -10,8 +10,8 @@ type Theme struct {
|
||||
Weight float32 `json:"weight"`
|
||||
Aspects []Aspect `json:"aspects"`
|
||||
NegativeAspects []NegativeAspect `json:"negative_aspects"`
|
||||
NegPointsFactor int `json:"neg_points_factor"`
|
||||
Calc *ThemeCalc `json:"calculation"`
|
||||
negPointsFactor int
|
||||
}
|
||||
|
||||
func (t *Theme) String() string {
|
||||
@@ -20,7 +20,7 @@ func (t *Theme) String() string {
|
||||
s += fmt.Sprintf(" Weight: %.1f\n", t.Weight)
|
||||
s += fmt.Sprintf(" Aspects: %v\n", t.Aspects)
|
||||
s += fmt.Sprintf(" NegativeAspects: %v\n", t.NegativeAspects)
|
||||
s += fmt.Sprintf(" NegPointsFactor: %v\n", t.NegPointsFactor)
|
||||
s += fmt.Sprintf(" NegPointsFactor: %v\n", t.negPointsFactor)
|
||||
s += fmt.Sprintf(" Calc: %s\n", t.Calc)
|
||||
return s
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (t *Theme) calcBalancePoints() {
|
||||
t.Calc.BalancePoints =
|
||||
t.Calc.EstPercentage * t.Calc.MaxBalancePoints
|
||||
t.Calc.NegativeBlancePoints =
|
||||
float32(t.Calc.NegativeValuationPoints) * t.Calc.MaxBalancePoints / float32(t.NegPointsFactor)
|
||||
float32(t.Calc.NegativeValuationPoints) * t.Calc.MaxBalancePoints / float32(t.negPointsFactor)
|
||||
}
|
||||
|
||||
// ThemeCalc contains the different calculation
|
||||
|
||||
Reference in New Issue
Block a user