[BUGFIX] show NaN on link (fix #149)
This commit is contained in:
parent
eddd556ec1
commit
6579d52bac
|
@ -93,7 +93,7 @@ func transform(nodes *runtime.Nodes) *Meshviewer {
|
||||||
Target: linkOrigin.TargetID,
|
Target: linkOrigin.TargetID,
|
||||||
TargetAddress: linkOrigin.TargetAddress,
|
TargetAddress: linkOrigin.TargetAddress,
|
||||||
SourceTQ: linkOrigin.TQ,
|
SourceTQ: linkOrigin.TQ,
|
||||||
TargetTQ: linkOrigin.TQ,
|
TargetTQ: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
linkType, linkTypeFound := typeList[linkOrigin.SourceAddress]
|
linkType, linkTypeFound := typeList[linkOrigin.SourceAddress]
|
||||||
|
@ -102,8 +102,10 @@ func transform(nodes *runtime.Nodes) *Meshviewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if switchSourceTarget {
|
if switchSourceTarget {
|
||||||
|
link.SourceTQ = 0
|
||||||
link.Source = linkOrigin.TargetID
|
link.Source = linkOrigin.TargetID
|
||||||
link.SourceAddress = linkOrigin.TargetAddress
|
link.SourceAddress = linkOrigin.TargetAddress
|
||||||
|
link.TargetTQ = linkOrigin.TQ
|
||||||
link.Target = linkOrigin.SourceID
|
link.Target = linkOrigin.SourceID
|
||||||
link.TargetAddress = linkOrigin.SourceAddress
|
link.TargetAddress = linkOrigin.SourceAddress
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ func TestTransform(t *testing.T) {
|
||||||
assert.Equal("other", link.Type)
|
assert.Equal("other", link.Type)
|
||||||
assert.Equal("node:b:mac:lan", link.TargetAddress)
|
assert.Equal("node:b:mac:lan", link.TargetAddress)
|
||||||
assert.Equal(float32(0.2), link.SourceTQ)
|
assert.Equal(float32(0.2), link.SourceTQ)
|
||||||
assert.Equal(float32(0.2), link.TargetTQ)
|
assert.Equal(float32(0), link.TargetTQ)
|
||||||
break
|
break
|
||||||
|
|
||||||
case "node:a:mac:wifi":
|
case "node:a:mac:wifi":
|
||||||
|
|
Loading…
Reference in New Issue