Add required district field to teacher trial request forms

School now optional
N/A placeholder on district field and don't save it if it's n/a
Updating required field error UI a bit, and there is some larger
refactoring needed here later.
NCES phone number for district only entries will currently be a child
school, will fix later.

Closes 
This commit is contained in:
Matt Lott 2016-08-05 09:08:37 -07:00
parent f4c0e4144e
commit 6f08d5e422
18 changed files with 630 additions and 426 deletions

View file

@ -16,7 +16,7 @@ if (process.argv.length !== 10) {
// TODO: Cleanup country/status lookup code
// Save as custom fields instead of user-specific lead notes (also saving nces_ props)
const commonTrialProperties = ['organization', 'city', 'state', 'country'];
const commonTrialProperties = ['organization', 'district', 'city', 'state', 'country'];
// Old properties which are deprecated or moved
const customFieldsToRemove = [
@ -327,7 +327,7 @@ function findCocoLeads(done) {
if (!trialRequest.properties || !trialRequest.properties.email) continue;
const email = trialRequest.properties.email.toLowerCase();
emails.push(email);
const name = trialRequest.properties.nces_name || trialRequest.properties.organization || trialRequest.properties.school || email;
const name = trialRequest.properties.nces_name || trialRequest.properties.organization || trialRequest.properties.school || trialRequest.properties.district || trialRequest.properties.nces_district || email;
if (!leads[name]) leads[name] = new CocoLead(name);
leads[name].addTrialRequest(email, trialRequest);
emailLeadMap[email] = leads[name];