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