diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-02-17 20:50:17 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-02-17 20:50:17 +0000 |
commit | 190cb3c6a16d6c65764f18afd5f5f19f1a912aac (patch) | |
tree | bbc997b60a30ea92568142db57de897c9ca49c16 /src/net/cbaines/suma/DataManager.java | |
parent | fd428ee33771a7bf95abad4d2e7beb882a368d41 (diff) | |
download | southamptonuniversitymap-190cb3c6a16d6c65764f18afd5f5f19f1a912aac.tar southamptonuniversitymap-190cb3c6a16d6c65764f18afd5f5f19f1a912aac.tar.gz |
Fixed a bug with dest stop detection, and added a safeguard on the bus activity.
Diffstat (limited to 'src/net/cbaines/suma/DataManager.java')
-rw-r--r-- | src/net/cbaines/suma/DataManager.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index f065b07..4959865 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -433,6 +433,9 @@ public class DataManager { helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); if (busRouteDao == null) busRouteDao = helper.getBusRouteDao(); + Dao<RouteStops, Integer> routeStopsDao = null; + if (routeStopsDao == null) + routeStopsDao = helper.getRouteStopsDao(); if (busDao == null) busDao = helper.getBusDao(); if (busStopDao == null) @@ -513,13 +516,11 @@ public class DataManager { BusStop destStop = null; if (destString.equals("Central Station")) { - destStop = busStopDao.queryForId("SNA19709"); + destStop = busStopDao.queryForId("SN120520"); } else if (destString.equals("Civic Centre")) { destStop = busStopDao.queryForId("SN120527"); } else if (destString.equals("City DG4")) { destStop = busStopDao.queryForId("HAA13579"); - } else if (destString.equals("Central Station")) { - destStop = busStopDao.queryForId("SN120520"); } else if (destString.equals("Airport")) { destStop = busStopDao.queryForId("HA030184"); } else if (destString.equals("City, Town Quay")) { @@ -540,6 +541,13 @@ public class DataManager { Log.e(TAG, "Unknown end dest " + destString + " for route " + route.code); } + QueryBuilder<RouteStops, Integer> routeStopsQueryBuilder = routeStopsDao.queryBuilder(); + routeStopsQueryBuilder.where().eq(RouteStops.ROUTE_ID_FIELD_NAME, route.id).and().eq(RouteStops.STOP_ID_FIELD_NAME, destStop.id); + PreparedQuery<RouteStops> routeStopsPreparedQuery = routeStopsQueryBuilder.prepare(); + + List<RouteStops> routeStops = routeStopsDao.query(routeStopsPreparedQuery); + Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + route.code); + Date now = new Date(System.currentTimeMillis()); String busID = null; |