Skip to content

Commit 4d941c4

Browse files
authored
fix: find trip for change on backend of name to place_name (#55)
1 parent 8d6f82d commit 4d941c4

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/components/MyTripsCard/FindTripsCard.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class FindTripsCard extends Component {
129129
const { stop } = this.state
130130
const position = toFilter
131131
.map(function(e) {
132-
return e.name
132+
return e.place_name
133133
})
134134
.indexOf(stop)
135135
newList = toFilter.filter(function(value, index) {
@@ -164,8 +164,11 @@ class FindTripsCard extends Component {
164164
points.map((point, i, arr) => {
165165
if (i !== arr.length - rest) {
166166
menuItems.push(
167-
<MenuItem onClick={() => this.handleClose(name, point.name)} key={i}>
168-
{point.name}
167+
<MenuItem
168+
onClick={() => this.handleClose(name, point.place_name)}
169+
key={i}
170+
>
171+
{point.place_name}
169172
</MenuItem>
170173
)
171174
}
@@ -197,8 +200,8 @@ class FindTripsCard extends Component {
197200
const { expanded, reserved_seats, stop, end } = this.state
198201
const { classes, onSubmit } = this.props
199202

200-
const departurePoint = trip_route.start.name
201-
const arrivalPoint = trip_route.end.name
203+
const departurePoint = trip_route.start.place_name
204+
const arrivalPoint = trip_route.end.place_name
202205

203206
const date = ParseDate(etd_info.etd)
204207
const time = ParseHour(etd_info.etd)
@@ -278,7 +281,7 @@ class FindTripsCard extends Component {
278281
<ListItemIcon>
279282
{this.renderSwitchStop(i, arr.length - 1)}
280283
</ListItemIcon>
281-
<ListItemText primary={point.name} />
284+
<ListItemText primary={point.place_name} />
282285
</ListItem>
283286
))}
284287
</List>

src/screens/FindTrip/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ class FindTripScreen extends Component {
7171

7272
preFilterPayload(payload) {
7373
const newList = payload.trip_route_points.filter(function(value) {
74-
return value.name === payload.stop || value.name === payload.end
74+
return (
75+
value.place_name === payload.stop || value.place_name === payload.end
76+
)
7577
})
76-
payload.stop = newList[0].id
77-
payload.end = newList[1].id
78+
payload.start = newList[0].place_id
79+
payload.end = newList[1].place_id
7880
delete payload.trip_route_points
81+
delete payload.stop
7982
return payload
8083
}
8184

0 commit comments

Comments
 (0)