-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk operations #25
base: main
Are you sure you want to change the base?
Bulk operations #25
Conversation
There was a problem hiding this comment.
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
@@ -40,71 +47,81 @@ export function filters(options: Options): (item: Item) => boolean { | |||
return (item: Item) => true; | |||
} | |||
|
|||
function makeBulk( | |||
bulkOperation: (items: Map<Item, number>) => boolean, | |||
baseAmount?: (item: Item) => number |
There was a problem hiding this comment.
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
src/actions.ts
Outdated
sell: (options: Options) => { | ||
const mallAction = makeMall()(options); | ||
const autosellAction = makeBulk(bulkAutosell)(options); | ||
|
||
return { | ||
action: (item: Item) => { | ||
if ( | ||
wellStocked(`${item}`, 1000, Math.max(100, autosellPrice(item) * 2)) || |
There was a problem hiding this comment.
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?
src/actions.ts
Outdated
items.set( | ||
item, | ||
baseAmount && options.stock | ||
? Math.min(Math.max(0, (options.stock ?? 0) - shopAmount(item)), amount(item, options)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? 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)) |
?
There was a problem hiding this comment.
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
mallItems.set(item, { | ||
quantity: quantity(item), | ||
limit: options.limit, | ||
price: mallOptions?.price ? mallOptions.price(item) : options.price ?? 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
price: mallOptions?.price ? mallOptions.price(item) : options.price ?? 0, | |
price: mallOptions?.price?.(item) ?? options.price ?? 0, |
or whatever you want
No description provided.