District dropdown#8394
Conversation
…ofessional learning application
This adds a .tsv file generated from our 18,000-long gsheet of US districts. It's imported into the database. The district dropdown then retrieves the appropriate set of per-state entries when a state is selected in the preceding dropdown, from which the user can select their district. Definitely work in progress, but wanted to get this saved.
Conflicts: dashboard/db/schema.rb
| @@ -1,4 +1,10 @@ | |||
| FactoryGirl.define do | |||
| FactoryGirl.define do factory :school_district do | |||
There was a problem hiding this comment.
Style/MultilineBlockLayout: Block body expression is on the same line as the block start.
Conflicts: dashboard/db/schema.rb
… workshop enroll.
| def self.find_or_create_all_from_tsv!(filename) | ||
| created = [] | ||
| CSV.read(filename, CSV_IMPORT_OPTIONS).each do |row| | ||
| created << self.first_or_create_from_tsv_row!(row) |
There was a problem hiding this comment.
Nit: prefer map. Can this code be de-duped against the similar code in callout.rb?
There was a problem hiding this comment.
also nit: prefer newer ruby hash syntax (no unnecessary hash rocket)
{
id: 'LEAID',
name: 'NAME',
...The small district dropdown widget actually involves a bunch of state transitions, as the various options are explored. This change hopefully takes care of all of them, getting the right information fed into the form, and clearing out any entries that shouldn't make it through based on what the user ultimately chooses.
| <br/> | ||
| <iframe src="https://www.google.com/maps/d/u/0/embed?mid=z3jxShb6X1IM.khZ1NwyRM_3Y" width="640" height="480"></iframe> | ||
|
|
||
| <%= view :district_dropdown %> |
There was a problem hiding this comment.
@tanyaparker is this page live yet? if so, i should just leave the map in place for now.
There was a problem hiding this comment.
Yep, this page is live and we should leave in the map. For spectators, we shouldn't change it to the dropdown until we save the info in a pegasus form and know where to redirect each district (application, waitlist, exception).
Conflicts: dashboard/db/schema.rb dashboard/db/schema_cache.dump
| end | ||
|
|
||
| def self.first_or_create_from_tsv_row!(row_data) | ||
| params = {id: row_data[CSV_HEADERS[:id]], |
There was a problem hiding this comment.
nit, start items on a new line for cleaner indentation:
params = {
id: row_data[...],
name: ...
...
}Conflicts: dashboard/db/schema.rb
missing) and provided optional enrollment.district_name which was accidentally removed in #8394.
Builds upon work by @tanyaparker to have a district dropdown selector, used first in the workshop enrollment page.