diff --git a/c-busqueda/handler.cr b/c-busqueda/handler.cr index e7ce999..3597728 100644 --- a/c-busqueda/handler.cr +++ b/c-busqueda/handler.cr @@ -177,7 +177,6 @@ class Handler DB.open(DB_URL) do |cursor| cursor.query sql do |result_set| result_set.each do - puts "loop" valor = result_set.read(Int32) nombre = result_set.read(String) datos.push({valor, nombre}) @@ -203,8 +202,7 @@ class Handler if genero DB.open(DB_URL) do |cursor| - filtered = Array(Tuple(Int32, String)).new - datos.map { |item| + datos = datos.find do |item| # How feminine is this name? # Yes this database is upper case nombre = item[1].upcase @@ -223,13 +221,13 @@ class Handler end end # El overlap en 0.5 es intencional! - if feminidad >= 0.5 && genero == "f" - filtered << item - elsif feminidad <= 0.5 && genero == "m" - filtered << item + if (feminidad >= 0.5 && genero == "f") || + (feminidad <= 0.5 && genero == "m") + true + else + false end - } - datos = filtered + end puts "Data split by gender" end end