From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../tmp/src/common/grouping/shelf-batching.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 node_modules/@jet-app/app-store/tmp/src/common/grouping/shelf-batching.js (limited to 'node_modules/@jet-app/app-store/tmp/src/common/grouping/shelf-batching.js') diff --git a/node_modules/@jet-app/app-store/tmp/src/common/grouping/shelf-batching.js b/node_modules/@jet-app/app-store/tmp/src/common/grouping/shelf-batching.js new file mode 100644 index 0000000..3746b11 --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/common/grouping/shelf-batching.js @@ -0,0 +1,27 @@ +import { isSome } from "@jet/environment"; +import * as models from "../../api/models"; +/// The number of shelves allowed in a single shelf batch. +const shelfBatchGroupMaxCount = 5; +/** + * For a given generic page group the shelves in this page into batch groups + * allowing us to separate our calls for incomplete shelves into groups based on where + * the shelves are on the page. This will not muck with any pre-existing shelfBatchGroups + * + * @param page: The GenericPage to add shelf batches to. + */ +export function addBatchGroupsToPage(page) { + let currentShelfBatchGroup = 0; + let currentShelfBatchGroupCount = 0; + for (const shelf of page.shelves) { + if (isSome(shelf.batchGroup) && shelf.batchGroup.length > 0) { + continue; + } + shelf.batchGroup = `${models.genericShelfBatchGroupBase}${currentShelfBatchGroup}`; + currentShelfBatchGroupCount++; + if (currentShelfBatchGroupCount === shelfBatchGroupMaxCount) { + currentShelfBatchGroupCount = 0; + currentShelfBatchGroup++; + } + } +} +//# sourceMappingURL=shelf-batching.js.map \ No newline at end of file -- cgit v1.2.3