Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-ios
Commits
30dd2546
Unverified
Commit
30dd2546
authored
Nov 12, 2017
by
Zach Knox
Browse files
skeleton functions for Filters
No actual logic yet, just planning things out
parent
791ba248
Changes
2
Hide whitespace changes
Inline
Side-by-side
WhatsOpen/WhatsOpen/Filters.swift
View file @
30dd2546
...
...
@@ -10,25 +10,53 @@ import Foundation
//This may be a stupid way to handle filters, but it should work; at least for now
struct
Filters
{
class
Filters
{
var
showOpen
=
true
var
showClosed
=
true
var
sortBy
=
SortMethod
.
alphabetical
var
allAllFacilities
=
true
var
openFirst
=
true
init
()
{
//nothing to do here
}
func
applyFiltersOnFacilities
(
_
facilities
:
[
Facility
])
->
[
Facility
]
{
return
[]
}
// Takes in array of Facilities, separates them into those open and closed, returning a tuple of 2 arrays
private
func
separateOpenAndClosed
(
_
facilities
:
[
Facility
])
->
(
open
:
[
Facility
],
closed
:
[
Facility
])
{
return
([],
[])
}
// Sorts items in the given Facility array by name alphabetically (reverse if told)
private
func
sortAlphabetically
(
_
facilities
:
[
Facility
],
reverse
:
Bool
=
false
)
->
[
Facility
]
{
return
[]
}
// Sorts Facilities by their given location's name, and within those sorts A->Z
private
func
sortByLocation
(
_
facilities
:
[
Facility
])
->
[
Facility
]
{
return
[]
}
}
//Is this a viable way to do this?
enum
SortMethod
{
case
alphabetical
//A -> Z
case
reverseAlphabetical
//Z -> A
case
openLongest
//Places things open longest on top; if only showing closed, shows opening soonest
case
openShortest
//Places things closing soonest on top; if only showing closed, shows opening furthest from now
case
byLocation
// A -> Z Locations, w/ A -> Z Facilities inside
//case openLongest //Places things open longest on top; if only showing closed, shows opening soonest
//case openShortest //Places things closing soonest on top; if only showing closed, shows opening furthest from now
//We should figure out how we want to allow sorting
}
WhatsOpen/WhatsOpen/SRCTUtilities.swift
View file @
30dd2546
...
...
@@ -27,11 +27,10 @@ class Utilities: NSObject {
if
today
(
facility
:
facility
)
!=
nil
{
open
=
time
(
facility
)
}
}
}
}
else
{
open
=
false
}
open
=
false
}
}
return
open
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment