Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/controllers/relatorios-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ export const obtemDadosDoRelatorioDeLocalDeColeta = async (req, res, next) => {
Sequelize.where(
literal(`
make_date(
(data_coleta_ano)::int,
COALESCE(NULLIF(data_coleta_ano, 0), 1)::int,
COALESCE(NULLIF(data_coleta_mes, 0), 1)::int,
COALESCE(NULLIF(data_coleta_dia, 0), 1)::int
)
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/formata-dados-relatorio.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export function agruparPorLocal(dados) {
const genero = (a?.genero?.nome || '').localeCompare(b?.genero?.nome || '');
if (genero !== 0) return genero;

return (a?.especy?.nome || '').localeCompare(b?.especy?.nome || '');
return (a?.especie?.nome || '').localeCompare(b?.especie?.nome || '');
}).forEach(entradaOriginal => {
const locaisColetum = entradaOriginal.locais_coletum;
const cidade = locaisColetum?.cidade;
Expand All @@ -268,7 +268,7 @@ export function agruparPorLocal(dados) {
latitude: entradaOriginal?.latitude || null,
longitude: entradaOriginal?.longitude || null,
variedade: entradaOriginal.variedade || null,
sub_especie: entradaOriginal.sub_especy || null,
sub_especie: entradaOriginal.sub_especie || null,
};

if (!agrupado[chave]) {
Expand Down Expand Up @@ -321,7 +321,7 @@ export function adicionarResumoTaxonomicoPorLocal(locaisAgrupados) {
}

// espécie
const especieId = reg.especie_id ?? reg.especy?.id;
const especieId = reg.especie_id ?? reg.especie?.id;
if (especieId != null) {
especies.add(especieId);
}
Expand Down
Loading