Fix: Kalenderwochen-Kalender ausblenden + Überlappungsdarstellung korrigiert
- #weekNum@group.v.calendar.google.com (Kalenderwochen) wird beim Google- Sync, in der Kalenderliste und beim Event-Abruf übersprungen - layoutEvents: fehlende `end`-Variable im zweiten Pass ergänzt; ohne sie war die Bedingung immer false, sodass Spaltenanzahl überlappender Termine falsch berechnet wurde und Termine sich visuell überdeckten
This commit is contained in:
@@ -26,6 +26,11 @@ AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth"
|
|||||||
TOKEN_URL = "https://oauth2.googleapis.com/token"
|
TOKEN_URL = "https://oauth2.googleapis.com/token"
|
||||||
CALENDAR_API = "https://www.googleapis.com/calendar/v3"
|
CALENDAR_API = "https://www.googleapis.com/calendar/v3"
|
||||||
|
|
||||||
|
# System/virtual Google calendars that should never be shown
|
||||||
|
SKIP_GOOGLE_CALENDAR_IDS = {
|
||||||
|
"#weekNum@group.v.calendar.google.com", # Kalenderwochen / Week numbers
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _google_configured() -> bool:
|
def _google_configured() -> bool:
|
||||||
return bool(GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET)
|
return bool(GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET)
|
||||||
@@ -134,6 +139,7 @@ def _account_dict(a: models.GoogleAccount) -> dict:
|
|||||||
"sidebar_hidden": bool(c.sidebar_hidden),
|
"sidebar_hidden": bool(c.sidebar_hidden),
|
||||||
}
|
}
|
||||||
for c in a.calendars
|
for c in a.calendars
|
||||||
|
if c.cal_id not in SKIP_GOOGLE_CALENDAR_IDS
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +154,8 @@ def _sync_google_calendars(account: models.GoogleAccount, db: Session):
|
|||||||
if cal.get("deleted"):
|
if cal.get("deleted"):
|
||||||
continue
|
continue
|
||||||
cal_id = cal["id"]
|
cal_id = cal["id"]
|
||||||
|
if cal_id in SKIP_GOOGLE_CALENDAR_IDS:
|
||||||
|
continue
|
||||||
if cal_id not in existing:
|
if cal_id not in existing:
|
||||||
db.add(models.GoogleCalendar(
|
db.add(models.GoogleCalendar(
|
||||||
account_id=account.id,
|
account_id=account.id,
|
||||||
@@ -373,6 +381,8 @@ def get_google_events(account: models.GoogleAccount, start_dt: datetime, end_dt:
|
|||||||
for gcal in account.calendars:
|
for gcal in account.calendars:
|
||||||
if not gcal.enabled:
|
if not gcal.enabled:
|
||||||
continue
|
continue
|
||||||
|
if gcal.cal_id in SKIP_GOOGLE_CALENDAR_IDS:
|
||||||
|
continue
|
||||||
events_resp = _google_api(token, f"/calendars/{gcal.cal_id}/events", params={
|
events_resp = _google_api(token, f"/calendars/{gcal.cal_id}/events", params={
|
||||||
"timeMin": start_dt.isoformat(),
|
"timeMin": start_dt.isoformat(),
|
||||||
"timeMax": end_dt.isoformat(),
|
"timeMax": end_dt.isoformat(),
|
||||||
|
|||||||
@@ -183,8 +183,6 @@ function layoutEvents(events) {
|
|||||||
|
|
||||||
const result = sorted.map(ev => {
|
const result = sorted.map(ev => {
|
||||||
const start = new Date(ev.start);
|
const start = new Date(ev.start);
|
||||||
const end = new Date(ev.end);
|
|
||||||
|
|
||||||
let placed = false;
|
let placed = false;
|
||||||
for (let c = 0; c < columns.length; c++) {
|
for (let c = 0; c < columns.length; c++) {
|
||||||
const lastInCol = columns[c][columns[c].length - 1];
|
const lastInCol = columns[c][columns[c].length - 1];
|
||||||
@@ -204,6 +202,7 @@ function layoutEvents(events) {
|
|||||||
|
|
||||||
return result.map(ev => {
|
return result.map(ev => {
|
||||||
const start = new Date(ev.start);
|
const start = new Date(ev.start);
|
||||||
|
const end = new Date(ev.end);
|
||||||
let maxCol = ev._col;
|
let maxCol = ev._col;
|
||||||
sorted.forEach(other => {
|
sorted.forEach(other => {
|
||||||
if (other === ev) return;
|
if (other === ev) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user