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
4a6d18d2
Commit
4a6d18d2
authored
May 20, 2015
by
Dennis Jen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated view endpoints to return users_at_start and users_at_end.
parent
2874784f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
analytics_data_api/management/commands/generate_fake_course_data.py
+3
-3
analytics_data_api/v0/models.py
+2
-2
analytics_data_api/v0/serializers.py
+2
-2
analytics_data_api/v0/tests/views/test_courses.py
+6
-6
analytics_data_api/v0/views/courses.py
+2
-2
No files found.
analytics_data_api/management/commands/generate_fake_course_data.py
View file @
4a6d18d2
...
@@ -174,11 +174,11 @@ class Command(BaseCommand):
...
@@ -174,11 +174,11 @@ class Command(BaseCommand):
models
.
Video
.
objects
.
all
()
.
delete
()
models
.
Video
.
objects
.
all
()
.
delete
()
logger
.
info
(
"Generating new course videos..."
)
logger
.
info
(
"Generating new course videos..."
)
start_views
=
1234
users_at_start
=
1234
models
.
Video
.
objects
.
create
(
course_id
=
course_id
,
pipeline_video_id
=
video_id
,
models
.
Video
.
objects
.
create
(
course_id
=
course_id
,
pipeline_video_id
=
video_id
,
encoded_module_id
=
module_id
,
duration
=
500
,
segment_length
=
5
,
encoded_module_id
=
module_id
,
duration
=
500
,
segment_length
=
5
,
start_views
=
start_views
,
users_at_start
=
users_at_start
,
end_views
=
random
.
randint
(
100
,
start_views
))
users_at_end
=
random
.
randint
(
100
,
users_at_start
))
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
course_id
=
'edX/DemoX/Demo_Course'
course_id
=
'edX/DemoX/Demo_Course'
...
...
analytics_data_api/v0/models.py
View file @
4a6d18d2
...
@@ -200,8 +200,8 @@ class Video(BaseVideo):
...
@@ -200,8 +200,8 @@ class Video(BaseVideo):
encoded_module_id
=
models
.
CharField
(
db_index
=
True
,
max_length
=
255
)
encoded_module_id
=
models
.
CharField
(
db_index
=
True
,
max_length
=
255
)
duration
=
models
.
IntegerField
()
duration
=
models
.
IntegerField
()
segment_length
=
models
.
IntegerField
()
segment_length
=
models
.
IntegerField
()
start_views
=
models
.
IntegerField
()
users_at_start
=
models
.
IntegerField
()
end_views
=
models
.
IntegerField
()
users_at_end
=
models
.
IntegerField
()
class
Meta
(
BaseVideo
.
Meta
):
class
Meta
(
BaseVideo
.
Meta
):
db_table
=
'video'
db_table
=
'video'
analytics_data_api/v0/serializers.py
View file @
4a6d18d2
...
@@ -289,8 +289,8 @@ class VideoSerializer(ModelSerializerWithCreatedField):
...
@@ -289,8 +289,8 @@ class VideoSerializer(ModelSerializerWithCreatedField):
'encoded_module_id'
,
'encoded_module_id'
,
'duration'
,
'duration'
,
'segment_length'
,
'segment_length'
,
'
start_views
'
,
'
users_at_start
'
,
'
end_views
'
,
'
users_at_end
'
,
'created'
'created'
)
)
...
...
analytics_data_api/v0/tests/views/test_courses.py
View file @
4a6d18d2
...
@@ -661,14 +661,14 @@ class CourseVideosListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
...
@@ -661,14 +661,14 @@ class CourseVideosListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
created
=
datetime
.
datetime
.
utcnow
()
created
=
datetime
.
datetime
.
utcnow
()
date_time_format
=
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
date_time_format
=
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
G
(
models
.
Video
,
course_id
=
self
.
course_id
,
encoded_module_id
=
module_id
,
G
(
models
.
Video
,
course_id
=
self
.
course_id
,
encoded_module_id
=
module_id
,
pipeline_video_id
=
video_id
,
duration
=
100
,
segment_length
=
1
,
start_views
=
50
,
end_views
=
10
,
pipeline_video_id
=
video_id
,
duration
=
100
,
segment_length
=
1
,
users_at_start
=
50
,
users_at_end
=
10
,
created
=
created
.
strftime
(
date_time_format
))
created
=
created
.
strftime
(
date_time_format
))
alt_module_id
=
'i4x-test-video-2'
alt_module_id
=
'i4x-test-video-2'
alt_video_id
=
'a1d30'
alt_video_id
=
'a1d30'
alt_created
=
created
+
datetime
.
timedelta
(
seconds
=
10
)
alt_created
=
created
+
datetime
.
timedelta
(
seconds
=
10
)
G
(
models
.
Video
,
course_id
=
self
.
course_id
,
encoded_module_id
=
alt_module_id
,
G
(
models
.
Video
,
course_id
=
self
.
course_id
,
encoded_module_id
=
alt_module_id
,
pipeline_video_id
=
alt_video_id
,
duration
=
200
,
segment_length
=
5
,
start_views
=
1050
,
end_views
=
50
,
pipeline_video_id
=
alt_video_id
,
duration
=
200
,
segment_length
=
5
,
users_at_start
=
1050
,
users_at_end
=
50
,
created
=
alt_created
.
strftime
(
date_time_format
))
created
=
alt_created
.
strftime
(
date_time_format
))
expected
=
[
expected
=
[
...
@@ -677,8 +677,8 @@ class CourseVideosListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
...
@@ -677,8 +677,8 @@ class CourseVideosListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
'encoded_module_id'
:
module_id
,
'encoded_module_id'
:
module_id
,
'pipeline_video_id'
:
video_id
,
'pipeline_video_id'
:
video_id
,
'segment_length'
:
1
,
'segment_length'
:
1
,
'
start_views
'
:
50
,
'
users_at_start
'
:
50
,
'
end_views
'
:
10
,
'
users_at_end
'
:
10
,
'created'
:
created
.
strftime
(
settings
.
DATETIME_FORMAT
)
'created'
:
created
.
strftime
(
settings
.
DATETIME_FORMAT
)
},
},
{
{
...
@@ -686,8 +686,8 @@ class CourseVideosListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
...
@@ -686,8 +686,8 @@ class CourseVideosListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
'encoded_module_id'
:
alt_module_id
,
'encoded_module_id'
:
alt_module_id
,
'pipeline_video_id'
:
alt_video_id
,
'pipeline_video_id'
:
alt_video_id
,
'segment_length'
:
5
,
'segment_length'
:
5
,
'
start_views
'
:
1050
,
'
users_at_start
'
:
1050
,
'
end_views
'
:
50
,
'
users_at_end
'
:
50
,
'created'
:
alt_created
.
strftime
(
settings
.
DATETIME_FORMAT
)
'created'
:
alt_created
.
strftime
(
settings
.
DATETIME_FORMAT
)
}
}
]
]
...
...
analytics_data_api/v0/views/courses.py
View file @
4a6d18d2
...
@@ -695,8 +695,8 @@ class VideosListView(BaseCourseView):
...
@@ -695,8 +695,8 @@ class VideosListView(BaseCourseView):
* encoded_module_id: The encoded module ID.
* encoded_module_id: The encoded module ID.
* duration: The length of the video in seconds.
* duration: The length of the video in seconds.
* segment_length: The length of each segment of the video in seconds.
* segment_length: The length of each segment of the video in seconds.
*
start_views: The number of view
s at the start of the video.
*
users_at_start: The number of viewer
s at the start of the video.
*
end_views: The number of view
s at the end of the video.
*
users_at_end: The number of viewer
s at the end of the video.
* created: The date the video data was updated.
* created: The date the video data was updated.
"""
"""
...
...
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