Wire prior archive cutoff through API
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -29,7 +29,6 @@ import { decimalToBase, loadOrgRates, toBaseAmount } from '../common/currency';
|
||||
import {
|
||||
activityPriorWhere,
|
||||
dealPriorWhere,
|
||||
personPriorWhere,
|
||||
} from '../common/prior-archive';
|
||||
import {
|
||||
addJalaliMonths,
|
||||
@@ -62,9 +61,8 @@ export class ReportsService {
|
||||
const prevStart = new Date(prevEnd.getTime() - durationMs);
|
||||
|
||||
const now = new Date();
|
||||
const peoplePrior = personPriorWhere(actor.priorLens);
|
||||
const dealsPrior = dealPriorWhere(actor.priorLens, now);
|
||||
const activitiesPrior = activityPriorWhere(actor.priorLens, now, actor.priorCutoff);
|
||||
const dealsPrior = dealPriorWhere(actor.priorLens, actor.priorCutoff);
|
||||
const activitiesPrior = activityPriorWhere(actor.priorLens, actor.priorCutoff);
|
||||
const { jy, jm } = dateToJalali(now);
|
||||
const sixAgo = addJalaliMonths(jy, jm, -5);
|
||||
const sixMonthStart = startOfJalaliMonth(sixAgo.jy, sixAgo.jm);
|
||||
@@ -160,7 +158,6 @@ export class ReportsService {
|
||||
where: {
|
||||
organizationId: orgId,
|
||||
...personScope,
|
||||
...peoplePrior,
|
||||
},
|
||||
select: { mood: true, createdAt: true },
|
||||
}),
|
||||
@@ -1551,9 +1548,8 @@ export class ReportsService {
|
||||
const yesterdayEnd = endOfDay(yesterday);
|
||||
const weekAgo = new Date(now);
|
||||
weekAgo.setDate(weekAgo.getDate() - 7);
|
||||
const peoplePrior = personPriorWhere(actor.priorLens);
|
||||
const dealsPrior = dealPriorWhere(actor.priorLens, now);
|
||||
const activitiesPrior = activityPriorWhere(actor.priorLens, now, actor.priorCutoff);
|
||||
const dealsPrior = dealPriorWhere(actor.priorLens, actor.priorCutoff);
|
||||
const activitiesPrior = activityPriorWhere(actor.priorLens, actor.priorCutoff);
|
||||
|
||||
const [
|
||||
wonDeals,
|
||||
@@ -1618,7 +1614,6 @@ export class ReportsService {
|
||||
where: {
|
||||
organizationId: orgId,
|
||||
...personScope,
|
||||
...peoplePrior,
|
||||
createdAt: { gte: curMonthStart, lte: curMonthEnd },
|
||||
},
|
||||
}),
|
||||
@@ -1626,7 +1621,6 @@ export class ReportsService {
|
||||
where: {
|
||||
organizationId: orgId,
|
||||
...personScope,
|
||||
...peoplePrior,
|
||||
createdAt: { gte: prevMonthStart, lte: prevMonthEnd },
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user