mirror of
https://github.com/Mueller-Patrick/DHBW-Service-App.git
synced 2026-04-28 18:30:09 +00:00
💄 Updating events list view
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// DateExtension.swift
|
||||
// DHBW-Service
|
||||
//
|
||||
// Created by Patrick Müller on 07.04.21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Date {
|
||||
func get(_ components: Calendar.Component..., calendar: Calendar = Calendar.current) -> DateComponents {
|
||||
return calendar.dateComponents(Set(components), from: self)
|
||||
}
|
||||
|
||||
func get(_ component: Calendar.Component, calendar: Calendar = Calendar.current) -> Int {
|
||||
return calendar.component(component, from: self)
|
||||
}
|
||||
}
|
||||
@@ -264,6 +264,8 @@ class RaPlaFetcher {
|
||||
print("Found unknown frequency: " + event.frequency)
|
||||
}
|
||||
|
||||
// (offsetAmount * iteration) because for the 1st event, we dont want to add an offset, and
|
||||
// for every event after that we want to add e.g. 1 week, 2 weeks, 3 weeks etc.
|
||||
let startDate = Calendar.current.date(byAdding: offsetType, value: (offsetAmount * iteration), to: event.startDate)!
|
||||
let endDate = Calendar.current.date(byAdding: offsetType, value: (offsetAmount * iteration), to: event.endDate)!
|
||||
|
||||
@@ -288,8 +290,6 @@ class RaPlaFetcher {
|
||||
}
|
||||
|
||||
// Populate fields
|
||||
// (offsetAmount * iteration) because for the 1st event, we dont want to add an offset, and
|
||||
// for every event after that we want to add e.g. 1 week, 2 weeks, 3 weeks etc.
|
||||
evt.startDate = startDate
|
||||
evt.endDate = endDate
|
||||
evt.summary = event.summary
|
||||
@@ -298,6 +298,8 @@ class RaPlaFetcher {
|
||||
evt.category = event.category
|
||||
evt.uid = newUID
|
||||
for lecturer in event.lecturers {
|
||||
// TODO: Delete all old lecturer objects
|
||||
|
||||
let lect = Lecturer(context: PersistenceController.shared.context)
|
||||
lect.name = lecturer.name
|
||||
lect.email = lecturer.email
|
||||
|
||||
Reference in New Issue
Block a user