Skip to content

Commit

Permalink
fix empty lesson info paragraphs/messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Belissimo-T committed Jun 12, 2024
1 parent accf569 commit 28f4fc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/lesson_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def from_str(cls, paragraph: str, lesson: models.Lesson, index: int,
plan_type: typing.Literal["forms", "teachers", "rooms"]) -> LessonInfoParagraph:
messages = [
LessonInfoMessage.from_str(message.strip(), lesson, i, plan_type)
for i, message in enumerate(paragraph.split(","))
for i, message in enumerate(paragraph.split(",")) if message.strip()
]
new_messages = []
for message in messages:
Expand Down Expand Up @@ -620,7 +620,7 @@ def from_str(cls, info: str, lesson: models.Lesson, plan_type: typing.Literal["f
) -> ParsedLessonInfo:
return cls([
LessonInfoParagraph.from_str(paragraph.strip(), lesson, i, plan_type)
for i, paragraph in enumerate(info.split(";"))
for i, paragraph in enumerate(info.split(";")) if paragraph.strip()
])

def serialize(self, lesson_date: datetime.date) -> list:
Expand Down

0 comments on commit 28f4fc0

Please sign in to comment.