Created
May 13, 2020 22:59
-
-
Save shaunsantacruz/e50772444aa7b7e35c89cc3e4308435e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import _invert from 'lodash/invert' | |
| const filterSlugIdMap = { | |
| //workout | |
| 'warm-up': 17, | |
| 'cool-down': 29, | |
| 'dance': 14, | |
| 'dynamic-stretch': 4, | |
| 'lower-body-strength': 9, | |
| 'upper-body-strength': 24, | |
| 'performance': 13, | |
| //intensity | |
| 'high': 11, | |
| 'low': 5, | |
| 'moderate': 10, | |
| 'moderate-high': 16, | |
| //style | |
| 'bhangra': 7, | |
| 'bhangra-western': 21, | |
| 'bollywood': 3, | |
| 'bollywood-western': 22, | |
| 'folk': 19, | |
| 'western': 18, | |
| }; | |
| // Dev notes for testing | |
| // 'Focus' is tagged western | |
| // 'Turn up the music' is bollywod-western | |
| let western_ids = [ filterSlugIdMap['western'], filterSlugIdMap['bhangra-western'], filterSlugIdMap['bollywood-western'] ]; | |
| const tenMinFilterMap = { | |
| 0: false, /* First row will not trigger a filter */ | |
| 1: { | |
| 'where': [filterSlugIdMap['western']], | |
| 'exclusionsByRow': { | |
| 2: [ | |
| filterSlugIdMap['western'], | |
| filterSlugIdMap['bhangra-western'], | |
| filterSlugIdMap['bollywood-western'], | |
| ] | |
| }, | |
| }, | |
| 2: false | |
| } | |
| const fifteenMinFilterMap = { | |
| 0: false, | |
| 1: { | |
| 'where': [filterSlugIdMap['western']], | |
| 'exclusionsByRow': { | |
| 2: [ | |
| filterSlugIdMap['western'], | |
| filterSlugIdMap['bhangra-western'], | |
| filterSlugIdMap['bollywood-western'], | |
| ] | |
| } | |
| }, | |
| 2: false, | |
| 3: { | |
| 'where': [filterSlugIdMap['western']], | |
| 'exclusionsByRow': { | |
| 2: [ | |
| filterSlugIdMap['western'], | |
| filterSlugIdMap['bhangra-western'], | |
| filterSlugIdMap['bollywood-western'], | |
| ] | |
| } | |
| }, | |
| } | |
| const thirtyMinFilterMap = { | |
| 0: false, | |
| 1: false, | |
| 2: { | |
| 'where': [filterSlugIdMap['western']], | |
| 'exclusionsByRow': { | |
| 3: [ | |
| filterSlugIdMap['western'], | |
| filterSlugIdMap['bhangra-western'], | |
| filterSlugIdMap['bollywood-western'], | |
| ] | |
| } | |
| }, | |
| 3: { | |
| 'where': [filterSlugIdMap['western']], | |
| 'exclusionsByRow': { | |
| 4: [ | |
| filterSlugIdMap['western'], | |
| filterSlugIdMap['bhangra-western'], | |
| filterSlugIdMap['bollywood-western'], | |
| ] | |
| } | |
| }, | |
| 4: false, | |
| 5: false, | |
| 6: false, | |
| 7: false, | |
| }; | |
| const fiftyMinFilterMap = { | |
| 0: false, | |
| 1: false, | |
| 2: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 3: [ ...western_ids ] | |
| } | |
| }, | |
| 3: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 4: [ ...western_ids ] | |
| } | |
| }, | |
| 4: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 5: [ ...western_ids ] | |
| } | |
| }, | |
| 5: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 6: [ ...western_ids ] | |
| } | |
| }, | |
| 6: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 7: [ ...western_ids ] | |
| } | |
| }, | |
| 7: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 8: [ ...western_ids ] | |
| } | |
| }, | |
| 8: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 9: [ ...western_ids ] | |
| } | |
| }, | |
| 9: { | |
| 'where': [ ...western_ids ], | |
| 'exclusionsByRow': { | |
| 10: [ ...western_ids ] | |
| } | |
| }, | |
| 10: false, | |
| 11: false, | |
| 12: false, | |
| 13: false, | |
| // limit: { | |
| // 'count': 4, | |
| // 'where': [ ...western_ids ], | |
| // } | |
| }; | |
| const filterMap = { | |
| 10: tenMinFilterMap, | |
| 15: fifteenMinFilterMap, | |
| 30: thirtyMinFilterMap, | |
| 50: fiftyMinFilterMap, | |
| } | |
| export const getFilterMap = min => filterMap[min] | |
| export const get_taxonomies_by_id = () => _invert(filterSlugIdMap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment