[BUGFIX] fix typo

This commit is contained in:
Julian 2017-11-23 13:01:39 +01:00 committed by Geno
parent 395fb46fde
commit fd9a1e1101
7 changed files with 16 additions and 16 deletions

View File

@ -48,9 +48,9 @@ type System struct {
// Location struct
type Location struct {
Longtitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Altitude float64 `json:"altitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Altitude float64 `json:"altitude,omitempty"`
}
// Software struct

View File

@ -31,7 +31,7 @@ func (f filterConfig) InArea() filterFunc {
if location == nil {
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
}
}

View File

@ -21,7 +21,7 @@ func TestFilterInArea(t *testing.T) {
filterLocationInArea := config.InArea()
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)
@ -44,22 +44,22 @@ func TestFilterInArea(t *testing.T) {
// in area
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)
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)
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)
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)
}

View File

@ -57,8 +57,8 @@ type Autoupdater struct {
// Location struct
type Location struct {
Longtitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
}
// Link
@ -91,7 +91,7 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node {
}
if location := nodeinfo.Location; location != nil {
node.Location = &Location{
Longtitude: location.Longtitude,
Longitude: location.Longitude,
Latitude: location.Latitude,
}
}

View File

@ -20,7 +20,7 @@ func TestRegister(t *testing.T) {
Mac: "blub",
},
Location: &data.Location{
Longtitude: 13.3,
Longitude: 13.3,
Latitude: 8.7,
},
},
@ -48,7 +48,7 @@ func TestRegister(t *testing.T) {
assert.NotNil(node)
assert.Equal("whoami", node.Owner)
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(0.74, *node.MemoryUsage)
}

View File

@ -35,7 +35,7 @@ func NewNode(n *runtime.Node) (node *Node) {
Name: nodeinfo.Hostname,
}
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

View File

@ -48,7 +48,7 @@ func createTestNodes() *runtime.Nodes {
},
Location: &data.Location{
Latitude: 23,
Longtitude: 2,
Longitude: 2,
},
},
})