refacto: remove **some** of the disgusting int type casting

The line was too long anyway, it's best to have an intermediate variable
main
Dominique Merle 3 years ago
parent eb5bef584c
commit 148ddcbeb1

@ -105,11 +105,17 @@ func (mj *MajorityJudgment) ComputeScore(tally *ProposalTally, favorContestation
for i := uint8(0); i < amountOfGrades; i++ {
analysis.Run(mutatedTally, favorContestation)
score += fmt.Sprintf("%0"+fmt.Sprintf("%d", amountOfDigitsForGrade)+"d", analysis.MedianGrade)
// fixme: BAD → uint64 to int conversion — either move to int everywhere, or use whatever bigint Go has
score += fmt.Sprintf("%0"+fmt.Sprintf("%d", amountOfDigitsForAdhesionScore)+"d", int(amountOfJudgments)+int(analysis.SecondGroupSize)*analysis.SecondGroupSign)
//adhesionScore := amountOfJudgments) + analysis.SecondGroupSize * analysis.SecondGroupSign
adhesionScore := amountOfJudgments
if analysis.SecondGroupSign > 0 {
adhesionScore = adhesionScore + analysis.SecondGroupSize
} else if analysis.SecondGroupSign < 0 {
adhesionScore = adhesionScore - analysis.SecondGroupSize
}
score += fmt.Sprintf("%0"+fmt.Sprintf("%d", amountOfDigitsForAdhesionScore)+"d", adhesionScore)
regradingErr := mutatedTally.RegradeJudgments(analysis.MedianGrade, analysis.SecondMedianGrade)
if nil != regradingErr {
return "", regradingErr // 仕方がない
return "", regradingErr // 仕方がない C'est la vie ! (see issue #4)
}
}

Loading…
Cancel
Save