Reapply "Fix RFV period classification"
This reverts commit 28af45c315.
This commit is contained in:
@@ -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(`
|
||||
|
||||
Reference in New Issue
Block a user