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
18116eab
Commit
18116eab
authored
May 14, 2021
by
Matheus Miranda
Browse files
Update endpoint for user actions
parent
8c4bbbcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
courses/stats/serializers.py
courses/stats/serializers.py
+7
-2
No files found.
courses/stats/serializers.py
View file @
18116eab
...
...
@@ -122,6 +122,11 @@ class ActionSerializer(serializers.ModelSerializer):
return
' a unidade {} na etapa {} do curso {}'
.
format
(
obj
.
title
,
obj
.
lesson
,
obj
.
lesson
.
course
)
return
''
def
get_actor_name
(
self
,
actor
):
if
actor
.
name
:
return
actor
.
name
.
split
()[
0
]
return
actor
.
username
def
get_action_phrase
(
self
,
obj
):
verbs
=
{
'access'
:
'acessou'
,
...
...
@@ -133,7 +138,7 @@ class ActionSerializer(serializers.ModelSerializer):
action_phrase
=
''
action_phrase
+=
obj
.
actor
.
name
.
split
()[
0
]
action_phrase
+=
self
.
get_
actor
_
name
(
obj
.
actor
)
action_phrase
+=
(
' {}'
.
format
(
verbs
.
get
(
obj
.
verb
)))
if
obj
.
action_object
:
...
...
@@ -181,4 +186,4 @@ class ActionSerializer(serializers.ModelSerializer):
course
=
'do curso {}'
.
format
(
obj
.
action_object
.
lesson
.
course
)
compl
=
{
'atividade'
:
unit
,
'etapa'
:
step
,
'curso'
:
course
}
return
compl
return
''
\ No newline at end of file
return
''
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