Skip to content

Commit

Permalink
Fix timeplace glitch while searching (#325)
Browse files Browse the repository at this point in the history
Fix glitch while searching
  • Loading branch information
peng-u-0807 authored Jan 15, 2025
1 parent b94157e commit e21e431
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions SNUTT-2022/SNUTT/Models/Lecture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,15 @@ struct Lecture: Identifiable {
if timePlaces.isEmpty {
return ""
}
let places = timePlaces
.compactMap { $0.place.isEmpty ? nil : $0.place }
.reduce(into: Set<String>()) { $0.insert($1) }
var places: [String] = []
timePlaces
.sorted { $0.day.rawValue < $1.day.rawValue && $0.startMinute < $1.startMinute }
.compactMap { $0.place == " " ? nil : $0.place }
.forEach { place in
if !places.contains(where: { $0 == place }) {
places.append(place)
}
}
if places.isEmpty {
return ""
}
Expand Down

0 comments on commit e21e431

Please sign in to comment.