Fix RFV period classification
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 48s

This commit is contained in:
Cauê Faleiros
2026-06-17 10:20:12 -03:00
parent ce72231560
commit 1889c172d0
2 changed files with 7 additions and 9 deletions

View File

@@ -262,11 +262,9 @@ const getClientAnalytics = async (range = {}) => {
const getRfmAnalytics = async (range = {}) => {
const { params, whereClause } = buildDateFilter(range);
const normalizedStart = normalizeDateParam(range.start);
const normalizedEnd = normalizeDateParam(range.end);
const tagReference = getPreviousDate(normalizedStart) || normalizedEnd;
const recencyReferenceDate = tagReference ? '$1::date' : 'CURRENT_DATE';
const historyParams = tagReference ? [tagReference] : [];
const recencyReferenceDate = normalizedEnd ? '$1::date' : 'CURRENT_DATE';
const historyParams = normalizedEnd ? [normalizedEnd] : [];
const [periodResult, historyResult] = await Promise.all([
pool.query(`