update recipe detail

This commit is contained in:
Kenta420 2023-11-27 19:58:07 +07:00
parent d52cad09fd
commit 9279ef0247
11 changed files with 58 additions and 123 deletions

View file

@ -32,10 +32,6 @@ func ReadFile(filePath string) (string, error) {
func ReadRecipeFile(countryID, filePath string) (*models.Recipe, error) {
if countryID == "thai" {
countryID = ""
}
file, err := os.Open(path.Join("cofffeemachineConfig", countryID, filePath))
if err != nil {
@ -69,12 +65,7 @@ func ScanRecipeFiles(countries []CountryName) map[string][]RecipePath {
recipeFiles := map[string][]RecipePath{}
for _, country := range countries {
var files []string
if country.CountryID == "thai" {
files = ListFile("cofffeemachineConfig/coffeethai02_*.json")
} else {
files = ListFile("cofffeemachineConfig/" + country.CountryID + "/coffeethai02_*.json")
}
files := ListFile("cofffeemachineConfig/" + country.CountryID + "/coffeethai02_*.json")
sort.Slice(files, func(i, j int) bool {
file1, err := os.Stat(files[i])