Commit 29437878 by Clinton Blackburn

Merge pull request #33 from edx/travis-update

Updates for Travis
parents 0d6266f0 04871273
...@@ -55,3 +55,8 @@ loaddata: syncdb ...@@ -55,3 +55,8 @@ loaddata: syncdb
demo: clean requirements loaddata demo: clean requirements loaddata
python manage.py set_api_key edx edx python manage.py set_api_key edx edx
travis: clean requirements syncdb
python manage.py set_api_key edx edx
python manage.py loaddata education_levels problem_response_answer_distribution --database=analytics
python manage.py generate_fake_course_data --num-weeks=1
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import datetime import datetime
import logging import logging
from optparse import make_option
import random import random
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
...@@ -28,6 +29,11 @@ def get_count(start): ...@@ -28,6 +29,11 @@ def get_count(start):
class Command(BaseCommand): class Command(BaseCommand):
help = 'Generate fake data'
option_list = BaseCommand.option_list + (
make_option('-n', '--num-weeks', action='store', type="int", dest='num_weeks', help='"Number of weeks worth of data to generate.'),
)
def generate_daily_data(self, course_id, start_date, end_date): def generate_daily_data(self, course_id, start_date, end_date):
# Use the preset ratios below to generate data in the specified demographics # Use the preset ratios below to generate data in the specified demographics
...@@ -129,7 +135,8 @@ class Command(BaseCommand): ...@@ -129,7 +135,8 @@ class Command(BaseCommand):
models.CourseActivityWeekly.objects.create(course_id=course_id, activity_type=activity_type, models.CourseActivityWeekly.objects.create(course_id=course_id, activity_type=activity_type,
count=count, interval_start=start, interval_end=end) count=count, interval_start=start, interval_end=end)
models.CourseActivityWeekly.objects.create(course_id=course_id, activity_type='ACTIVE', count=active_students, models.CourseActivityWeekly.objects.create(course_id=course_id, activity_type='ACTIVE',
count=active_students,
interval_start=start, interval_end=end) interval_start=start, interval_end=end)
start = end start = end
...@@ -139,7 +146,13 @@ class Command(BaseCommand): ...@@ -139,7 +146,13 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
course_id = 'edX/DemoX/Demo_Course' course_id = 'edX/DemoX/Demo_Course'
start_date = datetime.datetime(year=2014, month=1, day=1, tzinfo=timezone.utc) start_date = datetime.datetime(year=2014, month=1, day=1, tzinfo=timezone.utc)
num_weeks = options['num_weeks']
if num_weeks:
end_date = start_date + datetime.timedelta(weeks=num_weeks)
else:
end_date = timezone.now().replace(microsecond=0) end_date = timezone.now().replace(microsecond=0)
logger.info("Generating data for %s...", course_id) logger.info("Generating data for %s...", course_id)
self.generate_weekly_data(course_id, start_date, end_date) self.generate_weekly_data(course_id, start_date, end_date)
self.generate_daily_data(course_id, start_date, end_date) self.generate_daily_data(course_id, start_date, end_date)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment