fix(CurrentRecipePointer): 🐛 Fix cache recipe
Remove continue last opened version
This commit is contained in:
parent
4219c1cb43
commit
2b8745679f
16 changed files with 481 additions and 174 deletions
|
|
@ -874,7 +874,7 @@ func (d *Data) SetValuesToToppingGroupList(base_topping_group_list []models.Topp
|
|||
}
|
||||
|
||||
func (d *Data) GetMaterialSetting(countryID, filename string) []models.MaterialSetting {
|
||||
result := make([]models.MaterialSetting, 0)
|
||||
// result := make([]models.MaterialSetting, 0)
|
||||
|
||||
if countryID == "" {
|
||||
// copy(result, d.currentRecipe[countryID].MaterialSetting)
|
||||
|
|
@ -888,12 +888,12 @@ func (d *Data) GetMaterialSetting(countryID, filename string) []models.MaterialS
|
|||
return d.CurrentRecipe[countryID].MaterialSetting
|
||||
}
|
||||
|
||||
if recipe, ok := d.recipeMap[filename]; ok {
|
||||
copy(result, recipe.Recipe[countryID].MaterialSetting)
|
||||
d.CurrentFile[countryID] = filename
|
||||
// d.CurrentCountryID[countryID] = countryID
|
||||
return d.CurrentRecipe[countryID].MaterialSetting
|
||||
}
|
||||
// if recipe, ok := d.recipeMap[filename]; ok {
|
||||
// copy(result, recipe.Recipe[countryID].MaterialSetting)
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// // d.CurrentCountryID[countryID] = countryID
|
||||
// return d.CurrentRecipe[countryID].MaterialSetting
|
||||
// }
|
||||
}
|
||||
|
||||
if filename == "default" {
|
||||
|
|
@ -952,11 +952,11 @@ func (d *Data) GetAllToppingGroups(countryID, filename string) []models.ToppingG
|
|||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingGroup
|
||||
}
|
||||
if _, ok := d.recipeMap[countryID]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
// if _, ok := d.recipeMap[countryID]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingGroup
|
||||
}
|
||||
// return d.CurrentRecipe[countryID].Topping.ToppingGroup
|
||||
// }
|
||||
}
|
||||
|
||||
if filename == "default" {
|
||||
|
|
@ -1002,10 +1002,10 @@ func (d *Data) GetToppingsList(countryID, filename string) []models.ToppingList
|
|||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingList
|
||||
}
|
||||
if _, ok := d.recipeMap[countryID]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingList
|
||||
}
|
||||
// if _, ok := d.recipeMap[countryID]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// return d.CurrentRecipe[countryID].Topping.ToppingList
|
||||
// }
|
||||
}
|
||||
|
||||
if filename == "default" {
|
||||
|
|
@ -1040,10 +1040,12 @@ func (d *Data) GetMaterialCode(ids []uint64, countryID, filename string) []model
|
|||
|
||||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
result = d.CurrentRecipe[countryID].MaterialCode
|
||||
} else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
return recipe.Recipe[countryID].MaterialCode
|
||||
} else {
|
||||
// else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// return recipe.Recipe[countryID].MaterialCode
|
||||
// }
|
||||
// else {
|
||||
|
||||
if filename == "default" {
|
||||
filename = d.CurrentFile[countryID]
|
||||
|
|
@ -1111,10 +1113,11 @@ func (d *Data) GetToppings(countryID, filename string) models.Topping {
|
|||
|
||||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
return d.CurrentRecipe[countryID].Topping
|
||||
} else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
return recipe.Recipe[countryID].Topping
|
||||
}
|
||||
// else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// return recipe.Recipe[countryID].Topping
|
||||
// }
|
||||
|
||||
// if filename == "default" {
|
||||
// filename = d.CurrentFile[countryID]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue