ENCOA-255 gpt was grouping parts by sections and the reading passages were not updated with text.content instead of the old context field
This commit is contained in:
@@ -5,7 +5,7 @@ from pydantic import ValidationError
|
||||
from app.dtos.exams.level import (
|
||||
MultipleChoiceExercise,
|
||||
FillBlanksExercise,
|
||||
Part, Exam
|
||||
Part, Exam, Text
|
||||
)
|
||||
from app.dtos.sheet import Sheet, Option, MultipleChoiceQuestion, FillBlanksWord
|
||||
|
||||
@@ -17,7 +17,7 @@ class LevelMapper:
|
||||
parts = []
|
||||
for part in response['parts']:
|
||||
part_exercises = part['exercises']
|
||||
context = part.get('context', None)
|
||||
text = part.get('text', None)
|
||||
|
||||
exercises = []
|
||||
for exercise in part_exercises:
|
||||
@@ -32,8 +32,13 @@ class LevelMapper:
|
||||
exercises.append(exercise_model)
|
||||
|
||||
part_kwargs = {"exercises": exercises}
|
||||
if context is not None:
|
||||
part_kwargs["context"] = context
|
||||
if text is not None and text.get('content', None):
|
||||
title = text.get('title', 'Untitled')
|
||||
if title == '':
|
||||
title = 'Untitled'
|
||||
part_kwargs["text"] = Text(title=title, content=text['content'])
|
||||
else:
|
||||
part_kwargs["text"] = None
|
||||
|
||||
part_model = Part(**part_kwargs)
|
||||
parts.append(part_model)
|
||||
|
||||
Reference in New Issue
Block a user