Skip to content
This repository was archived by the owner on Jan 7, 2020. It is now read-only.

Commit 67f27da

Browse files
committed
use simpler JS for ie11
1 parent e7baf3d commit 67f27da

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/geo/Geography.jsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,18 @@ class Geography extends Component {
139139
}
140140

141141
checkIfLargeFile(category, items) {
142-
const leisSelected = this.state && this.state.leis.length
142+
const leisSelected = this.state && this.state.leis.length
143143
const leisFetched = this.state && !this.state.leiDetails.loading
144144

145145
if(category === 'leis'){
146-
if(items.length && leisFetched)
146+
if(items.length && leisFetched)
147147
return this.checkIfLargeCount(items, this.state.leiDetails.counts)
148-
149-
if(!items.length)
148+
149+
if(!items.length)
150150
return this.checkIfLargeFile(this.state.category, this.state.items)
151151
}
152-
153-
if(leisSelected && leisFetched)
152+
153+
if(leisSelected && leisFetched)
154154
return this.checkIfLargeCount(this.state.leis, this.state.leiDetails.counts)
155155

156156
if(isNationwide(category)) return true
@@ -187,11 +187,11 @@ class Geography extends Component {
187187

188188
onInstitutionChange(selectedLEIs = []){
189189
let leis = selectedLEIs.map(l => l.value)
190-
if(leis.includes('all')) leis = []
190+
if(leis.indexOf('all') !== -1) leis = []
191191

192192
return this.setState({leis, details: {}}, () => {
193-
return this.setStateAndRoute({
194-
isLargeFile: this.checkIfLargeFile('leis', this.state.leis)
193+
return this.setStateAndRoute({
194+
isLargeFile: this.checkIfLargeFile('leis', this.state.leis)
195195
})
196196
})
197197
}
@@ -229,7 +229,7 @@ class Geography extends Component {
229229
}
230230

231231
if(!newState.variables[variable][subvar.id]) delete newState.variables[variable][subvar.id]
232-
232+
233233
const largeFile = this.checkIfLargeFile(this.state.category, this.state.items)
234234

235235
this.setStateAndRoute({
@@ -262,9 +262,9 @@ class Geography extends Component {
262262
}
263263

264264
render() {
265-
const { category, details, error, isLargeFile, items, leiDetails, leis,
265+
const { category, details, error, isLargeFile, items, leiDetails, leis,
266266
loadingDetails, orderedVariables, variables } = this.state
267-
267+
268268
const nationwide = isNationwide(category)
269269
const enabled = nationwide || items.length
270270
const checksExist = someChecksExist(variables)
@@ -317,7 +317,7 @@ class Geography extends Component {
317317
{details.aggregations && !error
318318
? this.showAggregations(details, orderedVariables)
319319
: null}
320-
<ActionsWarningsErrors
320+
<ActionsWarningsErrors
321321
downloadEnabled={enabled}
322322
downloadCallback={checksExist ? this.requestSubsetCSV : this.requestItemCSV}
323323
showSummaryButton={!details.aggregations}

src/geo/InstitutionSelect.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const InstitutionSelect = ({
1414
items,
1515
onChange,
1616
leiDetails
17-
}) => {
17+
}) => {
1818
const category = 'leis'
1919
const {leis, loading} = leiDetails
2020
const selectedValues = items.map(lei => createLEIOption(lei, leis))
@@ -59,9 +59,9 @@ const styleFn = {
5959

6060
export function pruneLeiOptions(data, selected) {
6161
const selectedLeis = selected.map(s => s.value)
62-
const institutions = Object.values(data)
62+
const institutions = Object.keys(data).map(v => data[v])
6363
const opts = institutions
64-
.filter(institution => !selectedLeis.includes(institution.lei))
64+
.filter(institution => selectedLeis.indexOf(institution.lei) === -1)
6565
.map(institution => ({ value: institution.lei, label: `${institution.name.toUpperCase()} - ${institution.lei}` }))
6666
.sort(sortByLabel)
6767
opts.unshift({ value: 'all', label: `All Financial Institutions (${institutions.length})` })

0 commit comments

Comments
 (0)