This commit is contained in:
pakintada@gmail.com 2023-11-30 09:16:50 +07:00
commit ce28a757b1
17 changed files with 938 additions and 514 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])