update ItemCount if EmailItem allows multiples
All checks were successful
Build / build (18) (push) Successful in 56s
Build / build (20) (push) Successful in 57s
Build / build (22) (push) Successful in 39s
Build / build (22) (pull_request) Successful in 37s
Build / build (20) (pull_request) Successful in 56s
Build / build (18) (pull_request) Successful in 1m0s
All checks were successful
Build / build (18) (push) Successful in 56s
Build / build (20) (push) Successful in 57s
Build / build (22) (push) Successful in 39s
Build / build (22) (pull_request) Successful in 37s
Build / build (20) (pull_request) Successful in 56s
Build / build (18) (pull_request) Successful in 1m0s
This commit is contained in:
parent
26ad8fceff
commit
514e306394
@ -946,11 +946,16 @@ export const addEmailItem = async (
|
|||||||
typeName: string,
|
typeName: string,
|
||||||
inventoryChanges: IInventoryChanges = {}
|
inventoryChanges: IInventoryChanges = {}
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
const emailItem = ExportEmailItems[typeName];
|
const meta = ExportEmailItems[typeName];
|
||||||
if (!emailItem.sendOnlyOnce || !inventory.EmailItems.find(x => x.ItemType == typeName)) {
|
const emailItem = inventory.EmailItems.find(x => x.ItemType == typeName);
|
||||||
await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(emailItem.message)]);
|
if (!emailItem || !meta.sendOnlyOnce) {
|
||||||
|
await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(meta.message)]);
|
||||||
|
|
||||||
|
if (emailItem) {
|
||||||
|
emailItem.ItemCount += 1;
|
||||||
|
} else {
|
||||||
inventory.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
|
inventory.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
|
||||||
|
}
|
||||||
|
|
||||||
inventoryChanges.EmailItems ??= [];
|
inventoryChanges.EmailItems ??= [];
|
||||||
inventoryChanges.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
|
inventoryChanges.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user