Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
feat: deprecate learner view code
Browse files Browse the repository at this point in the history
  • Loading branch information
alangsto committed Jul 27, 2022
1 parent 406b3c1 commit 19990cb
Show file tree
Hide file tree
Showing 21 changed files with 19 additions and 2,294 deletions.
17 changes: 1 addition & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ requirements: ## install base requirements
production-requirements: ## install production requirements
pip3 install -r requirements.txt

test.run_elasticsearch:
docker-compose up -d

test.stop_elasticsearch:
docker-compose stop

test.requirements: requirements ## install base and test requirements
pip3 install -q -r requirements/test.txt

Expand All @@ -36,7 +30,7 @@ tox.requirements: ## install tox requirements
develop: test.requirements ## install test and dev requirements
pip3 install -q -r requirements/dev.txt

upgrade:
upgrade:
pip3 install -q -r requirements/pip_tools.txt
pip-compile --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip_tools.txt requirements/pip_tools.in
Expand Down Expand Up @@ -72,13 +66,7 @@ main.test: clean
export COVERAGE_DIR=$(COVERAGE_DIR) && \
$(TOX)pytest --cov-report html --cov-report xml

test:

ifeq ($(DJANGO_SETTINGS_MODULE),analyticsdataserver.settings.devstack)
test: main.test
else
test: test.run_elasticsearch main.test test.stop_elasticsearch
endif

diff.report: test.requirements ## Show the diff in quality and coverage
diff-cover $(COVERAGE_DIR)/coverage.xml --html-report $(COVERAGE_DIR)/diff_cover.html
Expand Down Expand Up @@ -121,9 +109,6 @@ loaddata: migrate-all ## Runs migrations and generates fake data
python manage.py generate_fake_course_data --database=analytics
python manage.py generate_fake_course_data --database=analytics_v1

create_indices: ## Create ElasticSearch indices
python manage.py create_elasticsearch_learners_indices

demo: requirements clean loaddata ## Runs make clean, requirements, and loaddata, sets api key to edx
python manage.py set_api_key edx edx

Expand Down
65 changes: 0 additions & 65 deletions analytics_data_api/constants/engagement_types.py

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions analytics_data_api/management/utils.py

This file was deleted.

57 changes: 0 additions & 57 deletions analytics_data_api/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
CannotCreateReportDownloadLinkError,
CourseKeyMalformedError,
CourseNotSpecifiedError,
LearnerEngagementTimelineNotFoundError,
LearnerNotFoundError,
ParameterValueError,
ReportFileNotFoundError,
)

Expand Down Expand Up @@ -62,42 +59,6 @@ def process_exception(self, _request, exception):
return None


class LearnerNotFoundErrorMiddleware(BaseProcessErrorMiddleware):
"""
Raise 404 if learner not found.
"""

@property
def error(self):
return LearnerNotFoundError

@property
def error_code(self):
return 'no_learner_for_course'

@property
def status_code(self):
return status.HTTP_404_NOT_FOUND


class LearnerEngagementTimelineNotFoundErrorMiddleware(BaseProcessErrorMiddleware):
"""
Raise 404 if learner engagement timeline not found.
"""

@property
def error(self):
return LearnerEngagementTimelineNotFoundError

@property
def error_code(self):
return 'no_learner_engagement_timeline'

@property
def status_code(self):
return status.HTTP_404_NOT_FOUND


class CourseNotSpecifiedErrorMiddleware(BaseProcessErrorMiddleware):
"""
Raise 400 course not specified.
Expand Down Expand Up @@ -134,24 +95,6 @@ def status_code(self):
return status.HTTP_400_BAD_REQUEST


class ParameterValueErrorMiddleware(BaseProcessErrorMiddleware):
"""
Raise 400 if illegal parameter values are provided.
"""

@property
def error(self):
return ParameterValueError

@property
def error_code(self):
return 'illegal_parameter_values'

@property
def status_code(self):
return status.HTTP_400_BAD_REQUEST


class ReportFileNotFoundErrorMiddleware(BaseProcessErrorMiddleware):
"""
Raise 404 if the report file isn't present
Expand Down
22 changes: 0 additions & 22 deletions analytics_data_api/v0/apps.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
from django.apps import AppConfig
from django.conf import settings
from elasticsearch_dsl import connections


class ApiAppConfig(AppConfig):

name = 'analytics_data_api.v0'

def ready(self):
from analytics_data_api.utils import load_fully_qualified_definition # pylint: disable=import-outside-toplevel

super().ready()
if settings.ELASTICSEARCH_LEARNERS_HOST:
connection_params = {'hosts': [settings.ELASTICSEARCH_LEARNERS_HOST]}
if settings.ELASTICSEARCH_CONNECTION_CLASS:
connection_params['connection_class'] = \
load_fully_qualified_definition(settings.ELASTICSEARCH_CONNECTION_CLASS)

# aws settings
connection_params['aws_access_key_id'] = settings.ELASTICSEARCH_AWS_ACCESS_KEY_ID
connection_params['aws_secret_access_key'] = settings.ELASTICSEARCH_AWS_SECRET_ACCESS_KEY
connection_params['region'] = settings.ELASTICSEARCH_CONNECTION_DEFAULT_REGION

# Remove 'None' values so that we don't overwrite defaults
connection_params = {key: val for key, val in connection_params.items() if val is not None}

connections.connections.create_connection(**connection_params)
Loading

0 comments on commit 19990cb

Please sign in to comment.