Skip to content

Commit

Permalink
Fixed #895 - Reformation
Browse files Browse the repository at this point in the history
Signed-off-by: Amr Hossam <[email protected]>
  • Loading branch information
amrhossamdev committed Mar 11, 2024
1 parent 8310216 commit a3052c8
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public static void addToDB(ObaStop stop) {
}

public static void addRouteToDB(Context ctx, ArrivalInfo arrivalInfo){
if (Application.get().getCurrentRegion() == null) return;

ContentValues routeValues = new ContentValues();

String shortName = arrivalInfo.getInfo().getShortName();
Expand All @@ -42,15 +44,14 @@ public static void addRouteToDB(Context ctx, ArrivalInfo arrivalInfo){

routeValues.put(ObaContract.Routes.SHORTNAME, shortName);
routeValues.put(ObaContract.Routes.LONGNAME, longName);
routeValues.put(ObaContract.Routes.REGION_ID, Application.get().getCurrentRegion().getId());

if (Application.get().getCurrentRegion() != null) {
routeValues.put(ObaContract.Routes.REGION_ID,
Application.get().getCurrentRegion().getId());
}
ObaContract.Routes.insertOrUpdate(ctx, arrivalInfo.getInfo().getRouteId(), routeValues, true);
}

public static void addRouteToDB(Context ctx, ObaRoute route){
if (Application.get().getCurrentRegion() == null) return;

ContentValues routeValues = new ContentValues();

String shortName = route.getShortName();
Expand All @@ -62,14 +63,12 @@ public static void addRouteToDB(Context ctx, ObaRoute route){
if (TextUtils.isEmpty(longName) || shortName.equals(longName)) {
longName = route.getDescription();
}

routeValues.put(ObaContract.Routes.SHORTNAME, shortName);
routeValues.put(ObaContract.Routes.LONGNAME, longName);
routeValues.put(ObaContract.Routes.URL, route.getUrl());
routeValues.put(ObaContract.Routes.REGION_ID, Application.get().getCurrentRegion().getId());

if (Application.get().getCurrentRegion() != null) {
routeValues.put(ObaContract.Routes.REGION_ID,
Application.get().getCurrentRegion().getId());
}
ObaContract.Routes.insertOrUpdate(ctx, route.getId(), routeValues, true);
}
}

0 comments on commit a3052c8

Please sign in to comment.