-
Notifications
You must be signed in to change notification settings - Fork 80
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
Location Groups July 2024 #1017
base: dev-flex-2024
Are you sure you want to change the base?
Location Groups July 2024 #1017
Conversation
fix: define and document MAP_BASE_URL to prevent gray maps
Excited for this update! |
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.
First round of comments.
if (refetch) { | ||
dispatch(fetchGTFSEntities({ | ||
namespace, | ||
id: savedEntity.id, |
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.
Sort attributes (2 instances)
dispatch(receivedNewEntity({component: 'locationgroupstop', entity: savedEntity})) | ||
} | ||
}) | ||
return dispatch(secureFetch(locationGroupUrl, method, data)) |
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.
The two big dispatch blocks are almost the same... Would it be possible to extract them (such as saveEntity('locationgroup', locationGroupUrl)
and same for locationgroupstop
)?
@@ -207,8 +208,7 @@ export function addStopAtInterval (latlng: LatLng, activePattern: Pattern, contr | |||
const stopControlPoint = result.controlPoints[controlPoints.length + index] | |||
const patternStop = stopToPatternStop(s) | |||
// Set pattern stop's shape dist traveled. | |||
if (patternHaltIsStop(patternStop)) { |
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.
Didn't expect TS to make us inline so much code...
patternStop={patternStop} /> | ||
} | ||
if (locationGroup) { | ||
// 2024 TODO: support rendering location groups. will be tricky. need to |
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.
Remove "2024" or replace with "2025"!
|
||
// find center to simulate stop | ||
const center = centerOfMass(turfPolygon([polygon])) | ||
if (center.geometry.coordinates) { |
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.
Extract a variable for center.geometry.coordinates
.
} | ||
addStopToPattern={addStopToPattern} | ||
index={index} | ||
key={patternStop.id} |
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.
Should key
be the same as ref
? The ref
value implies that key
could be null.
@@ -122,6 +124,7 @@ export default class EditShapePanel extends Component<Props> { | |||
saveActiveGtfsEntity, | |||
showConfirmModal, | |||
stops, | |||
locations, locationGroups, |
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.
Insert new line between props.
cardBackground = 'hsla(187, 84%, 87%, 0.5)' | ||
} | ||
// $FlowFixMe flexDefaultTravelTime doens't exist on a PatternStop, which is the point of this check |
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.
Typo
// $FlowFixMe flexDefaultTravelTime doens't exist on a PatternStop, which is the point of this check | |
// $FlowFixMe flexDefaultTravelTime doesn't exist on a PatternStop, which is the point of this check |
if (patternStop.stopId !== null) { | ||
this.setState({ | ||
// $FlowFixMe flow doesn't like our "type check" | ||
initialDwellTime: patternStop.defaultDwellTime, | ||
// $FlowFixMe flow doesn't like our "type check" | ||
initialTravelTime: patternStop.defaultTravelTime, | ||
initialDwellTime: patternStop.defaultDwellTime || undefined, | ||
initialTravelTime: patternStop.defaultTravelTime || undefined, | ||
update: false | ||
}) | ||
} else { | ||
// If patternStop is not a fixed stop, it is a flex location/location group. | ||
this.setState({ | ||
// $FlowFixMe flow doesn't like our "type check" | ||
flexDefaultZoneTime: patternStop.flexDefaultZoneTime, | ||
// $FlowFixMe flow doesn't like our "type check" | ||
flexDefaultTravelTime: patternStop.flexDefaultTravelTime, | ||
// $FlowFixMe flow doesn't like our "type check" | ||
meanDurationFactor: patternStop.meanDurationFactor, | ||
// $FlowFixMe flow doesn't like our "type check" | ||
meanDurationOffset: patternStop.meanDurationOffset, | ||
// $FlowFixMe flow doesn't like our "type check" | ||
safeDurationFactor: patternStop.safeDurationFactor, | ||
// $FlowFixMe flow doesn't like our "type check" | ||
safeDurationOffset: patternStop.safeDurationOffset, | ||
defaultDwellTime: patternStop.defaultDwellTime || undefined, | ||
defaultTravelTime: patternStop.defaultTravelTime || undefined, | ||
update: false | ||
}) |
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.
Contents in the if and else portions is the same, so you can remove the condition entirely.
stop = locationGroups.find(lg => lg.location_group_id === card.locationGroupId) | ||
// $FlowFixMe flow doesn't appreciate our type check | ||
cumulativeTravelTime += card.flexDefaultZoneTime + card.flexDefaultTravelTime | ||
cumulativeTravelTime += card.defaultDwellTime + card.defaultTravelTime |
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.
cumulativeTravelTime
should be computed once for all the cases.
Location Group support following latest flex spec. Works with data tools-server
dev-flex
branch