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

fixed request type strings to match database #464

Merged
merged 3 commits into from
Mar 25, 2020

Conversation

jmensch1
Copy link
Contributor

@jmensch1 jmensch1 commented Mar 25, 2020

Fixes #428

The main change here is to the shape of the REQUEST_TYPES constant. As we discussed I turned it into an object, which let me remove a bunch of .find() statements.

// previously
export const REQUEST_TYPES = [
  {
    type: 'Dead Animal',
    fullType: 'Dead Animal Removal',
    abbrev: 'DAN',
    color: '#4FEFEF',
  }
...
]

// now
export const REQUEST_TYPES = {
  'Dead Animal Removal': {           // matches the database string
    displayName: 'Dead Animal',    // for UI purposes
    abbrev: 'DAN',
    color: '#4FEFEF',
  },
...
}

Every type has a displayName, so you don't have to worry about testing for a fallback.

I also removed a couple of constants that weren't being used anywhere.

@jmensch1 jmensch1 requested review from adamkendis and brodly March 25, 2020 19:28
@@ -35,39 +37,19 @@ export const updateNC = council => ({
payload: council,
});

// set all types to either true or false
const allRequestTypes = value => (
Copy link
Member

Choose a reason for hiding this comment

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

Nice, this is way better.

@adamkendis adamkendis merged commit 70d31ee into dev Mar 25, 2020
@adamkendis adamkendis deleted the 428-FRONT-RequestTypeStrings branch March 25, 2020 20:23
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.

Update request type strings to match database
2 participants