From dfa3e092c2e23db62cd348040dfcb4e5d210bf48 Mon Sep 17 00:00:00 2001 From: Thomas Haddad Date: Mon, 19 Dec 2016 12:07:48 +0100 Subject: Fix stopAreas array, add stopArea id in json, and is now properly rendered Signed-off-by: Thomas Shawarma Haddad Signed-off-by: Jean-Paul Lescouzeres --- .../es6_browserified/journey_patterns/actions/index.js | 12 ++++++------ .../journey_patterns/components/JourneyPattern.js | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js b/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js index fea293c95..ec9df63f2 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js @@ -51,19 +51,19 @@ const actions = { .then((json) => { let val for (val of json){ - let stop_points = [] for (let stop_point of val.route_short_description.stop_points){ stop_point.checked = false - stop_points[stop_point.object_id] = stop_point - } - for (let stopArea of val.stop_area_short_descriptions){ - stop_points[stopArea.stop_area_short_description.object_id].checked = true + val.stop_area_short_descriptions.map((element) => { + if(element.stop_area_short_description.id === stop_point.id){ + stop_point.checked = true + } + }) } journeyPatterns.push({ name: val.name, object_id: val.object_id, published_name: val.published_name, - stop_points: stop_points + stop_points: val.route_short_description.stop_points }) } dispatch(actions.receiveJourneyPatterns(journeyPatterns)) diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js index 460805176..f808bbb83 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js @@ -11,7 +11,13 @@ const JourneyPattern = (props) => {

Stop points:

) -- cgit v1.2.3