fix update of input and output length upon adding signals

This commit is contained in:
Sonja Happ 2021-02-18 14:16:07 +01:00
parent 6c8b55469f
commit cea6149b39

View file

@ -67,8 +67,8 @@ func (s *Signal) addToConfig() error {
}
// adapt length of mapping
var newInputLength = db.Model(m).Where("Direction = ?", "in").Association("InputMapping").Count()
err = db.Model(m).Update("InputLength", newInputLength).Error
var newInputLength = db.Model(&m).Where("Direction = ?", "in").Association("InputMapping").Count()
err = db.Model(&m).Update("InputLength", newInputLength).Error
} else {
err = db.Model(&m).Association("OutputMapping").Append(s).Error
@ -77,8 +77,8 @@ func (s *Signal) addToConfig() error {
}
// adapt length of mapping
var newOutputLength = db.Model(m).Where("Direction = ?", "out").Association("OutputMapping").Count()
err = db.Model(m).Update("OutputLength", newOutputLength).Error
var newOutputLength = db.Model(&m).Where("Direction = ?", "out").Association("OutputMapping").Count()
err = db.Model(&m).Update("OutputLength", newOutputLength).Error
}
return err
}