Skip to content

Commit

Permalink
time processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronan committed Feb 19, 2020
1 parent f966f32 commit fb1e947
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Arrival-iOS2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.20;
MARKETING_VERSION = 1.21;
PRODUCT_BUNDLE_IDENTIFIER = com.ronanfuruta.arrival;
PRODUCT_NAME = Arrival;
SWIFT_VERSION = 5.0;
Expand All @@ -525,7 +525,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.20;
MARKETING_VERSION = 1.21;
PRODUCT_BUNDLE_IDENTIFIER = com.ronanfuruta.arrival;
PRODUCT_NAME = Arrival;
SWIFT_VERSION = 5.0;
Expand Down
11 changes: 6 additions & 5 deletions Arrival-iOS2/AppData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import FirebasePerformance
import FirebaseAnalytics
import FirebaseRemoteConfig
import FirebaseCrashlytics
let dateFormate = "hh:mm A"
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let context = appDelegate.persistentContainer.viewContext
let baseURL = "https://api.arrival.city"
Expand Down Expand Up @@ -561,13 +562,13 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
if (i != 0) {
let lastTrainString = thisTrain["leg"][i - 1]["@destTimeMin"].stringValue
let originTimeString = leg["@origTimeMin"].stringValue
let lastTrainTime = moment(lastTrainString, "HH:mm")
let originTime = moment(originTimeString, "HH:mm")
let lastTrainTime = moment(lastTrainString, "hh:mm")
let originTime = moment(originTimeString, "hh:mm")
let difference = originTime.diff(lastTrainTime, "minutes")
transferWait = difference.stringValue + " min"
print(lastTrainTime.format(), originTime.format(), difference, transferWait, "transfer wait")
}
let enrouteTime = moment(leg["@destTimeMin"].stringValue, "HH:mm").diff(moment(leg["@origTimeMin"].stringValue, "HH:mm"), "minutes")
let enrouteTime = moment(leg["@destTimeMin"].stringValue, "hh:mm A").diff(moment(leg["@origTimeMin"].stringValue, "hh:mm"), "minutes")
let enrouteTimeString = enrouteTime.stringValue + "min"

// print(routeJSON.dictionaryObject, "route for route", routeNum, "color", routeJSON["color"].stringValue)
Expand All @@ -582,7 +583,7 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
//let color = thisTrain["color"].stringValue
let color = "none"
print(eta)
let originTime = moment(thisTrain["@origTimeMin"].stringValue, "HH:mm")
let originTime = moment(thisTrain["@origTimeMin"].stringValue, "hh:mm")
let now = moment()
let difference = originTime.diff(now, "minutes").intValue
results.append(Train(id: UUID(), direction: direction, time: etd, unit: "", color: "none", cars: 0, hex: "0", eta: eta))
Expand All @@ -600,7 +601,7 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
self.cycleTrace!.stop()
} else {
self.loaded = true
self.noTrains = true
self.noTrains = true
self.cycleTrace!.stop()
}
}
Expand Down
6 changes: 3 additions & 3 deletions Arrival-iOS2/TripDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ struct TripDetailView: View {


}.edgesIgnoringSafeArea(.bottom).padding().onAppear {
let originTIme = moment(self.tripToShow.originTime, "HH:mm")
let destinationTIme = moment(self.tripToShow.destinatonTime, "HH:mm")
let originTIme = moment(self.tripToShow.originTime, "hh:mm")
let destinationTIme = moment(self.tripToShow.destinatonTime, "hh:mm")
let routeTime = destinationTIme.diff(originTIme, "minutes")
let boardTime = moment(self.tripToShow.legs[0].originTime, "HH:mm")
let boardTime = moment(self.tripToShow.legs[0].originTime, "hh:mm")
self.boardWait = boardTime.fromNow(true)
print(routeTime, destinationTIme.format(), originTIme.format(), "route time", wait)
self.routeTime = routeTime.stringValue + "min"
Expand Down

0 comments on commit fb1e947

Please sign in to comment.