Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 78x 5x 5x 5x 5x | import type { TFunction } from "i18next";
import type { ReceiptId, ReceiptItemId } from "~db/ids";
export const getConsumersItems = (
t: TFunction,
itemIds: ReceiptItemId[],
receiptIds: ReceiptId[],
) => {
const payersAmount = itemIds.filter(
(itemId, index) => itemId === receiptIds[index],
).length;
const consumersAmount = itemIds.length - payersAmount;
return [
consumersAmount
? t("toasts.consumersGenitive", {
ns: "receipts",
count: consumersAmount,
})
: undefined,
payersAmount
? t("toasts.payersGenitive", { ns: "receipts", count: payersAmount })
: undefined,
].filter(Boolean);
};
|