saving changes

This commit is contained in:
2021-10-09 17:34:15 +04:00
parent a06e1be2bc
commit 56be275759
4 changed files with 78 additions and 2 deletions

View File

@@ -278,5 +278,32 @@ func (grp *Groups)RemoveContainerGroups(Container *TrackContainer) error {
// Set group information to list groups
grp.GroupList[i] = group
}
return nil
}
func (TC *TrackContainer)ModifyContainerGroups() error {
group, err := ReadGroup()
if err != nil {
return err
}
// Iterate though all groups and modify the container
// information in groups where the modified container
// ID matches
for i, _ := range group.GroupList {
// Checking in each group if the modified container ID exists
for j, _:= range group.GroupList[i].TrackContainerList {
// If there is match then change them
if group.GroupList[i].TrackContainerList[j].Id == TC.Id {
group.GroupList[i].TrackContainerList[j] = TC
}
}
}
// Write modified result to the Groups track container JSON file
err = group.WriteGroup()
if err != nil {
return err
}
return nil
}