Skip to content
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

Fix route descriptions #133

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/docker-compose.custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ services:

jore4-hasura:
# pin compatible version of jore4 data model
image: "hsldevcom/jore4-hasura:hsl-main--20230727-1617be0cc2799bc0ebb70107f7a6d83915c2bfb1"
image: "hsldevcom/jore4-hasura:hsl-main--20231218-8a28ef5f4b22b6351312788be4e674144f2bb0a2"
networks:
jore4:
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public RouteExportMapper(final IJsonbConverter jsonConverter) {
@Override
public ImporterRoute mapRow(final ResultSet resultSet, final int rowNumber) throws SQLException {
return ImporterRoute.of(
resultSet.getString("route_number"),
getOptionalShort(resultSet, "hidden_variant"),
UUID.fromString(resultSet.getString("direction_id")),
DirectionType.of(resultSet.getString("direction_type")),
jsonConverter.fromJson(resultSet.getString("name"), MultilingualString.class),
UUID.fromString(resultSet.getString("line_jore4_id")),
resultSet.getString("route_number"),
getOptionalShort(resultSet, "hidden_variant"),
DATE_RANGE_CONVERTER.from(resultSet.getString("valid_date_range")),
LegacyHslMunicipalityCode.valueOf(resultSet.getString("legacy_hsl_municipality_code"))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public interface ImporterRoute {

LegacyHslMunicipalityCode legacyHslMunicipalityCode();

static ImporterRoute of(final UUID directionId,
static ImporterRoute of(final String routeNumber,
final Optional<Short> hiddenVariant,
final UUID directionId,
final DirectionType directionType,
final MultilingualString name,
final UUID lineJore4Id,
final String routeNumber,
final Optional<Short> hiddenVariant,
final DateRange validDateRange,
final DateRange validDateRange,
final LegacyHslMunicipalityCode legacyHslMunicipalityCode) {
return ImmutableImporterRoute.builder()
.directionId(directionId)
Expand Down
27 changes: 14 additions & 13 deletions src/main/resources/jore4-export/export_routes.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
SELECT r.network_route_name AS name,
r.network_route_number AS route_number,
r.network_route_hidden_variant AS hidden_variant,
rd.network_route_direction_id AS direction_id,
rd.network_route_direction_type AS direction_type,
l.network_line_jore4_id AS line_jore4_id,
rd.network_route_direction_valid_date_range AS valid_date_range,
r.network_route_legacy_hsl_municipality_code AS legacy_hsl_municipality_code
FROM network.network_routes r
JOIN network.network_route_directions rd ON (rd.network_route_id = r.network_route_id)
JOIN network.network_lines l ON (l.network_line_id = r.network_line_id)
WHERE isempty(rd.network_route_direction_valid_date_range * '[2021-01-01, 2050-01-01)'::daterange) = false
ORDER BY rd.network_route_direction_valid_date_range DESC
SELECT
r.network_route_number AS route_number,
r.network_route_hidden_variant AS hidden_variant,
rd.network_route_direction_id AS direction_id,
rd.network_route_direction_type AS direction_type,
rd.network_route_direction_name AS name,
l.network_line_jore4_id AS line_jore4_id,
rd.network_route_direction_valid_date_range AS valid_date_range,
r.network_route_legacy_hsl_municipality_code AS legacy_hsl_municipality_code
FROM network.network_routes r
JOIN network.network_route_directions rd USING (network_route_id)
JOIN network.network_lines l USING (network_line_id)
WHERE NOT isempty(rd.network_route_direction_valid_date_range * '[2021-01-01, 2050-01-01)'::daterange)
ORDER BY rd.network_route_direction_valid_date_range DESC
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ExportRouteStepTest extends BatchIntegrationTest {
private final String EXPECTED_DIRECTION = Jore4RouteDirection.INBOUND.getValue();
private final UUID EXPECTED_LINE_JORE4_ID = UUID.fromString("5aa7d9fc-2cf9-466d-8ac0-f442d60c261f");
private static final String EXPECTED_LABEL = "1";
private static final String EXPECTED_DESCRIPTION = "{\"fi_FI\":\"Keskustori - Etelä-Hervanta vanha\",\"sv_SE\":\"Central torget - Södra Hervanta gamla\"}";
private static final String EXPECTED_DESCRIPTION = "{\"fi_FI\":\"Keskustori - Kaleva - Etelä-Hervanta vanha\",\"sv_SE\":\"Central torget - Kaleva - Södra Hervanta gamla\"}";
private static final int EXPECTED_PRIORITY = 10;
private static final LegacyHslMunicipalityCode EXPECTED_LEGACY_HSL_MUNICIPALITY_CODE = LegacyHslMunicipalityCode.HELSINKI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class RouteExportProcessorTest {
private static final LegacyHslMunicipalityCode ROUTE_LEGACY_HSL_MUNICIPALITY_CODE = LegacyHslMunicipalityCode.HELSINKI;

private static final ImporterRoute INPUT = ImporterRoute.of(
ROUTE_NUMBER,
ROUTE_HIDDEN_VARIANT,
IMPORTER_ROUTE_DIRECTION_ID,
IMPORTER_ROUTE_DIRECTION,
createMultilingualString(FINNISH_NAME, SWEDISH_NAME),
LINE_JORE4_ID,
ROUTE_NUMBER,
ROUTE_HIDDEN_VARIANT,
DateRange.between(VALIDITY_PERIOD_START_DAY, VALIDITY_PERIOD_END_DAY),
ROUTE_LEGACY_HSL_MUNICIPALITY_CODE
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class WhenSourceTableHasOneRoute {
private final DirectionType EXPECTED_DIRECTION_TYPE = DirectionType.INBOUND;
private final UUID EXPECTED_LINE_JORE4_ID = UUID.fromString("5aa7d9fc-2cf9-466d-8ac0-f442d60c261f");
private static final String EXPECTED_ROUTE_NUMBER = "1";
private static final String EXPECTED_FINNISH_NAME = "Keskustori - Etelä-Hervanta vanha";
private static final String EXPECTED_SWEDISH_NAME = "Central torget - Södra Hervanta gamla";
private static final String EXPECTED_FINNISH_NAME = "Keskustori - Kaleva - Etelä-Hervanta vanha";
private static final String EXPECTED_SWEDISH_NAME = "Central torget - Kaleva - Södra Hervanta gamla";

private final LocalDate EXPECTED_VALID_DATE_RANGE_START = LocalDate.of(2021, 1, 1);
private final LocalDate EXPECTED_VALID_DATE_RANGE_END = LocalDate.of(2022, 1, 1);
Expand Down
Loading