Skip to content

Bulk operations - #25

Open
pstalcup wants to merge 5 commits into
mainfrom
bulk
Open

Bulk operations #25
pstalcup wants to merge 5 commits into
mainfrom
bulk

Conversation

@pstalcup

Copy link
Copy Markdown
Contributor

No description provided.

@spaghetti-squash spaghetti-squash left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than an issue with makeBulk looks pretty good

Comment thread src/actions.ts

function makeBulk(
bulkOperation: (items: Map<Item, number>) => boolean,
baseAmount?: (item: Item) => number

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check if this variable exists (on line 60) but never use its actual value

Comment thread src/actions.ts Outdated
return {
action: (item: Item) => {
if (
wellStocked(`${item}`, 1000, Math.max(100, autosellPrice(item) * 2)) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has that always used the item name? what the fuck?

Comment thread src/actions.ts Outdated
items.set(
item,
baseAmount && options.stock
? Math.min(Math.max(0, (options.stock ?? 0) - shopAmount(item)), amount(item, options))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
? Math.min(Math.max(0, (options.stock ?? 0) - shopAmount(item)), amount(item, options))
? Math.min(Math.max(0, (options.stock ?? 0) - shopAmount(item)), baseAmount(item, options))

?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also imo make this a clamp

Comment thread src/actions.ts
mallItems.set(item, {
quantity: quantity(item),
limit: options.limit,
price: mallOptions?.price ? mallOptions.price(item) : options.price ?? 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
price: mallOptions?.price ? mallOptions.price(item) : options.price ?? 0,
price: mallOptions?.price?.(item) ?? options.price ?? 0,

or whatever you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants