Commit 9a72fc55 authored by Glaucia S. Santos's avatar Glaucia S. Santos
Browse files

Fix for a case of empty units and addition of a new item in complements

parent dd2f1afd
......@@ -58,8 +58,9 @@ class ActionSerializer(serializers.ModelSerializer):
def get_target(self, obj):
if isinstance(obj.target, LearningObject):
if obj.target.unit:
return obj.target.unit.lesson.course.name
if not obj.target.unit:
return ''
return obj.target.unit.lesson.course.name
if isinstance(obj.target, Forum):
return obj.target.title
if isinstance(obj.target, Classroom):
......@@ -137,4 +138,11 @@ class ActionSerializer(serializers.ModelSerializer):
course = 'do curso {}'.format(obj.target.unit.lesson.course.name)
compl = {'atividade': unit, 'etapa': step, 'curso': course}
return compl
if obj.action_object and obj.target:
if isinstance(obj.action_object, Card) and isinstance(obj.target, Classroom):
title = 'o conteúdo {}'.format(obj.action_object.title)
classroom = 'na sala {}'.format(obj.target.name)
compl = {'title': title, 'classroom': classroom, 'curso': ''}
return compl
return ''
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment