Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
9a72fc55
Commit
9a72fc55
authored
Jan 11, 2021
by
Glaucia S. Santos
Browse files
Fix for a case of empty units and addition of a new item in complements
parent
dd2f1afd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
courses/stats/serializers.py
courses/stats/serializers.py
+10
-2
No files found.
courses/stats/serializers.py
View file @
9a72fc55
...
...
@@ -58,7 +58,8 @@ class ActionSerializer(serializers.ModelSerializer):
def
get_target
(
self
,
obj
):
if
isinstance
(
obj
.
target
,
LearningObject
):
if
obj
.
target
.
unit
:
if
not
obj
.
target
.
unit
:
return
''
return
obj
.
target
.
unit
.
lesson
.
course
.
name
if
isinstance
(
obj
.
target
,
Forum
):
return
obj
.
target
.
title
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment