Commit a3baf8e6 authored by Eyad Hasan's avatar Eyad Hasan
Browse files

I have the basic idea down on what the function needs to do for stuff to work,...

I have the basic idea down on what the function needs to do for stuff to work, primary issue is trying to figure out why it crashes when I'm scrolling
parent 041ad795
......@@ -55,15 +55,14 @@ class MainTableViewController: UITableViewController {
cell.nameLabel.text = facility.name
let open = Utilities.isOpen(facility: facility);
if(open == true)
{
// Label change is just for testing, we can adjust it later.
cell.openClosedLabel.text = "OPEN"
}else{
cell.openClosedLabel.text = "CLOSED"
if(indexPath.row >= 0){
if(open == true){
cell.openClosedLabel.text="Open"
}else{
cell.openClosedLabel.text="Closed"
}
}
self.reloadInputViews()
return cell
}
......
......@@ -15,14 +15,16 @@ class Utilities: NSObject {
static func isOpen(facility: Facility) -> Bool {
let currentDay = getDayOfWeek()
var time = getCurrentTime()
let closedOpen = open(weekDay: currentDay!, facility: facility)
//print(time!)
//print (currentDay!)
//print(facility.mainSchedule.openTimes[currentDay!].startDay)
let time = getCurrentTime()
return closedOpen
if(facility.mainSchedule.openTimes.isEmpty || facility.mainSchedule.openTimes.count < currentDay!){
return false
} else {
if(time >= facility.mainSchedule.openTimes[currentDay!].startTime && time <= facility.mainSchedule.openTimes[currentDay!].endTime){
return true
}
}
return true
}
static func getDayOfWeek()->Int? {
......@@ -44,15 +46,4 @@ class Utilities: NSObject {
return currentDay!
}
static func open(weekDay: Int, facility: Facility) -> Bool{
let start = facility.mainSchedule.openTimes[weekDay].startTime
let end = facility.mainSchedule.openTimes[weekDay].endTime
let time = getCurrentTime()
if(time >= start && time <= end){
return true
}else{
return false
}
}
}
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