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
eeb72dc7
Commit
eeb72dc7
authored
Oct 02, 2020
by
Matheus Miranda
Browse files
fix bug for empty objects
parent
bd17f5f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
courses/reports/views.py
courses/reports/views.py
+8
-2
No files found.
courses/reports/views.py
View file @
eeb72dc7
...
@@ -361,12 +361,18 @@ class UserAccessView(views.APIView):
...
@@ -361,12 +361,18 @@ class UserAccessView(views.APIView):
last_login
=
''
last_login
=
''
last_access
=
''
last_access
=
''
last_completed_activity
=
''
accesses_7_days
=
0
accesses_7_days
=
0
accesses_30_days
=
0
accesses_30_days
=
0
if
actions
:
if
actions
:
last_access
=
self
.
format_date
(
actions
.
filter
(
verb
=
'access'
).
last
().
timestamp
)
last_access_obj
=
actions
.
filter
(
verb
=
'access'
).
last
()
last_completed_activity
=
self
.
format_date
(
actions
.
filter
(
verb
=
'answered'
).
order_by
(
'timestamp'
).
last
().
timestamp
)
last_activity_obj
=
actions
.
filter
(
verb
=
'answered'
).
last
()
if
last_access_obj
:
last_access
=
self
.
format_date
(
last_access_obj
.
timestamp
)
if
last_activity_obj
:
last_completed_activity
=
self
.
format_date
(
last_completed_activity_obj
.
timestamp
)
last_login
=
self
.
format_date
(
user
.
last_login
)
last_login
=
self
.
format_date
(
user
.
last_login
)
time_delta
=
timezone
.
now
()
-
timedelta
(
days
=
7
)
time_delta
=
timezone
.
now
()
-
timedelta
(
days
=
7
)
...
...
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