Lascia trasmissibili le partite anche dopo l'orario previsto.
Se l'operatore è in ritardo deve ancora trovare la gara nell'app: restano in hub per tutta la giornata e, nei tornei aperti, fino alla fine dell'evento. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,6 +19,14 @@ enum ApiInstant {
|
||||
return date > now
|
||||
}
|
||||
|
||||
static func isScheduledOnCalendar(_ raw: String?, now: Date = Date()) -> Bool {
|
||||
guard let date = parse(raw) else { return false }
|
||||
var calendar = Calendar(identifier: .gregorian)
|
||||
calendar.timeZone = TimeZone(identifier: "Europe/Rome") ?? .current
|
||||
let startOfToday = calendar.startOfDay(for: now)
|
||||
return date >= startOfToday
|
||||
}
|
||||
|
||||
static func formatMatchDate(_ raw: String?) -> String? {
|
||||
guard let date = parse(raw) else { return nil }
|
||||
let f = DateFormatter()
|
||||
|
||||
@@ -12,13 +12,17 @@ enum MatchHubFilter {
|
||||
}
|
||||
if match.streamCompleted { return false }
|
||||
|
||||
return ApiInstant.isScheduledFuture(match.scheduledAt, now: now)
|
||||
return ApiInstant.isScheduledOnCalendar(match.scheduledAt, now: now)
|
||||
}
|
||||
|
||||
static func isScheduledFuture(_ match: Match, now: Date = Date()) -> Bool {
|
||||
ApiInstant.isScheduledFuture(match.scheduledAt, now: now)
|
||||
}
|
||||
|
||||
static func isOnCalendar(_ match: Match, now: Date = Date()) -> Bool {
|
||||
ApiInstant.isScheduledOnCalendar(match.scheduledAt, now: now)
|
||||
}
|
||||
|
||||
static func isDraft(_ match: Match) -> Bool {
|
||||
!match.hasActiveSession && (match.scheduledAt == nil || match.scheduledAt?.isEmpty == true)
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ struct MatchesScreen: View {
|
||||
}
|
||||
|
||||
private var scheduledMatches: [Match] {
|
||||
matches.filter { !$0.hasActiveSession && MatchHubFilter.isScheduledFuture($0) }
|
||||
matches.filter { !$0.hasActiveSession && !($0.scheduledAt ?? "").isEmpty }
|
||||
}
|
||||
|
||||
private var calendarMatches: [Match] {
|
||||
|
||||
Reference in New Issue
Block a user