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

Job now prints full output for all api calls. Next step, extract just… #166

Merged
merged 3 commits into from
Jun 1, 2024

Conversation

LizPrescott
Copy link
Collaborator

… the ticket symbol and closing price

Comment on lines +7 to +11
stock_symbols = ["KO", "SNE", "TWX", "DIS", "SIRI", "F", "EA", "FB", "UA", "LUV", "GPS"]
stock_symbols.each do |symbol|
api_request(symbol)
stock_db = Stock.find_by(ticker: symbol)
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe ensure the stock can be found in the DB before we request the stock? As written, would this cause the job to abort if the stock with one of the tickers can't be found, skipping the processing of any further stocks in the list

Copy link
Member

@abachman abachman Jun 1, 2024

Choose a reason for hiding this comment

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

.find_by is okay here, since it returns nil instead of raising NotFoundError

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I forgot about that, thanks.

This means we'll have to do nil checks, though

@abachman abachman merged commit ac4dbc2 into main Jun 1, 2024
1 check passed
@abachman abachman deleted the update_stock_price branch June 1, 2024 19:26
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.

3 participants