[BUGFIX] show NaN on link (fix #149)

This commit is contained in:
Martin/Geno 2018-10-07 20:04:36 +02:00 committed by Geno
parent eddd556ec1
commit 6579d52bac
2 changed files with 4 additions and 2 deletions

View File

@ -93,7 +93,7 @@ func transform(nodes *runtime.Nodes) *Meshviewer {
Target: linkOrigin.TargetID,
TargetAddress: linkOrigin.TargetAddress,
SourceTQ: linkOrigin.TQ,
TargetTQ: linkOrigin.TQ,
TargetTQ: 0,
}
linkType, linkTypeFound := typeList[linkOrigin.SourceAddress]
@ -102,8 +102,10 @@ func transform(nodes *runtime.Nodes) *Meshviewer {
}
if switchSourceTarget {
link.SourceTQ = 0
link.Source = linkOrigin.TargetID
link.SourceAddress = linkOrigin.TargetAddress
link.TargetTQ = linkOrigin.TQ
link.Target = linkOrigin.SourceID
link.TargetAddress = linkOrigin.SourceAddress

View File

@ -164,7 +164,7 @@ func TestTransform(t *testing.T) {
assert.Equal("other", link.Type)
assert.Equal("node:b:mac:lan", link.TargetAddress)
assert.Equal(float32(0.2), link.SourceTQ)
assert.Equal(float32(0.2), link.TargetTQ)
assert.Equal(float32(0), link.TargetTQ)
break
case "node:a:mac:wifi":