Commit 4b83b658 authored by Zach Knox's avatar Zach Knox
Browse files

Open items show up first

Not computationally the most efficient way, but it works!
parent 26ed1fa4
......@@ -47,11 +47,30 @@ class MainTableViewController: UITableViewController {
return facilitiesArray.count
//Returns an array which has the open locations listed first
//Could be improved in the future because currently this means you're checking
//open status twice per cell
func placeOpenFacilitiesFirstInArray(_ facilitiesArray: Array<Facility>) -> [Facility] {
var open = [Facility]()
var closed = [Facility]()
for i in facilitiesArray {
if(Utilities.isOpen(facility: i)) {
else {
return open + closed
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! SRCTSimpleTableViewCell
let facility = facilitiesArray[indexPath.row]
let dataArray = placeOpenFacilitiesFirstInArray(facilitiesArray)
let facility = dataArray[indexPath.row]
cell.nameLabel.text =
//TODO: Organize based on if a location is open.
let open = Utilities.isOpen(facility: facility);
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