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
6b6cfc6d
Commit
6b6cfc6d
authored
Sep 05, 2014
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24 from edx/data-generator-fix
Fixed Times for Fake Activity Data
parents
c12902bc
f710b11a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
analytics_data_api/management/commands/generate_fake_course_data.py
+6
-2
No files found.
analytics_data_api/management/commands/generate_fake_course_data.py
View file @
6b6cfc6d
...
@@ -107,7 +107,10 @@ class Command(BaseCommand):
...
@@ -107,7 +107,10 @@ class Command(BaseCommand):
def
generate_weekly_data
(
self
,
course_id
,
start_date
,
end_date
):
def
generate_weekly_data
(
self
,
course_id
,
start_date
,
end_date
):
activity_types
=
[
'PLAYED_VIDEO'
,
'ATTEMPTED_PROBLEM'
,
'POSTED_FORUM'
]
activity_types
=
[
'PLAYED_VIDEO'
,
'ATTEMPTED_PROBLEM'
,
'POSTED_FORUM'
]
start
=
start_date
# Ensure we start on a Sunday 00:00
days_ahead
=
6
-
start_date
.
weekday
()
start
=
start_date
+
datetime
.
timedelta
(
days_ahead
)
models
.
CourseActivityWeekly
.
objects
.
all
()
.
delete
()
models
.
CourseActivityWeekly
.
objects
.
all
()
.
delete
()
logger
.
info
(
"Deleted all weekly course activity."
)
logger
.
info
(
"Deleted all weekly course activity."
)
...
@@ -116,7 +119,8 @@ class Command(BaseCommand):
...
@@ -116,7 +119,8 @@ class Command(BaseCommand):
while
start
<
end_date
:
while
start
<
end_date
:
active_students
=
random
.
randint
(
100
,
4000
)
active_students
=
random
.
randint
(
100
,
4000
)
end
=
min
(
start
+
datetime
.
timedelta
(
weeks
=
1
),
end_date
)
# End date should occur on Saturday at 23:59:59
end
=
start
+
datetime
.
timedelta
(
weeks
=
1
,
milliseconds
=-
1
)
counts
=
constrained_sum_sample_pos
(
len
(
activity_types
),
active_students
)
counts
=
constrained_sum_sample_pos
(
len
(
activity_types
),
active_students
)
...
...
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