...
|
...
|
@@ -28,15 +28,15 @@ func (in *UpdateTemplateCommand) Valid(validation *validation.Validation) { |
|
|
} else {
|
|
|
for i := range in.LinkNodes {
|
|
|
linkNode := in.LinkNodes[i]
|
|
|
// 填写自评反馈,如果有评估内容时,内容权重相加 = 100%
|
|
|
if linkNode.Type == domain.LinkNodeSelfAssessment && len(linkNode.NodeContents) > 0 {
|
|
|
// 如果有评估内容时,内容权重相加 = 100%
|
|
|
if len(linkNode.NodeContents) > 0 {
|
|
|
weightTotal := 0.0
|
|
|
for i2 := range linkNode.NodeContents {
|
|
|
weightTotal += linkNode.NodeContents[i2].Weight
|
|
|
}
|
|
|
if weightTotal != 100 {
|
|
|
formatWeightTotal := utils.FormatFloatDecimal(weightTotal, 2)
|
|
|
validation.SetError("linkNodes", fmt.Sprintf("权重错误,当前%s的总权重值为:%s%%(必须等于100%%)", linkNode.Name, formatWeightTotal))
|
|
|
validation.SetError("linkNodes", fmt.Sprintf("总权重值错误,当前%s的总权重值为:%s%%(必须等于100%%)", linkNode.Name, formatWeightTotal))
|
|
|
return
|
|
|
}
|
|
|
}
|
...
|
...
|
|