-
Notifications
You must be signed in to change notification settings - Fork 10
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
Coding Challenge #14
base: master
Are you sure you want to change the base?
Coding Challenge #14
Conversation
## Instructions | ||
- bundle install | ||
- npm install | ||
- bundle exec rake db:reset to re-seed database |
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.
@pyreta the only diff in this PR should be new files you add to write the web server/web application; probably don't want to overwrite this README
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.
@mecampbellsoup Had an error pushing with the existing license and README, so I removed it.
@@ -0,0 +1,20 @@ | |||
const AppDispatcher = require("../dispatcher/dispatcher"); |
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.
I believe there's a way to set another lookup path in your webpack config so that you don't have to use relative paths in your require statements
In other words, instead of require('../dispatcher/dispatcher')
, you could require('dispatcher/dispatcher')
Require also looks for dispatcher/index.js
and dispatcher/package.json
if it doesn't find dispatcher.js
right away, so your require statement could just become require('dispatcher')
if you rename dispatcher.js
to index.js
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.
@danielchangNYC Ah this is a great call Daniel. I believe I could useresolve.moduleDirectories
the way I resolved the extensions.
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.
Even better, this webpack contributor recommends using resolve.root
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.
@danielchangNYC Thanks for this tip! I updated the webpack config to resolve.root and removed all those ugly "../"'s. I also changed dispatcher.js to index.js to see if it defaulted to that file (which it did). This is definitely something I will use moving forward. Thanks again!
class CreateBanks < ActiveRecord::Migration | ||
def change | ||
create_table :banks do |t| | ||
t.integer :routing_num, null:false |
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.
This should be a string not integer probably.
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.
@mecampbellsoup This is corrected in a later migration.
@pyreta I'd like you to work on an enhancement before we have any sort of phone call. Here goes:
|
@@ -0,0 +1,45 @@ | |||
require 'http' | |||
|
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.
@pyreta nice work, you got the fixed width thing.
Overall comments: would love to see some specs for the behavior contained in this file. It would probably be easier to write those tests if you encapsulated the logic in seeds.rb
into a class or classes.
So in seeds.rb
you can just do something like BankDataParser.perform!
, and the you'll have the actual (unit-tested) logic in lib/<your-app-name>/bank_data_parser.rb
.
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.
It also would be nice to see a separation of concerns, where the concerns of seeds.rb
at the moment is twofold: fetching the data, parsing it by row/entry in the sheet, and persisting those records to the database. The last two can probably be combined into a single concern, but the former (fetching) should standalone.
lib/<app-name>/actions/fetch_bank_data.rb
lib/<app-name>/actions/parse_bank_data.rb
You can name them whatever you want though just providing an example.
@mecampbellsoup just run |
json.extract! @bank, :zipcode, :zipcode_ext | ||
json.street_address @bank.address | ||
end | ||
json.last_change_date @bank.last_change_date.to_s[0...10] |
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.
Since this is the view layer, I might opt for creating a more direct interface for the bank object instead of manipulating data here.
:data_view_code, | ||
:office_code, | ||
:last_change_date, | ||
:inst_status__code |
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.
Much cleaner!
@pyreta how's the 'fetch, parse and store' rake task functionality coming along? Also, can you make this deployable to Heroku? Feel free to ask questions of us in this PR. |
@mecampbellsoup Are you referring to the changes I made in the seed file? I divided the functionality of the fetching and parsing into separate classes (which tests are written for in the spec folder). The seed file uses these classes when you run rake db:seed. See |
@mecampbellsoup Should be Deployable on Heroku now... |
@pyreta sorry I meant deployed, ha. Once deployed just tell us the public URL. |
@pyreta getting some 500 errors: https://www.dropbox.com/s/c25act8ytdc8ehr/Screenshot%202016-08-31%2014.27.30.png?dl=0 |
@mecampbellsoup As of right now there is no error handling for invalid routing numbers. |
@mecampbellsoup Added some error handling to account for invalid routing numbers. Should be all good now. |
No description provided.