Reapply "Fix RFV period classification"

This reverts commit 28af45c315.
This commit is contained in:
Cauê Faleiros
2026-06-17 11:16:27 -03:00
parent 28af45c315
commit bb69e79af6
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(`