Fix dashboard map bug when rider has no assigned hub #270
This commit is contained in:
parent
494ae85467
commit
2f3e8df6d4
1 changed files with 10 additions and 7 deletions
|
|
@ -38,15 +38,18 @@ class RiderTracker
|
||||||
$long = $this->redis->hget($key, 'longitude');
|
$long = $this->redis->hget($key, 'longitude');
|
||||||
$lat = $this->redis->hget($key, 'latitude');
|
$lat = $this->redis->hget($key, 'latitude');
|
||||||
|
|
||||||
$coordinates = new Point($long, $lat);
|
return new Point($long, $lat);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$rider = $this->em->getRepository(Rider::class)->find($rider_id);
|
|
||||||
$coordinates = $rider->getHub()->getCoordinates();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $coordinates;
|
// not in cache, get hub
|
||||||
|
$rider = $this->em->getRepository(Rider::class)->find($rider_id);
|
||||||
|
$hub = $rider->getHub();
|
||||||
|
|
||||||
|
// no hub
|
||||||
|
// TODO: return valid coordinate
|
||||||
|
if ($hub == null)
|
||||||
|
return new Point(0, 0);
|
||||||
|
|
||||||
|
return $hub->getCoordinates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue