From 04d1034105fde62dc9c7ed66f920f4946cc500a9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 27 Jan 2025 12:59:46 +0100 Subject: [PATCH] fix: use nsp value for bracket station text (#508) (#509) --- .../lib/sfera/src/mapper/segment_profile_mapper.dart | 8 +++++--- .../T9999_mixed_journey/SFERA_SP_T9999_4.xml | 1 + .../T9999_mixed_journey/SFERA_SP_T9999_5.xml | 1 + .../T4_Stop_on_demand/SFERA_SP_T4_1.xml | 2 ++ .../T6_TAF_TAP_locations/SFERA_SP_T6_2.xml | 2 ++ .../T9999_mixed_journey/SFERA_SP_T9999_4.xml | 1 + .../T9999_mixed_journey/SFERA_SP_T9999_5.xml | 1 + 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/das_client/lib/sfera/src/mapper/segment_profile_mapper.dart b/das_client/lib/sfera/src/mapper/segment_profile_mapper.dart index 06972d8a..e84d8472 100644 --- a/das_client/lib/sfera/src/mapper/segment_profile_mapper.dart +++ b/das_client/lib/sfera/src/mapper/segment_profile_mapper.dart @@ -38,6 +38,7 @@ class SegmentProfileMapper { static const String _bracketStationNspName = 'bracketStation'; static const String _bracketStationMainStationNspName = 'mainStation'; + static const String _bracketStationTextNspName = 'text'; static const String _protectionSectionNspFacultativeName = 'facultative'; static const String _protectionSectionNspLengthTypeName = 'lengthType'; @@ -161,6 +162,7 @@ class SegmentProfileMapper { for (final tafTapLocationNsp in tafTapLocation.nsp) { if (tafTapLocationNsp.name == _bracketStationNspName) { final mainStationNsp = tafTapLocationNsp.parameters.withName(_bracketStationMainStationNspName); + final textNsp = tafTapLocationNsp.parameters.withName(_bracketStationTextNspName); if (mainStationNsp == null) { Fimber.w('Encountered bracket station without main station NSP declaration: $tafTapLocation'); } else { @@ -172,10 +174,10 @@ class SegmentProfileMapper { .firstOrNull; if (mainStation == null) { Fimber.w('Failed to resolve main station for bracket station: $tafTapLocation'); - } else { - return BracketMainStation( - abbreviation: mainStation.abbreviation, countryCode: countryCode, primaryCode: primaryCode); } + + return BracketMainStation( + abbreviation: textNsp?.nspValue ?? '', countryCode: countryCode, primaryCode: primaryCode); } } } diff --git a/das_client/test_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml b/das_client/test_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml index 721cdd13..9a8112ef 100644 --- a/das_client/test_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml +++ b/das_client/test_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml @@ -52,6 +52,7 @@ + + + @@ -77,6 +78,7 @@ + diff --git a/sfera-mock/src/main/resources/static_sfera_resources/T6_TAF_TAP_locations/SFERA_SP_T6_2.xml b/sfera-mock/src/main/resources/static_sfera_resources/T6_TAF_TAP_locations/SFERA_SP_T6_2.xml index c1e0781e..11a13e68 100644 --- a/sfera-mock/src/main/resources/static_sfera_resources/T6_TAF_TAP_locations/SFERA_SP_T6_2.xml +++ b/sfera-mock/src/main/resources/static_sfera_resources/T6_TAF_TAP_locations/SFERA_SP_T6_2.xml @@ -236,6 +236,7 @@ + @@ -248,6 +249,7 @@ + diff --git a/sfera-mock/src/main/resources/static_sfera_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml b/sfera-mock/src/main/resources/static_sfera_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml index 721cdd13..9a8112ef 100644 --- a/sfera-mock/src/main/resources/static_sfera_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml +++ b/sfera-mock/src/main/resources/static_sfera_resources/T9999_mixed_journey/SFERA_SP_T9999_4.xml @@ -52,6 +52,7 @@ + +