[BUGFIX] fix typo
This commit is contained in:
parent
395fb46fde
commit
fd9a1e1101
@ -48,9 +48,9 @@ type System struct {
|
|||||||
|
|
||||||
// Location struct
|
// Location struct
|
||||||
type Location struct {
|
type Location struct {
|
||||||
Longtitude float64 `json:"longitude,omitempty"`
|
Longitude float64 `json:"longitude,omitempty"`
|
||||||
Latitude float64 `json:"latitude,omitempty"`
|
Latitude float64 `json:"latitude,omitempty"`
|
||||||
Altitude float64 `json:"altitude,omitempty"`
|
Altitude float64 `json:"altitude,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Software struct
|
// Software struct
|
||||||
|
@ -31,7 +31,7 @@ func (f filterConfig) InArea() filterFunc {
|
|||||||
if location == nil {
|
if location == nil {
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
if location.Latitude >= a.latitudeMin && location.Latitude <= a.latitudeMax && location.Longtitude >= a.longitudeMin && location.Longtitude <= a.longitudeMax {
|
if location.Latitude >= a.latitudeMin && location.Latitude <= a.latitudeMax && location.Longitude >= a.longitudeMin && location.Longitude <= a.longitudeMax {
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ func TestFilterInArea(t *testing.T) {
|
|||||||
|
|
||||||
filterLocationInArea := config.InArea()
|
filterLocationInArea := config.InArea()
|
||||||
n := filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
n := filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
||||||
Location: &data.Location{Latitude: 4.0, Longtitude: 11.0},
|
Location: &data.Location{Latitude: 4.0, Longitude: 11.0},
|
||||||
}})
|
}})
|
||||||
assert.NotNil(n)
|
assert.NotNil(n)
|
||||||
|
|
||||||
@ -44,22 +44,22 @@ func TestFilterInArea(t *testing.T) {
|
|||||||
|
|
||||||
// in area
|
// in area
|
||||||
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
||||||
Location: &data.Location{Latitude: 4.0, Longtitude: 11.0},
|
Location: &data.Location{Latitude: 4.0, Longitude: 11.0},
|
||||||
}})
|
}})
|
||||||
assert.NotNil(n)
|
assert.NotNil(n)
|
||||||
|
|
||||||
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
||||||
Location: &data.Location{Latitude: 4.0, Longtitude: 13.0},
|
Location: &data.Location{Latitude: 4.0, Longitude: 13.0},
|
||||||
}})
|
}})
|
||||||
assert.Nil(n)
|
assert.Nil(n)
|
||||||
|
|
||||||
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
||||||
Location: &data.Location{Latitude: 6.0, Longtitude: 11.0},
|
Location: &data.Location{Latitude: 6.0, Longitude: 11.0},
|
||||||
}})
|
}})
|
||||||
assert.Nil(n)
|
assert.Nil(n)
|
||||||
|
|
||||||
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
n = filterLocationInArea(&runtime.Node{Nodeinfo: &data.NodeInfo{
|
||||||
Location: &data.Location{Latitude: 1.0, Longtitude: 2.0},
|
Location: &data.Location{Latitude: 1.0, Longitude: 2.0},
|
||||||
}})
|
}})
|
||||||
assert.Nil(n)
|
assert.Nil(n)
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ type Autoupdater struct {
|
|||||||
|
|
||||||
// Location struct
|
// Location struct
|
||||||
type Location struct {
|
type Location struct {
|
||||||
Longtitude float64 `json:"longitude,omitempty"`
|
Longitude float64 `json:"longitude,omitempty"`
|
||||||
Latitude float64 `json:"latitude,omitempty"`
|
Latitude float64 `json:"latitude,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link
|
// Link
|
||||||
@ -91,7 +91,7 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node {
|
|||||||
}
|
}
|
||||||
if location := nodeinfo.Location; location != nil {
|
if location := nodeinfo.Location; location != nil {
|
||||||
node.Location = &Location{
|
node.Location = &Location{
|
||||||
Longtitude: location.Longtitude,
|
Longitude: location.Longitude,
|
||||||
Latitude: location.Latitude,
|
Latitude: location.Latitude,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ func TestRegister(t *testing.T) {
|
|||||||
Mac: "blub",
|
Mac: "blub",
|
||||||
},
|
},
|
||||||
Location: &data.Location{
|
Location: &data.Location{
|
||||||
Longtitude: 13.3,
|
Longitude: 13.3,
|
||||||
Latitude: 8.7,
|
Latitude: 8.7,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -48,7 +48,7 @@ func TestRegister(t *testing.T) {
|
|||||||
assert.NotNil(node)
|
assert.NotNil(node)
|
||||||
assert.Equal("whoami", node.Owner)
|
assert.Equal("whoami", node.Owner)
|
||||||
assert.Equal("blub", node.MAC)
|
assert.Equal("blub", node.MAC)
|
||||||
assert.Equal(13.3, node.Location.Longtitude)
|
assert.Equal(13.3, node.Location.Longitude)
|
||||||
assert.Equal(8.7, node.Location.Latitude)
|
assert.Equal(8.7, node.Location.Latitude)
|
||||||
assert.Equal(0.74, *node.MemoryUsage)
|
assert.Equal(0.74, *node.MemoryUsage)
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ func NewNode(n *runtime.Node) (node *Node) {
|
|||||||
Name: nodeinfo.Hostname,
|
Name: nodeinfo.Hostname,
|
||||||
}
|
}
|
||||||
if location := nodeinfo.Location; location != nil {
|
if location := nodeinfo.Location; location != nil {
|
||||||
node.Position = &Position{Lat: location.Latitude, Long: location.Longtitude}
|
node.Position = &Position{Lat: location.Latitude, Long: location.Longitude}
|
||||||
}
|
}
|
||||||
|
|
||||||
node.Status.Online = n.Online
|
node.Status.Online = n.Online
|
||||||
|
@ -48,7 +48,7 @@ func createTestNodes() *runtime.Nodes {
|
|||||||
},
|
},
|
||||||
Location: &data.Location{
|
Location: &data.Location{
|
||||||
Latitude: 23,
|
Latitude: 23,
|
||||||
Longtitude: 2,
|
Longitude: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user