Fixing stuff
This commit is contained in:
parent
6d7a571a55
commit
6ed644d1d0
@ -84,11 +84,12 @@ class Handler
|
||||
FROM hombres WHERE nombre='#{nombre}'
|
||||
)
|
||||
|
||||
hombres = mujeres = 0
|
||||
DB.open("postgres://#{USER}:#{PASS}@10.61.0.1:5432/nombres") do |cursor|
|
||||
cursor.query sql1 do |result|
|
||||
mujeres = result.read(Int32)
|
||||
end
|
||||
cursor.query sql2 do |_|
|
||||
cursor.query sql2 do |result|
|
||||
hombres = result.read(Int32)
|
||||
end
|
||||
end
|
||||
@ -99,8 +100,8 @@ class Handler
|
||||
end
|
||||
|
||||
def split_por_genero(nombres)
|
||||
femeninos = Array(Array(String | Int32)).new
|
||||
masculinos = Array(Array(String | Int32)).new
|
||||
femeninos = Array(Tuple(Int32, String)).new
|
||||
masculinos = Array(Tuple(Int32, String)).new
|
||||
nombres.map { |nombre|
|
||||
fem = feminidad(nombre[1])
|
||||
# El overlap en 0.5 es intencional!
|
||||
@ -193,9 +194,9 @@ class Handler
|
||||
)
|
||||
end
|
||||
|
||||
datos = [] of Tuple(Int32, String)
|
||||
DB.open("postgres://#{USER}:#{PASS}@10.61.0.1:5432/nombres") do |cursor|
|
||||
cursor.query sql do |result_set|
|
||||
datos = [] of Tuple(Int32, String)
|
||||
result_set.each do
|
||||
valor = result_set.read(Int32)
|
||||
nombre = result_set.read(String)
|
||||
@ -204,7 +205,6 @@ class Handler
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if datos.empty?
|
||||
# This is bad 😀
|
||||
return {
|
||||
|
@ -67,8 +67,8 @@ class Handler
|
||||
def normalize_name(s)
|
||||
# Remove diacritics, turn lowercase
|
||||
normalized = s.unicode_normalize(:nfkd).chars
|
||||
normalized.reject! { |_|
|
||||
!ccharacter.ascii_letter?
|
||||
normalized.reject! { |character|
|
||||
!character.ascii_letter?
|
||||
}.join("").downcase
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user