mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
chore: implemented feedback
This commit is contained in:
@ -37,9 +37,9 @@ type TCardData = {
|
|||||||
| 'NOT_SIGNED'
|
| 'NOT_SIGNED'
|
||||||
| 'SENT'
|
| 'SENT'
|
||||||
| 'NOT_SENT';
|
| 'NOT_SENT';
|
||||||
}[];
|
};
|
||||||
|
|
||||||
const CARD_DATA: TCardData = [
|
const CARD_DATA: TCardData[] = [
|
||||||
{
|
{
|
||||||
icon: UserSquare2,
|
icon: UserSquare2,
|
||||||
title: 'Total recipients in the database',
|
title: 'Total recipients in the database',
|
||||||
|
|||||||
@ -7,14 +7,21 @@ export const getRecipientsStats = async () => {
|
|||||||
_count: true,
|
_count: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
const stats = {
|
||||||
TOTAL_RECIPIENTS: results.length,
|
TOTAL_RECIPIENTS: 0,
|
||||||
[ReadStatus.OPENED]: results.filter((r) => r.readStatus === 'OPENED')?.[0]?._count ?? 0,
|
[ReadStatus.OPENED]: 0,
|
||||||
[ReadStatus.NOT_OPENED]: results.filter((r) => r.readStatus === 'NOT_OPENED')?.[0]?._count ?? 0,
|
[ReadStatus.NOT_OPENED]: 0,
|
||||||
[SigningStatus.SIGNED]: results.filter((r) => r.signingStatus === 'SIGNED')?.[0]?._count ?? 0,
|
[SigningStatus.SIGNED]: 0,
|
||||||
[SigningStatus.NOT_SIGNED]:
|
[SigningStatus.NOT_SIGNED]: 0,
|
||||||
results.filter((r) => r.signingStatus === 'NOT_SIGNED')?.[0]?._count ?? 0,
|
[SendStatus.SENT]: 0,
|
||||||
[SendStatus.SENT]: results.filter((r) => r.sendStatus === 'SENT')?.[0]?._count ?? 0,
|
[SendStatus.NOT_SENT]: 0,
|
||||||
[SendStatus.NOT_SENT]: results.filter((r) => r.sendStatus === 'NOT_SENT')?.[0]?._count ?? 0,
|
|
||||||
};
|
};
|
||||||
|
results.forEach((result) => {
|
||||||
|
const { readStatus, signingStatus, sendStatus, _count } = result;
|
||||||
|
stats[readStatus] += _count;
|
||||||
|
stats[signingStatus] += _count;
|
||||||
|
stats[sendStatus] += _count;
|
||||||
|
stats.TOTAL_RECIPIENTS += _count;
|
||||||
|
});
|
||||||
|
return stats;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user