From 0b3af716a5fecc97df1a63a1b4625567316f6a1f Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 10 Dec 2023 22:50:53 +0800 Subject: [PATCH] limit studying to within 250m of the center of ustp --- src/routes/Home/Home.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx index 4197170..ea7a5a1 100644 --- a/src/routes/Home/Home.tsx +++ b/src/routes/Home/Home.tsx @@ -93,8 +93,8 @@ export default function Home() { } useEffect(() => { - console.log("changed"); - console.log(locationPermitted); + // console.log("Location Update"); + // console.log(locationPermitted); requestLocation(); }, [locationPermitted]); @@ -112,7 +112,7 @@ export default function Home() { let dist = GetDistanceFromUSTP(location.coords); setDist(dist); // Deactivate student status if too far away from USTP and still studying - if (dist >= 2 && !map_distance_override && studying && !stopping_toofar) { + if (dist >= 1 && !map_distance_override && studying && !stopping_toofar) { stop_studying.mutate({ active: false, }); @@ -154,14 +154,7 @@ export default function Home() { location.coords.latitude, location.coords.longitude ); - console.log("Distance:", dist); - console.log( - student_status.location.latitude, - student_status.location.longitude, - location.coords.latitude, - location.coords.longitude - ); - if (dist > 0.02 && studying && !stopping_toofar) { + if (dist > 0.5 && studying && !stopping_toofar) { console.log("Too far from current studying location"); stop_studying.mutate({ active: false, @@ -427,7 +420,7 @@ export default function Home() { ); } else if (dist && location) { - if (dist <= 1 || map_distance_override) { + if (dist <= 0.25 || map_distance_override) { return ( <>