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
9c3c0fa8
Commit
9c3c0fa8
authored
Oct 01, 2020
by
Matheus Miranda
Browse files
Add skip for existent actions
parent
40492ba6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
courses/reports/management/commands/generate_activities_actions.py
...eports/management/commands/generate_activities_actions.py
+8
-4
No files found.
courses/reports/management/commands/generate_activities_actions.py
View file @
9c3c0fa8
...
...
@@ -22,16 +22,20 @@ class Command(BaseCommand):
@
transaction
.
atomic
def
handle
(
self
,
*
args
,
**
options
):
answered_actions_ids
=
Action
.
objects
.
filter
(
verb
=
'answered'
).
values_list
(
'id'
,
flat
=
True
)
answered_actions_ids
=
Action
.
objects
.
filter
(
verb
=
'answered'
).
values_list
(
'action_object_object_id'
,
flat
=
True
)
counter
=
0
# Create any missing Answer action
for
answer
in
Answer
.
objects
.
all
():
answers
=
Answer
.
objects
.
all
()
for
answer
in
answers
:
activity_id
=
answer
.
activity_id
user
=
answer
.
user
verb
=
'answered'
#
if answer.id in answered_actions_ids:
#
continue
if
str
(
answer
.
id
)
in
answered_actions_ids
:
continue
timesince
=
djtimesince
(
answer
.
timestamp
).
encode
(
'utf8'
).
replace
(
b
'
\xc2\xa0
'
,
b
' '
).
decode
(
'utf8'
)
...
...
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