fix: stats now group by status
This commit is contained in:
parent
5fa6e4d2f9
commit
4d2dadbc05
1 changed files with 2 additions and 2 deletions
|
|
@ -170,14 +170,14 @@ export class QuotationController extends Controller {
|
|||
async getProductStats(@Request() req: RequestWithUser) {
|
||||
const result = await prisma.quotation.groupBy({
|
||||
_count: true,
|
||||
by: "payCondition",
|
||||
by: "quotationStatus",
|
||||
where: {
|
||||
registeredBranch: isSystem(req.user) ? undefined : { OR: permissionCond(req.user) },
|
||||
},
|
||||
});
|
||||
|
||||
return result.reduce<Record<string, number>>((a, c) => {
|
||||
a[c.payCondition.charAt(0).toLowerCase() + c.payCondition.slice(1)] = c._count;
|
||||
a[c.quotationStatus.charAt(0).toLowerCase() + c.quotationStatus.slice(1)] = c._count;
|
||||
return a;
|
||||
}, {});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue