Skip to content

Commit

Permalink
allow null results for missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate-Wessel committed May 22, 2024
1 parent 51202c7 commit 9fba617
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/src/travelTimeQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class TravelTimeQuery {
}
return fetch(this.URI)
.then( response => response.json() )
.then( data => this.#results = data.results )
.then( data => this.#results = data?.results )
}
get hasData(){
return Boolean(this.#results)
Expand All @@ -61,11 +61,11 @@ export class TravelTimeQuery {
record.set('daysOfWeek', this.days.name)
record.set('holidaysIncluded', this.#holidayOption.holidaysIncluded)
record.set('hoursInRange', this.hoursInRange)
record.set('sample', this.#results.confidence.sample)
record.set('mean_travel_time_minutes', this.#results.travel_time.minutes)
record.set('mean_travel_time_seconds', this.#results.travel_time.seconds)
record.set('moe_lower_p95', this.#results.confidence.intervals['p=0.95'].lower.seconds)
record.set('moe_upper_p95', this.#results.confidence.intervals['p=0.95'].upper.seconds)
record.set('sample', this.#results?.confidence?.sample ?? 0)
record.set('mean_travel_time_minutes', this.#results?.travel_time?.minutes)
record.set('mean_travel_time_seconds', this.#results?.travel_time?.seconds)
record.set('moe_lower_p95', this.#results?.confidence?.intervals?.['p=0.95']?.lower?.seconds)
record.set('moe_upper_p95', this.#results?.confidence?.intervals?.['p=0.95']?.upper?.seconds)

if(type=='json'){
return Object.fromEntries(record) // can't JSONify maps
Expand Down

0 comments on commit 9fba617

Please sign in to comment.