more AI optimizations, reworked logger

This commit is contained in:
2025-10-09 12:35:15 +02:00
parent 7e07bdea0c
commit 3cc6e793d2
22 changed files with 186 additions and 320 deletions

View File

@@ -18,16 +18,8 @@ from __future__ import annotations
import datetime
import re
import sys
import loguru
from src import LOG_DIR
log = loguru.logger
log.remove()
log.add(sys.stdout, level="INFO")
log.add(f"{LOG_DIR}/application.log", rotation="1 MB", retention="10 days")
from src.shared.logging import log
class Semester:
@@ -124,21 +116,22 @@ class Semester:
# ------------------------------------------------------------------
# Comparison helpers
# ------------------------------------------------------------------
def isPastSemester(self, other: "Semester") -> bool:
if self.year < other.year:
def isPastSemester(self, current: "Semester") -> bool:
log.debug(f"Comparing {self} < {current}")
if self.year < current.year:
return True
if self.year == other.year:
if self.year == current.year:
return (
self.semester == "WiSe" and other.semester == "SoSe"
self.semester == "WiSe" and current.semester == "SoSe"
) # WiSe before next SoSe
return False
def isFutureSemester(self, other: "Semester") -> bool:
if self.year > other.year:
def isFutureSemester(self, current: "Semester") -> bool:
if self.year > current.year:
return True
if self.year == other.year:
if self.year == current.year:
return (
self.semester == "SoSe" and other.semester == "WiSe"
self.semester == "SoSe" and current.semester == "WiSe"
) # SoSe after WiSe of same year
return False