Fix: Handle NULL categories in category summary
Modified `src/services/transacao/summaryService.ts` to categorize transactions with NULL categories as "Despesas Sem Categoria" in the category summary.
This commit is contained in:
parent
ea97f94a54
commit
099af14499
@ -237,8 +237,8 @@ export async function getCategorySummary(tipo: string = 'despesa', monthFilter?:
|
|||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
data.forEach((transaction) => {
|
data.forEach((transaction) => {
|
||||||
// Tratar categorias vazias, nulas ou indefinidas
|
// Tratar categorias vazias, nulas ou indefinidas de forma mais específica
|
||||||
let categoria = 'Outros';
|
let categoria = 'Despesas Sem Categoria';
|
||||||
|
|
||||||
if (transaction.categoria && typeof transaction.categoria === 'string') {
|
if (transaction.categoria && typeof transaction.categoria === 'string') {
|
||||||
const cleanCategory = transaction.categoria.trim();
|
const cleanCategory = transaction.categoria.trim();
|
||||||
@ -258,6 +258,7 @@ export async function getCategorySummary(tipo: string = 'despesa', monthFilter?:
|
|||||||
|
|
||||||
console.log(`📋 [getCategorySummary] Categorias encontradas:`, Object.keys(categoryMap));
|
console.log(`📋 [getCategorySummary] Categorias encontradas:`, Object.keys(categoryMap));
|
||||||
console.log(`📋 [getCategorySummary] Total calculado: ${total}`);
|
console.log(`📋 [getCategorySummary] Total calculado: ${total}`);
|
||||||
|
console.log(`📋 [getCategorySummary] Despesas sem categoria: ${categoryMap['Despesas Sem Categoria'] || 0}`);
|
||||||
|
|
||||||
// Enhanced color palette with more distinct colors - avoiding white/light colors
|
// Enhanced color palette with more distinct colors - avoiding white/light colors
|
||||||
const colors = [
|
const colors = [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user