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
cfd9c415
Commit
cfd9c415
authored
Sep 21, 2016
by
Dennis Jen
Committed by
GitHub
Sep 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #140 from edx/dsjen/metadata-utc
Use date instead of datetime in ModuleEngagementMetricRanges.
parents
0bc468ae
8cdacb74
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 @
cfd9c415
...
...
@@ -270,5 +270,5 @@ class Command(BaseCommand):
self
.
generate_video_data
(
course_id
,
video_id
,
video_module_id
)
self
.
generate_video_timeline_data
(
video_id
)
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
)
analytics_data_api/v0/models.py
View file @
cfd9c415
...
...
@@ -495,9 +495,9 @@ class ModuleEngagementMetricRanges(models.Model):
"""
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.
end_date
=
models
.
Date
Time
Field
()
end_date
=
models
.
DateField
()
metric
=
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
...
...
analytics_data_api/v0/serializers.py
View file @
cfd9c415
...
...
@@ -447,8 +447,8 @@ class EngagementDaySerializer(serializers.Serializer):
# pylint: disable=abstract-method
class
DateRangeSerializer
(
serializers
.
Serializer
):
start
=
serializers
.
Date
Time
Field
(
source
=
'start_date'
,
format
=
settings
.
DATE_FORMAT
)
end
=
serializers
.
Date
Time
Field
(
source
=
'end_date'
,
format
=
settings
.
DATE_FORMAT
)
start
=
serializers
.
DateField
(
source
=
'start_date'
,
format
=
settings
.
DATE_FORMAT
)
end
=
serializers
.
DateField
(
source
=
'end_date'
,
format
=
settings
.
DATE_FORMAT
)
# pylint: disable=abstract-method
...
...
analytics_data_api/v0/tests/views/test_learners.py
View file @
cfd9c415
...
...
@@ -10,7 +10,6 @@ import ddt
from
django_dynamic_fixture
import
G
from
elasticsearch
import
Elasticsearch
from
mock
import
patch
,
Mock
import
pytz
from
rest_framework
import
status
from
django.conf
import
settings
...
...
@@ -784,8 +783,8 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
def
test_one_engagement_range
(
self
):
metric_type
=
'problems_completed'
start_date
=
datetime
.
date
time
(
2015
,
7
,
1
,
tzinfo
=
pytz
.
utc
)
end_date
=
datetime
.
date
time
(
2015
,
7
,
21
,
tzinfo
=
pytz
.
utc
)
start_date
=
datetime
.
date
(
2015
,
7
,
1
)
end_date
=
datetime
.
date
(
2015
,
7
,
21
)
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
)
expected_ranges
=
self
.
empty_engagement_ranges
...
...
@@ -807,8 +806,8 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
def
_get_full_engagement_ranges
(
self
):
""" Populates a full set of engagement ranges and returns the expected engagement ranges. """
start_date
=
datetime
.
date
time
(
2015
,
7
,
1
,
tzinfo
=
pytz
.
utc
)
end_date
=
datetime
.
date
time
(
2015
,
7
,
21
,
tzinfo
=
pytz
.
utc
)
start_date
=
datetime
.
date
(
2015
,
7
,
1
)
end_date
=
datetime
.
date
(
2015
,
7
,
21
)
expected
=
{
'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