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
8cdacb74
Commit
8cdacb74
authored
Sep 21, 2016
by
Dennis Jen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use date instead of datetime in ModuleEngagementMetricRanges.
parent
0bc468ae
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
10 deletions
+9
-10
analytics_data_api/management/commands/generate_fake_course_data.py
+1
-1
analytics_data_api/v0/models.py
+2
-2
analytics_data_api/v0/serializers.py
+2
-2
analytics_data_api/v0/tests/views/test_learners.py
+4
-5
No files found.
analytics_data_api/management/commands/generate_fake_course_data.py
View file @
8cdacb74
...
@@ -270,5 +270,5 @@ class Command(BaseCommand):
...
@@ -270,5 +270,5 @@ class Command(BaseCommand):
self
.
generate_video_data
(
course_id
,
video_id
,
video_module_id
)
self
.
generate_video_data
(
course_id
,
video_id
,
video_module_id
)
self
.
generate_video_timeline_data
(
video_id
)
self
.
generate_video_timeline_data
(
video_id
)
self
.
generate_learner_engagement_data
(
course_id
,
username
,
start_date
,
end_date
)
self
.
generate_learner_engagement_data
(
course_id
,
username
,
start_date
,
end_date
)
self
.
generate_learner_engagement_range_data
(
course_id
,
start_date
,
end_date
)
self
.
generate_learner_engagement_range_data
(
course_id
,
start_date
.
date
(),
end_date
.
date
()
)
self
.
generate_tags_distribution_data
(
course_id
)
self
.
generate_tags_distribution_data
(
course_id
)
analytics_data_api/v0/models.py
View file @
8cdacb74
...
@@ -495,9 +495,9 @@ class ModuleEngagementMetricRanges(models.Model):
...
@@ -495,9 +495,9 @@ class ModuleEngagementMetricRanges(models.Model):
"""
"""
course_id
=
models
.
CharField
(
db_index
=
True
,
max_length
=
255
)
course_id
=
models
.
CharField
(
db_index
=
True
,
max_length
=
255
)
start_date
=
models
.
Date
Time
Field
()
start_date
=
models
.
DateField
()
# This is a left-closed interval. No data from the end_date is included in the analysis.
# This is a left-closed interval. No data from the end_date is included in the analysis.
end_date
=
models
.
Date
Time
Field
()
end_date
=
models
.
DateField
()
metric
=
models
.
CharField
(
max_length
=
50
)
metric
=
models
.
CharField
(
max_length
=
50
)
range_type
=
models
.
CharField
(
max_length
=
50
)
range_type
=
models
.
CharField
(
max_length
=
50
)
# Also a left-closed interval, so any metric whose value is equal to the high_value
# Also a left-closed interval, so any metric whose value is equal to the high_value
...
...
analytics_data_api/v0/serializers.py
View file @
8cdacb74
...
@@ -447,8 +447,8 @@ class EngagementDaySerializer(serializers.Serializer):
...
@@ -447,8 +447,8 @@ class EngagementDaySerializer(serializers.Serializer):
# pylint: disable=abstract-method
# pylint: disable=abstract-method
class
DateRangeSerializer
(
serializers
.
Serializer
):
class
DateRangeSerializer
(
serializers
.
Serializer
):
start
=
serializers
.
Date
Time
Field
(
source
=
'start_date'
,
format
=
settings
.
DATE_FORMAT
)
start
=
serializers
.
DateField
(
source
=
'start_date'
,
format
=
settings
.
DATE_FORMAT
)
end
=
serializers
.
Date
Time
Field
(
source
=
'end_date'
,
format
=
settings
.
DATE_FORMAT
)
end
=
serializers
.
DateField
(
source
=
'end_date'
,
format
=
settings
.
DATE_FORMAT
)
# pylint: disable=abstract-method
# pylint: disable=abstract-method
...
...
analytics_data_api/v0/tests/views/test_learners.py
View file @
8cdacb74
...
@@ -10,7 +10,6 @@ import ddt
...
@@ -10,7 +10,6 @@ import ddt
from
django_dynamic_fixture
import
G
from
django_dynamic_fixture
import
G
from
elasticsearch
import
Elasticsearch
from
elasticsearch
import
Elasticsearch
from
mock
import
patch
,
Mock
from
mock
import
patch
,
Mock
import
pytz
from
rest_framework
import
status
from
rest_framework
import
status
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -784,8 +783,8 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
...
@@ -784,8 +783,8 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
def
test_one_engagement_range
(
self
):
def
test_one_engagement_range
(
self
):
metric_type
=
'problems_completed'
metric_type
=
'problems_completed'
start_date
=
datetime
.
date
time
(
2015
,
7
,
1
,
tzinfo
=
pytz
.
utc
)
start_date
=
datetime
.
date
(
2015
,
7
,
1
)
end_date
=
datetime
.
date
time
(
2015
,
7
,
21
,
tzinfo
=
pytz
.
utc
)
end_date
=
datetime
.
date
(
2015
,
7
,
21
)
G
(
ModuleEngagementMetricRanges
,
course_id
=
self
.
course_id
,
start_date
=
start_date
,
end_date
=
end_date
,
G
(
ModuleEngagementMetricRanges
,
course_id
=
self
.
course_id
,
start_date
=
start_date
,
end_date
=
end_date
,
metric
=
metric_type
,
range_type
=
'normal'
,
low_value
=
90
,
high_value
=
6120
)
metric
=
metric_type
,
range_type
=
'normal'
,
low_value
=
90
,
high_value
=
6120
)
expected_ranges
=
self
.
empty_engagement_ranges
expected_ranges
=
self
.
empty_engagement_ranges
...
@@ -807,8 +806,8 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
...
@@ -807,8 +806,8 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
def
_get_full_engagement_ranges
(
self
):
def
_get_full_engagement_ranges
(
self
):
""" Populates a full set of engagement ranges and returns the expected engagement ranges. """
""" Populates a full set of engagement ranges and returns the expected engagement ranges. """
start_date
=
datetime
.
date
time
(
2015
,
7
,
1
,
tzinfo
=
pytz
.
utc
)
start_date
=
datetime
.
date
(
2015
,
7
,
1
)
end_date
=
datetime
.
date
time
(
2015
,
7
,
21
,
tzinfo
=
pytz
.
utc
)
end_date
=
datetime
.
date
(
2015
,
7
,
21
)
expected
=
{
expected
=
{
'engagement_ranges'
:
{
'engagement_ranges'
:
{
...
...
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