|
@@ -158,13 +158,20 @@ func Group(c *gin.Context) {
|
|
|
dtoNodes = append(dtoNodes, convert2DtoNode(node, countryLabelSeqs[node.CountryCode]))
|
|
|
}
|
|
|
|
|
|
- continents := make(map[string]bool)
|
|
|
+ continentMaps := make(map[string]bool)
|
|
|
for _, node := range dtoNodes {
|
|
|
- continents[node.Continent] = true
|
|
|
+ continentMaps[node.Continent] = true
|
|
|
}
|
|
|
+ continents := make([]string, 0)
|
|
|
+ for continent := range continentMaps {
|
|
|
+ continents = append(continents, continent)
|
|
|
+ }
|
|
|
+ sort.SliceStable(continents, func(i, j int) bool {
|
|
|
+ return continents[i] > continents[j]
|
|
|
+ })
|
|
|
|
|
|
groupDtos := make([]*dto.Group, 0)
|
|
|
- for continent := range continents {
|
|
|
+ for _, continent := range continents {
|
|
|
groupDto := &dto.Group{
|
|
|
Continent: continent,
|
|
|
Nodes: make([]*dto.Node, 0),
|