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
b23464c7
Commit
b23464c7
authored
Jan 17, 2017
by
Tyler Hallada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add no-videos option to fake data, use for Travis
parent
e6235e51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
Makefile
+1
-1
analytics_data_api/management/commands/generate_fake_course_data.py
+24
-9
No files found.
Makefile
View file @
b23464c7
...
...
@@ -70,4 +70,4 @@ demo: clean requirements loaddata
travis
:
clean test.requirements migrate
python manage.py set_api_key edx edx
python manage.py loaddata problem_response_answer_distribution
--database
=
analytics
python manage.py generate_fake_course_data
--num-weeks
=
1
python manage.py generate_fake_course_data
--num-weeks
=
1
--no-videos
analytics_data_api/management/commands/generate_fake_course_data.py
View file @
b23464c7
...
...
@@ -58,6 +58,13 @@ class Command(BaseCommand):
default
=
'ed_xavier'
,
help
=
'Username for which to generate fake data'
,
)
parser
.
add_argument
(
'--no-videos'
,
action
=
'store_false'
,
dest
=
'videos'
,
default
=
True
,
help
=
'Disables pulling video ids from the LMS server to generate fake video data and instead uses fake ids.'
)
def
generate_daily_data
(
self
,
course_id
,
start_date
,
end_date
):
# Use the preset ratios below to generate data in the specified demographics
...
...
@@ -308,18 +315,26 @@ class Command(BaseCommand):
logger
.
info
(
"Done!"
)
def
fake_video_ids_fallback
(
self
):
return
[
{
'video_id'
:
'0fac49ba'
,
'video_module_id'
:
'i4x-edX-DemoX-video-5c90cffecd9b48b188cbfea176bf7fe9'
}
]
def
handle
(
self
,
*
args
,
**
options
):
course_id
=
options
[
'course_id'
]
username
=
options
[
'username'
]
video
_ids
=
self
.
fetch_videos_from_course_blocks
(
course_id
)
if
not
video_id
s
:
logger
.
warning
(
"Falling back to fake video id due to Course Blocks API failure..."
)
video_ids
=
[
{
'video_id'
:
'0fac49ba'
,
'video_module_id'
:
'i4x-edX-DemoX-video-5c90cffecd9b48b188cbfea176bf7fe9'
}
]
video
s
=
options
[
'videos'
]
if
video
s
:
video_ids
=
self
.
fetch_videos_from_course_blocks
(
course_id
)
if
not
video_ids
:
logger
.
warning
(
"Falling back to fake video id due to Course Blocks API failure..."
)
video_ids
=
self
.
fake_video_ids_fallback
()
else
:
logger
.
info
(
"Option to generate videos with ids pulled from the LMS is disabled, using fake video ids..."
)
video_ids
=
self
.
fake_video_ids_fallback
()
start_date
=
timezone
.
now
()
-
datetime
.
timedelta
(
weeks
=
10
)
num_weeks
=
options
[
'num_weeks'
]
...
...
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