mirror of
https://github.com/Mueller-Patrick/DHBW-Service-App.git
synced 2024-11-22 09:23:57 +00:00
✨ Adding lecturer to lecture plan item detail view
This commit is contained in:
parent
b689a7bbf1
commit
ba0d4da657
|
@ -11,6 +11,7 @@ import CoreData
|
|||
|
||||
@objc(Lecturer)
|
||||
public class Lecturer: NSManagedObject {
|
||||
// MARK: Access methods
|
||||
@nonobjc public class func getAll() -> [Lecturer] {
|
||||
let managedContext =
|
||||
PersistenceController.shared.context
|
||||
|
@ -41,4 +42,13 @@ public class Lecturer: NSManagedObject {
|
|||
return []
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Wrappers
|
||||
public var wrappedName: String {
|
||||
name ?? ""
|
||||
}
|
||||
|
||||
public var wrappedEmail: String {
|
||||
email ?? ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import CoreData
|
|||
|
||||
@objc(RaPlaEvent)
|
||||
public class RaPlaEvent: NSManagedObject {
|
||||
|
||||
// MARK: Access methods
|
||||
@nonobjc public class func getAll() -> [RaPlaEvent] {
|
||||
let managedContext =
|
||||
PersistenceController.shared.context
|
||||
|
@ -41,4 +43,12 @@ public class RaPlaEvent: NSManagedObject {
|
|||
return []
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Wrappers
|
||||
public var lecturerList: [Lecturer] {
|
||||
let set = lecturers as? Set<Lecturer> ?? []
|
||||
return set.sorted {
|
||||
$0.wrappedName < $1.wrappedName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ struct ContentView: View {
|
|||
}
|
||||
.onAppear{
|
||||
// Called upon the opening of the app
|
||||
RaPlaFetcher.getRaplaFileAndSaveToCoreData(from: "https://rapla.dhbw-karlsruhe.de/rapla?page=ical&user=eisenbiegler&file=TINF20B4")
|
||||
RaPlaFetcher.getRaplaFileAndSaveToCoreData(from: "https://rapla.dhbw-karlsruhe.de/rapla?page=ical&user=eisenbiegler&file=TINF19B4")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ struct LecturePlanItem: View {
|
|||
.bold()
|
||||
Text(event.location!)
|
||||
.bold()
|
||||
Text("WIP")
|
||||
Text(!event.lecturerList.isEmpty ? event.lecturerList[0].wrappedName : "")
|
||||
.bold()
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user