Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-analytics-data-api
Commits
95547969
Commit
95547969
authored
Aug 05, 2014
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11 from edx/serializer-fix
Updated CourseActivityByWeekSerializer
parents
f639f704
9f58673f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
analytics_data_api/v0/serializers.py
+13
-0
analytics_data_api/v0/tests/test_views.py
+2
-2
No files found.
analytics_data_api/v0/serializers.py
View file @
95547969
...
@@ -11,6 +11,19 @@ class CourseActivityByWeekSerializer(serializers.ModelSerializer):
...
@@ -11,6 +11,19 @@ class CourseActivityByWeekSerializer(serializers.ModelSerializer):
particular record is likely to change unexpectedly so we avoid exposing it.
particular record is likely to change unexpectedly so we avoid exposing it.
"""
"""
activity_type
=
serializers
.
SerializerMethodField
(
'get_activity_type'
)
def
get_activity_type
(
self
,
obj
):
"""
Lower-case activity type and change active to any.
"""
activity_type
=
obj
.
activity_type
.
lower
()
if
activity_type
==
'active'
:
activity_type
=
'any'
return
activity_type
class
Meta
(
object
):
class
Meta
(
object
):
model
=
models
.
CourseActivityByWeek
model
=
models
.
CourseActivityByWeek
fields
=
(
'interval_start'
,
'interval_end'
,
'activity_type'
,
'count'
,
'course_id'
)
fields
=
(
'interval_start'
,
'interval_end'
,
'activity_type'
,
'count'
,
'course_id'
)
...
...
analytics_data_api/v0/tests/test_views.py
View file @
95547969
...
@@ -43,11 +43,11 @@ class CourseActivityLastWeekTest(TestCaseWithAuthentication):
...
@@ -43,11 +43,11 @@ class CourseActivityLastWeekTest(TestCaseWithAuthentication):
'course_id'
:
'edX/DemoX/Demo_Course'
,
'course_id'
:
'edX/DemoX/Demo_Course'
,
'interval_start'
:
datetime
.
datetime
(
2014
,
5
,
24
,
0
,
0
,
tzinfo
=
pytz
.
utc
),
'interval_start'
:
datetime
.
datetime
(
2014
,
5
,
24
,
0
,
0
,
tzinfo
=
pytz
.
utc
),
'interval_end'
:
datetime
.
datetime
(
2014
,
6
,
1
,
0
,
0
,
tzinfo
=
pytz
.
utc
),
'interval_end'
:
datetime
.
datetime
(
2014
,
6
,
1
,
0
,
0
,
tzinfo
=
pytz
.
utc
),
'activity_type'
:
'
ACTIVE
'
,
'activity_type'
:
'
any
'
,
'count'
:
300
,
'count'
:
300
,
}
}
default
.
update
(
kwargs
)
default
.
update
(
kwargs
)
default
[
'activity_type'
]
=
default
[
'activity_type'
]
.
upp
er
()
default
[
'activity_type'
]
=
default
[
'activity_type'
]
.
low
er
()
return
default
return
default
def
test_activity_auth
(
self
):
def
test_activity_auth
(
self
):
...
...
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