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

[WIP] Support remote events in 2021 #966

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
32 changes: 31 additions & 1 deletion Packages/TBAData/Sources/TBAData/Event/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum EventType: Int, CaseIterable {
case championshipFinals = 4
case districtChampionshipDivision = 5
case festivalOfChampions = 6
case remote = 7
case offseason = 99
case preseason = 100
case unlabeled = -1
Expand Down Expand Up @@ -248,7 +249,8 @@ extension Event {
}

if eventType == .championshipDivision || eventType == .championshipFinals {
if self.year >= 2017, let city = city {
// 2021 was remote - only had one CMP
if (self.year >= 2017 && year != 2021), let city = city {
return "Championship - \(city)"
}
return "Championship"
Expand Down Expand Up @@ -280,6 +282,21 @@ extension Event {
return "Week 0.5"
}
return "Week \(week)"
} else if year == 2021 {
/**
* Group 2021 Events by their type - depends on both
*/
if week == 0 {
return "Participation"
} else if week == 6 {
return "FIRST Innovation Challenge"
} else if week == 7 {
return "INFINITE RECHARGE At Home Challenge"
} else if week == 8 {
return "Game Design Challenge"
} else {
return "Awards"
}
}
return "Week \(week + 1)"
}
Expand Down Expand Up @@ -387,6 +404,16 @@ extension Event {
return eventType == .festivalOfChampions
}

/**
If the event is a remote event.
*/
public var isRemote: Bool {
guard let eventType = eventType else {
return false
}
return eventType == .remote
}

/**
If the event is a preseason event.
*/
Expand Down Expand Up @@ -1225,6 +1252,9 @@ extension Event {
let monthString = String(format: "%02d", month)
return "\(eventType).\(monthString)"
}
if eventType == EventType.remote.rawValue {
return "\(EventType.regional.rawValue).\(eventType)"
}
return "\(eventType)"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ class EventsViewController: TBATableViewController, Refreshable, Stateful, Event
return "Preseason Events"
} else if event.isRegional {
return "Regional Events"
} else if event.isRemote {
return event.weekString
}
return "Unknown Events"
}
Expand Down
Loading