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

I wrote a function that should hopefully take care of checking for special...

I wrote a function that should hopefully take care of checking for special schedules.  However, it still seems we are showing the wrong data? I'm exactly sure how or why, granted im not sure who the web api is edited for schedules
parent 9bc712ec
......@@ -42,7 +42,7 @@ class SRCTNetworkController: NSObject {
}
}
print(facilities)
print(facilities)
completion(facilities)
}
......
......@@ -14,13 +14,27 @@ class Utilities: NSObject {
static func isOpen(facility: Facility) -> Bool {
var open = false
if (isSpecialSchedule(facility) == true) {
if (!(facility.specialSchedules?.openTimes.isEmpty)!) {
if let openDay = today(facility: facility) {
let nowTime = time(openTime: openDay)
if(nowTime == true){
open = true
} else {
open = false
}
}
}
} else {
if(!facility.mainSchedule.openTimes.isEmpty) {
if let openDay = today(facility: facility) {
let nowTime = time(openTime: openDay)
if(nowTime == true) {
open = true
} else {
open = false
}
......@@ -28,6 +42,8 @@ class Utilities: NSObject {
} else {
open = false
}
}
// print(facility.mainScheduleprint.name ," is ", open)
return open
}
......@@ -104,5 +120,16 @@ class Utilities: NSObject {
// TODO: Function to check for special schedules.
static func isSpecialSchedule(_ facility: Facility) -> Bool? {
var isSpecial = false
if (facility.specialSchedules == nil) {
isSpecial = false
}
else {
isSpecial = true
}
return isSpecial
}
}
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