Skip to content
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

"peak_start is not defined" error #110

Closed
RLesser opened this issue Apr 15, 2020 · 5 comments · Fixed by #113
Closed

"peak_start is not defined" error #110

RLesser opened this issue Apr 15, 2020 · 5 comments · Fixed by #113

Comments

@RLesser
Copy link

RLesser commented Apr 15, 2020

Started getting this error for these inputs:
First Time: Yes
Previous Pattern: Unknown
Sunday: 100
Week Prices: 43, 38, 100, 84, 150

Screen Shot 2020-04-15 at 10 50 01 AM

@joelft
Copy link

joelft commented Apr 15, 2020

I am also getting this error. In my case it's when loading the page with URL parameters like this https://turnipprophet.io/index.html?prices=100.58.53.94.140.164.0.0.0.0.0.0.0

@theRTC204
Copy link
Collaborator

Almost certainly related to the refactor that was merged shortly before these reports.

Investigating...

@ChiefMilesEdgeworth
Copy link
Contributor

It could be here:

function generate_peak_price(
given_prices, predicted_prices, start, rate_min, rate_max) {
rate_min *= RATE_MULTIPLIER;
rate_max *= RATE_MULTIPLIER;
const buy_price = given_prices[0];
// Main spike 1
min_pred = get_price(rate_min, buy_price) - 1;
max_pred = get_price(rate_max, buy_price) - 1;
if (!isNaN(given_prices[start])) {
if (given_prices[start] < min_pred - FUDGE_FACTOR || given_prices[peak_start + 2] > max_pred + FUDGE_FACTOR) {
// Given price is out of predicted range, so this is the wrong pattern
return false;
}
min_pred = given_prices[start];
max_pred = given_prices[start];
}

The peak_start variable is used in an if statement without being declared for the function on line 176.

@peter50216
Copy link
Contributor

Well that's what happen when you partially revert a PR... 🤦
All my fault, I didn't check the intermediate commit that carefully.

@mikebryant
Copy link
Owner

Sorry about that!

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 a pull request may close this issue.

6 participants