From d619fd00773232370bbffb4004d54f522c104e21 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Wed, 23 Oct 2024 10:32:51 +0200 Subject: [PATCH] fix: Import dates as Utc --- .../lib/src/services/apis/germany_by.dart | 2 +- wrestling_scoreboard_common/test/services/apis_test.dart | 4 ++-- wrestling_scoreboard_server/test/expected_api_import.sql | 6 +++--- wrestling_scoreboard_server/test/outdated_api_import.sql | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wrestling_scoreboard_common/lib/src/services/apis/germany_by.dart b/wrestling_scoreboard_common/lib/src/services/apis/germany_by.dart index 397e6b5e..c1ed1552 100644 --- a/wrestling_scoreboard_common/lib/src/services/apis/germany_by.dart +++ b/wrestling_scoreboard_common/lib/src/services/apis/germany_by.dart @@ -350,7 +350,7 @@ class ByGermanyWrestlingApi extends WrestlingApi { gender: wrestlerJson['gender'] == 'm' ? Gender.male : (wrestlerJson['gender'] == 'w' ? Gender.female : Gender.other), - birthDate: DateTime.parse(wrestlerJson['birthday']), + birthDate: DateTime.parse(wrestlerJson['birthday']).copyWith(isUtc: true), nationality: Countries.values .singleWhereOrNull((element) => element.unofficialNames.contains(wrestlerJson['nationality'])), )), diff --git a/wrestling_scoreboard_common/test/services/apis_test.dart b/wrestling_scoreboard_common/test/services/apis_test.dart index cea749c8..74f8dd24 100644 --- a/wrestling_scoreboard_common/test/services/apis_test.dart +++ b/wrestling_scoreboard_common/test/services/apis_test.dart @@ -85,7 +85,7 @@ void main() { prename: 'Max', surname: 'Muster', gender: Gender.male, - birthDate: DateTime(2000, 1, 31), + birthDate: DateTime.utc(2000, 1, 31), nationality: Countries.deu, ), ); @@ -628,7 +628,7 @@ void main() { prename: 'Tobias', surname: 'Müller', gender: Gender.male, - birthDate: DateTime(2000, 3, 02), + birthDate: DateTime.utc(2000, 3, 02), nationality: Countries.deu, ), ), diff --git a/wrestling_scoreboard_server/test/expected_api_import.sql b/wrestling_scoreboard_server/test/expected_api_import.sql index 03b6dfea..9eb1c848 100644 --- a/wrestling_scoreboard_server/test/expected_api_import.sql +++ b/wrestling_scoreboard_server/test/expected_api_import.sql @@ -1717,8 +1717,8 @@ COPY public.participation (id, membership_id, lineup_id, weight_class_id, weight COPY public.person (id, prename, surname, birth_date, gender, nationality, org_sync_id, organization_id) FROM stdin; 24 Mustafa Durak \N \N \N Mustafa_Durak_null 2 25 Fröhlich Peter \N \N \N Fröhlich_Peter_null 2 -26 Max Muster 2000-01-30 male DEU Max_Muster_2000-01-31 2 -27 Tobias Müller 2000-03-01 male DEU Tobias_Müller_2000-03-02 2 +26 Max Muster 2000-01-31 male DEU Max_Muster_2000-01-31 2 +27 Tobias Müller 2000-03-02 male DEU Tobias_Müller_2000-03-02 2 \. @@ -1727,7 +1727,7 @@ COPY public.person (id, prename, surname, birth_date, gender, nationality, org_s -- COPY public.secured_user (id, username, password_hash, email, person_id, salt, created_at, privilege) FROM stdin; -2 admin \\xc215302a5e928facc2e5d1d7e77e62f53b874f1f661a19f473906195cdb9792c \N \N 3OJFGA== 2024-10-22 admin +2 admin \\x9b452a2e6bc24ddb4117dfb727f78f5da9ed569201a094a9f3e9d8a1671f891a \N \N 36jSKg== 2024-10-23 admin \. diff --git a/wrestling_scoreboard_server/test/outdated_api_import.sql b/wrestling_scoreboard_server/test/outdated_api_import.sql index f57e7c5c..90a2248f 100644 --- a/wrestling_scoreboard_server/test/outdated_api_import.sql +++ b/wrestling_scoreboard_server/test/outdated_api_import.sql @@ -1717,8 +1717,8 @@ COPY public.participation (id, membership_id, lineup_id, weight_class_id, weight COPY public.person (id, prename, surname, birth_date, gender, nationality, org_sync_id, organization_id) FROM stdin; 24 Mustafa Durak \N \N \N Mustafa_Durak_null 2 25 Fröhlich Peter \N \N \N Fröhlich_Peter_null 2 -26 Max Muster 2000-01-30 male DEU Max_Muster_2000-01-31 2 -27 Tobias Müller 2000-03-01 male DEU Tobias_Müller_2000-03-02 2 +26 Max Muster 2000-01-31 male DEU Max_Muster_2000-01-31 2 +27 Tobias Müller 2000-03-02 male DEU Tobias_Müller_2000-03-02 2 \. @@ -1727,7 +1727,7 @@ COPY public.person (id, prename, surname, birth_date, gender, nationality, org_s -- COPY public.secured_user (id, username, password_hash, email, person_id, salt, created_at, privilege) FROM stdin; -2 admin \\xc215302a5e928facc2e5d1d7e77e62f53b874f1f661a19f473906195cdb9792c \N \N 3OJFGA== 2024-10-22 admin +2 admin \\x9b452a2e6bc24ddb4117dfb727f78f5da9ed569201a094a9f3e9d8a1671f891a \N \N 36jSKg== 2024-10-23 admin \.