修复createPlan逻辑错误
This commit is contained in:
@@ -137,10 +137,10 @@ func (r *gormPlanRepository) CreatePlan(plan *models.Plan) error {
|
||||
if plan.ContentType == models.PlanContentTypeSubPlans {
|
||||
childIDsToValidate := make(map[uint]bool)
|
||||
for _, subPlanLink := range plan.SubPlans {
|
||||
if subPlanLink.ChildPlan == nil || subPlanLink.ChildPlan.ID == 0 {
|
||||
if subPlanLink.ChildPlanID == 0 {
|
||||
return ErrSubPlanIDIsZeroOnCreate
|
||||
}
|
||||
childIDsToValidate[subPlanLink.ChildPlan.ID] = true
|
||||
childIDsToValidate[subPlanLink.ChildPlanID] = true
|
||||
}
|
||||
|
||||
var ids []uint
|
||||
|
||||
Reference in New Issue
Block a user