add apelido
This commit is contained in:
@@ -15,11 +15,21 @@ namespace OpenCand.Repository
|
||||
using (var connection = new NpgsqlConnection(ConnectionString))
|
||||
{
|
||||
return (await connection.QueryAsync<Candidato>(@"
|
||||
SELECT idcandidato, cpf, nome, datanascimento, email, sexo, estadocivil, escolaridade, ocupacao
|
||||
SELECT *
|
||||
CASE
|
||||
WHEN lower(nome) = lower(@query) THEN 0 -- Exact match (case-insensitive)
|
||||
WHEN lower(nome) LIKE lower(@query) || '%' THEN 1 -- Starts with match (case-insensitive)
|
||||
WHEN lower(nome) LIKE '%' || lower(@query) THEN 2 -- Contains anywhere match (case-insensitive)
|
||||
WHEN cpf = @query THEN 0 -- Exact match for CPF
|
||||
WHEN cpf LIKE @query || '%' THEN 1 -- Starts with match for CPF
|
||||
WHEN cpf LIKE '%' || @query THEN 2 -- Contains anywhere match for CPF
|
||||
ELSE 3
|
||||
END AS name_rank
|
||||
FROM candidato
|
||||
WHERE nome ILIKE '%' || @query || '%' OR
|
||||
cpf ILIKE '%' || @query || '%' OR
|
||||
email ILIKE '%' || @query || '%'
|
||||
cpf ILIKE '%' || @query || '%'
|
||||
ORDER BY name_rank,
|
||||
length(nome) ASC
|
||||
LIMIT 10;",
|
||||
new { query })).AsList();
|
||||
}
|
||||
|
33
OpenCand.API/jpg-normalize.sh
Normal file
33
OpenCand.API/jpg-normalize.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
cd ./fotos_cand
|
||||
COUNT=0
|
||||
shopt -s nocaseglob
|
||||
|
||||
# Loop through all folders
|
||||
for dir in */; do
|
||||
# Change into the directory
|
||||
cd "$dir" || continue
|
||||
|
||||
# Loop over every “.jpeg” (or “.JPEG”):
|
||||
for f in *.jpeg; do
|
||||
# “${f%.[jJ][pP][eE][gG]}” strips off the .jpeg/.JPEG suffix
|
||||
base="${f%.[jJ][pP][eE][gG]}"
|
||||
newfile="${base}.jpg"
|
||||
|
||||
# If there’s already a .jpg with the same “base,” decide what to do:
|
||||
if [ -e "$newfile" ]; then
|
||||
echo "Skipping $f → $newfile (target exists)"
|
||||
# you could `rm "$f"` or move it to a backup folder here if you prefer
|
||||
else
|
||||
mv -v "$f" "$newfile"
|
||||
fi
|
||||
done
|
||||
|
||||
# Change back to the parent directory
|
||||
cd ..
|
||||
done
|
||||
|
||||
shopt -u nocaseglob
|
||||
|
||||
# Print a message indicating completion
|
||||
echo "Normalization complete. Processed $COUNT files."
|
Reference in New Issue
Block a user