category groups
parent
55f38bfeb5
commit
b9b4081514
|
@ -4,7 +4,7 @@
|
|||
"globalInputs": [
|
||||
{
|
||||
"parameterName": "irgendwas",
|
||||
"type": "string",
|
||||
"type": "text",
|
||||
"displayName": "Irgendwas tolles"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Produktionstask 1",
|
||||
"globalInputs": [
|
||||
{
|
||||
"parameterName": "irgendwas",
|
||||
"type": "string",
|
||||
"displayName": "Irgendwas tolles"
|
||||
"parameterName": "kundenname",
|
||||
"type": "text",
|
||||
"displayName": "Name des Kunden"
|
||||
},
|
||||
{
|
||||
"parameterName": "kiste",
|
||||
|
@ -22,7 +22,7 @@
|
|||
"parameter": [
|
||||
{
|
||||
"parameterName": "labelformat",
|
||||
"type": "string",
|
||||
"type": "text",
|
||||
"displayName": "Format des Labels",
|
||||
"global": false
|
||||
},
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"category": "Test",
|
||||
"name": "hello world"
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"category": "Umbach",
|
||||
"name": "Umbach Snack bar"
|
||||
"name": "Umbach Snack bar auffüllen"
|
||||
}
|
|
@ -7,7 +7,29 @@ import (
|
|||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
var Groups []Group
|
||||
var CategoryGroups []CategoryGroup
|
||||
|
||||
type CategoryGroup struct {
|
||||
Category string `json:"category"`
|
||||
Groups []Group `json:"groups"`
|
||||
}
|
||||
|
||||
func addCategoryGroup(group Group) {
|
||||
for index, categoryGroup := range CategoryGroups {
|
||||
if categoryGroup.Category == group.Category {
|
||||
CategoryGroups[index].Groups = append(CategoryGroups[index].Groups, group)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
categoryGroup := CategoryGroup{
|
||||
Category: group.Category,
|
||||
}
|
||||
|
||||
categoryGroup.Groups = append(categoryGroup.Groups, group)
|
||||
|
||||
CategoryGroups = append(CategoryGroups, categoryGroup)
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
Category string `json:"category"`
|
||||
|
@ -70,18 +92,15 @@ func ReadGroups() {
|
|||
return
|
||||
}
|
||||
|
||||
//log.Info().Msgf("File content: %s", string(content))
|
||||
|
||||
var group Group
|
||||
|
||||
json.Unmarshal(content, &group)
|
||||
|
||||
group.Id = entry.Name()
|
||||
|
||||
Groups = append(Groups, group)
|
||||
|
||||
log.Info().Msgf("Group: %s", group)
|
||||
log.Info().Msgf("Number of groups: %d", len(Groups))
|
||||
|
||||
addCategoryGroup(group)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ func (socketClient *SocketClient) writeMessage(messageType int, message SendSock
|
|||
}
|
||||
|
||||
type InitUserSocketConnection struct {
|
||||
User UserData
|
||||
GroupTasks []grouptasks.Group
|
||||
User UserData
|
||||
CategoryGroups []grouptasks.CategoryGroup
|
||||
}
|
||||
|
||||
type UserData struct {
|
||||
|
|
|
@ -50,7 +50,7 @@ func RunHub() {
|
|||
Username: user.Username,
|
||||
Email: user.Email,
|
||||
},
|
||||
GroupTasks: grouptasks.Groups,
|
||||
CategoryGroups: grouptasks.CategoryGroups,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue