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

Commit

Permalink
Merge pull request #567 from openedx/alangsto/update_problems_db
Browse files Browse the repository at this point in the history
fix: choose v1 database for problems if it exists
  • Loading branch information
alangsto authored Jul 7, 2022
2 parents 8493ca5 + 418d5cb commit 81ab0e8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions analytics_data_api/v0/views/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import connections
from django.db import connections, router
from django.db.models import Max
from django.http import Http404
from django.utils.timezone import make_aware, utc
Expand All @@ -17,7 +17,7 @@
from analytics_data_api.utils import dictfetchall, get_course_report_download_details
from analytics_data_api.v0 import models, serializers
from analytics_data_api.v0.exceptions import ReportFileNotFoundError
from analytics_data_api.v0.models import ModuleEngagement
from analytics_data_api.v0.models import ModuleEngagement, ProblemResponseAnswerDistribution
from analytics_data_api.v0.views.utils import raise_404_if_none


Expand Down Expand Up @@ -665,7 +665,9 @@ def get_queryset(self):
GROUP BY module_id;
"""

connection = connections[settings.ANALYTICS_DATABASE]
database = router.db_for_read(ProblemResponseAnswerDistribution)

connection = connections[database]
with connection.cursor() as cursor:
if connection.vendor == 'mysql':
# The default value of group_concat_max_len, 1024, is too low for some course data. Increase this value
Expand Down

0 comments on commit 81ab0e8

Please sign in to comment.