Remove unused 'id' field from Lesson model and adjust timetable database creation accordingly
This commit is contained in:
parent
3375138de0
commit
5fb0994017
2 changed files with 0 additions and 3 deletions
|
@ -17,7 +17,6 @@ from pydantic import BaseModel
|
||||||
# TODO: Add a model for the substitutions
|
# TODO: Add a model for the substitutions
|
||||||
|
|
||||||
class Lesson(BaseModel):
|
class Lesson(BaseModel):
|
||||||
id: int
|
|
||||||
position : int
|
position : int
|
||||||
date: date
|
date: date
|
||||||
room: str | None
|
room: str | None
|
||||||
|
@ -31,7 +30,6 @@ class Lesson(BaseModel):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_hebe_dict(data: dict):
|
def from_hebe_dict(data: dict):
|
||||||
return Lesson(
|
return Lesson(
|
||||||
id=data["Id"],
|
|
||||||
position = data["TimeSlot"]["Position"],
|
position = data["TimeSlot"]["Position"],
|
||||||
date=datetime.fromtimestamp(data["Date"]["Timestamp"] / 1000),
|
date=datetime.fromtimestamp(data["Date"]["Timestamp"] / 1000),
|
||||||
room=data["Room"]["Code"],
|
room=data["Room"]["Code"],
|
||||||
|
|
|
@ -65,7 +65,6 @@ def create_timetable_database(timetable_list):
|
||||||
session.execute(delete(Timetable))
|
session.execute(delete(Timetable))
|
||||||
for lesson in timetable_list:
|
for lesson in timetable_list:
|
||||||
lesson_obj = Timetable(
|
lesson_obj = Timetable(
|
||||||
lid=lesson.id,
|
|
||||||
position = lesson.position,
|
position = lesson.position,
|
||||||
date=lesson.date,
|
date=lesson.date,
|
||||||
room=lesson.room,
|
room=lesson.room,
|
||||||
|
|
Loading…
Add table
Reference in a new issue