Maximofn commited on
Commit
349ff65
·
1 Parent(s): 8bcea95

feat(SRC): :rocket: Fix bugs searchig matches

Browse files

pass to lower strings, change vocals with accents to without accents

Files changed (3) hide show
  1. app.py +1 -1
  2. find_matches.py +2 -2
  3. queries.py +7 -0
app.py CHANGED
@@ -79,7 +79,7 @@ def calcular_macros(esfuerzo_dieta, objetivo, cumplimiento_entrenamiento,
79
  print()
80
 
81
  # Crear diccionario de matches
82
- matches_dict = find_user_dates_matches(query)
83
 
84
  # Print matches
85
  print(f"Matches ({len(matches_dict)}):")
 
79
  print()
80
 
81
  # Crear diccionario de matches
82
+ matches_dict = find_user_dates_matches(query, debug=False)
83
 
84
  # Print matches
85
  print(f"Matches ({len(matches_dict)}):")
find_matches.py CHANGED
@@ -59,8 +59,8 @@ def find_user_dates_matches(query, debug=False):
59
  with open(file, 'r') as f:
60
  data = json.load(f)
61
 
62
- if file.name == '_albertino_06@hotmail.com.json':
63
- dates = query_formularios(data, query, debug=False, file_name=file.name)
64
  else:
65
  dates = query_formularios(data, query, debug=debug)
66
  if len(dates) > 0:
 
59
  with open(file, 'r') as f:
60
  data = json.load(f)
61
 
62
+ if file.name == 'xxx@gmail.com.json':
63
+ dates = query_formularios(data, query, debug=True, file_name=file.name)
64
  else:
65
  dates = query_formularios(data, query, debug=debug)
66
  if len(dates) > 0:
queries.py CHANGED
@@ -62,6 +62,13 @@ def query_formularios(data, query_list, debug=False, file_name=None):
62
  if query_key in data_keys:
63
  # Get the data value
64
  data_value = data[date_key][query_key]
 
 
 
 
 
 
 
65
  type_of_data_value = type(data_value)
66
  is_data_value_string = type_of_data_value == str
67
  is_data_value_number = type_of_data_value == int or type_of_data_value == float
 
62
  if query_key in data_keys:
63
  # Get the data value
64
  data_value = data[date_key][query_key]
65
+ if isinstance(data_value, str):
66
+ data_value = data_value.lower()
67
+ data_value = data_value.replace('á', 'a')
68
+ data_value = data_value.replace('é', 'e')
69
+ data_value = data_value.replace('í', 'i')
70
+ data_value = data_value.replace('ó', 'o')
71
+ data_value = data_value.replace('ú', 'u')
72
  type_of_data_value = type(data_value)
73
  is_data_value_string = type_of_data_value == str
74
  is_data_value_number = type_of_data_value == int or type_of_data_value == float