Commit 06760b70 authored by Patrick Murray's avatar Patrick Murray
Browse files

added some text for the description lables, its naive and incomplete but its a start.

parent b102a35b
......@@ -26,7 +26,7 @@ class MainTableViewController: UITableViewController {
SRCTNetworkController.performDownload { (facilities) in
self.facilitiesArray = facilities
print(self.facilitiesArray)
// print(self.facilitiesArray)
DispatchQueue.main.async {
self.tableView.reloadData()
}
......@@ -84,6 +84,8 @@ class MainTableViewController: UITableViewController {
cell.openClosedLabel.text="Closed"
cell.openClosedLabel.backgroundColor=UIColor.red
}
cell.timeDescriptionLabel.text = Utilities.timeUntilFacility(facility)
self.reloadInputViews()
return cell
......
......@@ -27,7 +27,7 @@ class Utilities: NSObject {
} else {
open = false
}
print(facility.mainSchedule.name ," is ", open)
// print(facility.mainScheduleprint.name ," is ", open)
return open
}
......@@ -75,15 +75,21 @@ class Utilities: NSObject {
}
//TODO
static func timeUntilCloseOfFacility(_ facility: Facility) -> (hours: Int, minutes: Int)? {
static func timeUntilFacility(_ facility: Facility) -> String? {
//var currentTime = getCurrentTime()
let dateComponentsFormatter = DateComponentsFormatter()
dateComponentsFormatter.allowedUnits = [.year,.month,.weekOfYear,.day,.hour,.minute,.second]
dateComponentsFormatter.maximumUnitCount = 1
dateComponentsFormatter.unitsStyle = .full
if(Utilities.isOpen(facility: facility)) {
return (hours: 0, minutes: 0)
}
else {
return nil
let time = dateComponentsFormatter.string(from: getCurrentTime(), to: (today(facility: facility)?.endTime)!)
return "Open for \(time!)."
} else {
let time = dateComponentsFormatter.string(from: getCurrentTime(), to: (today(facility: facility)?.startTime)!)
return "Opens in \(time!)."
}
}
// TODO: Function to check for special schedules?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment