Busqueda con estilo
This commit is contained in:
parent
e8483662e1
commit
8509a15f68
@ -12,7 +12,7 @@ DBURL = "postgres://#{USER}:#{PASS}@#{DBHOST}:5432/nombres"
|
|||||||
puts "Connnecting to #{DBURL}"
|
puts "Connnecting to #{DBURL}"
|
||||||
|
|
||||||
# Create a connection pool to the database
|
# Create a connection pool to the database
|
||||||
pg = ConnectionPool.new(capacity: 5, timeout: 0.01.seconds) do
|
pg = ConnectionPool.new(capacity: 5, timeout: 0.2.seconds) do
|
||||||
PG.connect(DBURL)
|
PG.connect(DBURL)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -29,8 +29,6 @@ post "/" do |env|
|
|||||||
genero = env.params.json["g"].as(String)
|
genero = env.params.json["g"].as(String)
|
||||||
year = env.params.json["a"].as(String)
|
year = env.params.json["a"].as(String)
|
||||||
|
|
||||||
p! prefijo, genero, year
|
|
||||||
|
|
||||||
prefijo = normalize(prefijo)
|
prefijo = normalize(prefijo)
|
||||||
if !["f", "m"].includes?(genero)
|
if !["f", "m"].includes?(genero)
|
||||||
genero = nil
|
genero = nil
|
||||||
@ -132,10 +130,10 @@ post "/" do |env|
|
|||||||
[row[0].capitalize, row[1]]
|
[row[0].capitalize, row[1]]
|
||||||
}
|
}
|
||||||
|
|
||||||
if datos.size > 1
|
if datos.size > 2
|
||||||
title = "¿Puede ser ... #{datos[0][1].to_s.titleize}? ¿O capaz que #{datos[1][1].to_s.titleize}? ¡Contame más!"
|
title = "¿Puede ser ... #{datos[1][0].to_s.titleize}? ¿O capaz que #{datos[2][0].to_s.titleize}? ¡Contame más!"
|
||||||
elsif datos.size == 1
|
elsif datos.size == 2
|
||||||
title = "Me parece que ... #{datos[0][1].to_s.titleize}!"
|
title = "Me parece que ... #{datos[1][0].to_s.titleize}!"
|
||||||
else
|
else
|
||||||
title = "No tengo idea!"
|
title = "No tengo idea!"
|
||||||
end
|
end
|
||||||
|
@ -52,33 +52,36 @@
|
|||||||
data = json["data"];
|
data = json["data"];
|
||||||
console.log(data);
|
console.log(data);
|
||||||
data = google.visualization.arrayToDataTable(data);
|
data = google.visualization.arrayToDataTable(data);
|
||||||
// var options = {
|
var options = {
|
||||||
// title: "",
|
title: title,
|
||||||
// animation: {
|
titleTextStyle: {
|
||||||
// startup: true,
|
color: "#aaa",
|
||||||
// duration: 1000,
|
},
|
||||||
// easing: "out",
|
animation: {
|
||||||
// },
|
startup: true,
|
||||||
// backgroundColor: "#1c212c",
|
duration: 1000,
|
||||||
// vAxis: {
|
easing: "out",
|
||||||
// minValue: 0,
|
},
|
||||||
// gridlines: { color: "#666" },
|
backgroundColor: "#1c212c",
|
||||||
// minorGridlines: { color: "#1c212c" },
|
vAxis: {
|
||||||
// textStyle: { color: "#aaa" },
|
minValue: 0,
|
||||||
// },
|
gridlines: { color: "#666" },
|
||||||
// hAxis: {
|
minorGridlines: { color: "#1c212c" },
|
||||||
// gridlines: { color: "#666" },
|
textStyle: { color: "#aaa" }
|
||||||
// minorGridlines: { color: "#1c212c" },
|
},
|
||||||
// textStyle: { color: "#aaa" },
|
hAxis: {
|
||||||
// },
|
gridlines: { color: "#666" },
|
||||||
// legend: { position: "bottom", textStyle: { color: "#aaa" } },
|
minorGridlines: { color: "#1c212c" },
|
||||||
// };
|
textStyle: { color: "#aaa" }
|
||||||
|
},
|
||||||
|
legend: { position: 'none'},
|
||||||
|
};
|
||||||
|
|
||||||
var chart = new google.visualization.BarChart(
|
var chart = new google.visualization.BarChart(
|
||||||
document.getElementById("chart")
|
document.getElementById("chart")
|
||||||
);
|
);
|
||||||
|
|
||||||
chart.draw(data);
|
chart.draw(data, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -12,7 +12,7 @@ DBURL = "postgres://#{USER}:#{PASS}@#{DBHOST}:5432/nombres"
|
|||||||
puts "Connnecting to #{DBURL}"
|
puts "Connnecting to #{DBURL}"
|
||||||
|
|
||||||
# Create a connection pool to the database
|
# Create a connection pool to the database
|
||||||
pg = ConnectionPool.new(capacity: 5, timeout: 0.01.seconds) do
|
pg = ConnectionPool.new(capacity: 5, timeout: 0.2.seconds) do
|
||||||
PG.connect(DBURL)
|
PG.connect(DBURL)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user