[server]: Fix Decimal error in manually inserted Luas data

This commit is contained in:
2025-04-05 18:09:34 +01:00
parent 191ddf8a31
commit 6c4055f0b5
2 changed files with 37 additions and 68 deletions

View File

@ -99,155 +99,124 @@ def fetch_luas():
stops += [ stops += [
{ {
# dawson luas stop
"objectID": "LuasStop-DAW", "objectID": "LuasStop-DAW",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.34235198108542, "latitude": "53.34235198108542",
"longitude": -6.257874705533702, "longitude": "-6.257874705533702",
"luasStopName": "Dawson", "luasStopName": "Dawson",
"luasStopIrishName": "Dásain", "luasStopIrishName": "Dásain",
"luasStopCode": "DAW", "luasStopCode": "DAW",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# westmoreland luas stop
"objectID": "LuasStop-WES", "objectID": "LuasStop-WES",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.34657666552001, "latitude": "53.34657666552001",
"longitude": -6.258954552531184, "longitude": "-6.258954552531184",
"luasStopName": "Westmoreland", "luasStopName": "Westmoreland",
"luasStopIrishName": "Sráid Westmoreland", "luasStopIrishName": "Sráid Westmoreland",
"luasStopCode": "WES", "luasStopCode": "WES",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# o connell gpo
"objectID": "LuasStop-OGP", "objectID": "LuasStop-OGP",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.34895364842052, "latitude": "53.34895364842052",
"longitude": -6.259870172748866, "longitude": "-6.259870172748866",
"luasStopName": "O'Connell - GPO", "luasStopName": "O'Connell - GPO",
"luasStopIrishName": " Ó Conaill - AOP", "luasStopIrishName": " Ó Conaill - AOP",
"luasStopCode": "OGP", "luasStopCode": "OGP",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# o connell upper
"objectID": "LuasStop-OUP", "objectID": "LuasStop-OUP",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.34897926629319, "latitude": "53.34897926629319",
"longitude": -6.259956003433765, "longitude": "-6.259956003433765",
"luasStopName": "O'Connell - Upper", "luasStopName": "O'Connell - Upper",
"luasStopIrishName": "Ó Conaill Uachtarach", "luasStopIrishName": "Ó Conaill Uachtarach",
"luasStopCode": "OUP", "luasStopCode": "OUP",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# broombridge
"objectID": "LuasStop-BRO", "objectID": "LuasStop-BRO",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.37238519438793, "latitude": "53.37238519438793",
"longitude": -6.29767637274806, "longitude": "-6.29767637274806",
"luasStopName": "Broombridge", "luasStopName": "Broombridge",
"luasStopIrishName": "Droichead Broom", "luasStopIrishName": "Droichead Broom",
"luasStopCode": "BRO", "luasStopCode": "BRO",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# cabra
"objectID": "LuasStop-CAB", "objectID": "LuasStop-CAB",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.3647720048475, "latitude": "53.3647720048475",
"longitude": -6.2818402941276315, "longitude": "-6.2818402941276315",
"luasStopName": "Cabra", "luasStopName": "Cabra",
"luasStopIrishName": "Cabrach", "luasStopIrishName": "Cabrach",
"luasStopCode": "CAB", "luasStopCode": "CAB",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# phibsborough
"objectID": "LuasStop-PHI", "objectID": "LuasStop-PHI",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.360531943612585, "latitude": "53.360531943612585",
"longitude": -6.278946230419645, "longitude": "-6.278946230419645",
"luasStopName": "Phibsborough", "luasStopName": "Phibsborough",
"luasStopIrishName": "Baile Phib", "luasStopIrishName": "Baile Phib",
"luasStopCode": "PHI", "luasStopCode": "PHI",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# grangegorman
"objectID": "LuasStop-GRA", "objectID": "LuasStop-GRA",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.35733203671144, "latitude": "53.35733203671144",
"longitude": -6.277386018855522, "longitude": "-6.277386018855522",
"luasStopName": "Grangegorman", "luasStopName": "Grangegorman",
"luasStopIrishName": "Gráinseach Ghormáin", "luasStopIrishName": "Gráinseach Ghormáin",
"luasStopCode": "GRA", "luasStopCode": "GRA",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# broadstone
"objectID": "LuasStop-BRD", "objectID": "LuasStop-BRD",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.354153216627836, "latitude": "53.354153216627836",
"longitude": -6.27358994584398, "longitude": "-6.27358994584398",
"luasStopName": "Broadstone - University", "luasStopName": "Broadstone - University",
"luasStopIrishName": "An Clocháin Leathan", "luasStopIrishName": "An Clocháin Leathan",
"luasStopCode": "BRD", "luasStopCode": "BRD",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# dominick
"objectID": "LuasStop-DOM", "objectID": "LuasStop-DOM",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.351380458718346, "latitude": "53.351380458718346",
"longitude": -6.265691018855716, "longitude": "-6.265691018855716",
"luasStopName": "Dominick", "luasStopName": "Dominick",
"luasStopIrishName": "Doiminic", "luasStopIrishName": "Doiminic",
"luasStopCode": "DOM", "luasStopCode": "DOM",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# parnell
"objectID": "LuasStop-PAR", "objectID": "LuasStop-PAR",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.35309164558487, "latitude": "53.35309164558487",
"longitude": -6.260360288173493, "longitude": "-6.260360288173493",
"luasStopName": "Parnell", "luasStopName": "Parnell",
"luasStopIrishName": "Sráid Pharnell", "luasStopIrishName": "Sráid Pharnell",
"luasStopCode": "PAR", "luasStopCode": "PAR",
"luasStopLineID": 2, "luasStopLineID": "2"
}, },
{ {
# marlborough
"objectID": "LuasStop-MAR", "objectID": "LuasStop-MAR",
"objectType": "LuasStop", "objectType": "LuasStop",
"latitude": 53.34937746503714, "latitude": "53.34937746503714",
"longitude": -6.257806103514667, "longitude": "-6.257806103514667",
"luasStopName": "Marlborough", "luasStopName": "Marlborough",
"luasStopIrishName": "Maoilbhríde", "luasStopIrishName": "Maoilbhríde",
"luasStopCode": "MAR", "luasStopCode": "MAR",
"luasStopLineID": 2, "luasStopLineID": "2"
},
{
# marlborough
"objectID": "LuasStop-MAR",
"objectType": "LuasStop",
"latitude": 53.34937746503714,
"longitude": -6.257806103514667,
"luasStopName": "Marlborough",
"luasStopIrishName": "Maoilbhríde",
"luasStopCode": "MAR",
"luasStopLineID": 2,
} }
] ]

View File

@ -66,7 +66,7 @@ class TestPermanentData(unittest.TestCase):
mock_get.return_value.content = 'Abbreviation\tName\tIrishName\tLatitude\tLongitude\tStopID\tLineID\tSortOrder\tIsEnabled\tIsParkAndRide\tIsCycleAndRide\tZoneCountA\tZoneCountB\nABB\tAbbey Street\tSráid na Mainistreach\t53.0\t-6.0\t1\t1\t1\ttrue\tfalse\tfalse\t1\t2'.encode('utf-8-sig') mock_get.return_value.content = 'Abbreviation\tName\tIrishName\tLatitude\tLongitude\tStopID\tLineID\tSortOrder\tIsEnabled\tIsParkAndRide\tIsCycleAndRide\tZoneCountA\tZoneCountB\nABB\tAbbey Street\tSráid na Mainistreach\t53.0\t-6.0\t1\t1\t1\ttrue\tfalse\tfalse\t1\t2'.encode('utf-8-sig')
result = fetch_luas() result = fetch_luas()
self.assertEqual(len(result), 1 + 13) self.assertEqual(len(result), 1 + 12)
self.assertEqual(result[0]['luasStopName'], 'Abbey Street') self.assertEqual(result[0]['luasStopName'], 'Abbey Street')
@patch('functions.fetch_permanent_data.lambda_function.session.get') @patch('functions.fetch_permanent_data.lambda_function.session.get')