Skip to content

Commit 4194627

Browse files
committed
Round coordinates to 5dp (reduce floating point errors
1 parent b14edef commit 4194627

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jolpica_api/ergastapi/serializers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class CircuitSerializer(ErgastModelSerializer):
4444

4545
def get_location(self, circuit: Circuit) -> dict:
4646
return {
47-
"lat": str(circuit.location.y) if circuit.location else None,
48-
"long": str(circuit.location.x) if circuit.location else None,
47+
"lat": f"{circuit.location.y:.05f}" if circuit.location else None,
48+
"long": f"{circuit.location.x:.05f}" if circuit.location else None,
4949
"locality": circuit.locality,
5050
"country": circuit.country,
5151
}

0 commit comments

Comments
 (0)