Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #23: year search query format is relaxed #30

Merged
merged 2 commits into from
May 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions WWDC/VideosViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,14 @@ class VideosViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
var qualifiers = term.qualifierSearchParser_parseQualifiers(["year", "focus", "track", "downloaded"])
indexOfLastSelectedRow = -1
return sessions.filter { session in

if let year: String = qualifiers["year"] as? String {
if session.year != year.toInt() {
return false
}
let yearStr = "\(session.year)"
let result = (yearStr as NSString).rangeOfString(year, options: .CaseInsensitiveSearch)
if result.location + result.length == count(yearStr) {
return true
}
return false
}

if let focus: String = qualifiers["focus"] as? String {
Expand Down