-
Notifications
You must be signed in to change notification settings - Fork 1
Add query arg for delay parameter on lines #2
base: master
Are you sure you want to change the base?
Add query arg for delay parameter on lines #2
Conversation
To allow the client to mess with good and bad service thresholds, move the status computation (or at least part of it) to the client side. This commit does it for the lines.
Hey, I thought I would have time to review this, but with getting back from the holidays and I'm leaving for vacation, I won't be able to get back to this until afterwards, which unfortunately will be a month from now. Sorry for the delay! |
Hah, no problem. I'm using it on a personal server to grab historical delay times for now. Planning on publishing a little post, hopefully when you get back in town. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thanks for doing this. Apologies again for the delay, I just returned from my vacation yesterday. Just a few nitpick comments regarding syntax and whether or not some of the code should be included in this PR.
@@ -241,9 +249,43 @@ class LandingPage extends React.Component { | |||
if (TEST_DATA) { | |||
this.setState({ trains: sampleData.routes, lines: sampleData.lines, loading: false }); | |||
} else { | |||
let params = qs.parse(location.search); | |||
let use_median = params.median && params.median === 'true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tiny nitpick, let's keep variable names camelCase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, don't think we need the first half of the evaluation if we are evaluating with ===
?
import * as Cookies from 'es-cookie'; | ||
|
||
const API_URL = '/api/info'; | ||
const TEST_DATA = false; | ||
|
||
function getQueryStringValue (key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this if we already import query-string
?
@@ -23,16 +23,60 @@ def delay | |||
|
|||
def max_actual_headway | |||
@max_actual_headway if @max_actual_headway | |||
compute_actual_headways |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's revert changes of this file until the feature is implemented for routes as well.
This is a small change that allows for a power user to specify the headway discrepancy they want to call "bad service" as a query argument. It moves (most of) the computation to the client side in the process.
Currently only does it for the lines because I wanted to see if @blahblahblah- wanted the general thrust done in some other manner.