Commit 06cfbc4a by Matthew Piatetsky

Revert "Turn off index updates on model save"

This reverts commit 42d033dfc0f2634e663aba9ccd9501248fbc8f02.
ECOM-7346
parent 139e4808
...@@ -3,7 +3,6 @@ import datetime ...@@ -3,7 +3,6 @@ import datetime
from urllib.parse import urlencode from urllib.parse import urlencode
import ddt import ddt
import pytest
import pytz import pytz
from django.test import TestCase from django.test import TestCase
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
...@@ -1192,7 +1191,6 @@ class CourseSearchSerializerTests(TestCase): ...@@ -1192,7 +1191,6 @@ class CourseSearchSerializerTests(TestCase):
class CourseRunSearchSerializerTests(TestCase): class CourseRunSearchSerializerTests(TestCase):
@pytest.mark.skip(reason="turning off temporarily for experiment - ECOM-7346")
def test_data(self): def test_data(self):
course_run = CourseRunFactory(transcript_languages=LanguageTag.objects.filter(code__in=['en-us', 'zh-cn']), course_run = CourseRunFactory(transcript_languages=LanguageTag.objects.filter(code__in=['en-us', 'zh-cn']),
authoring_organizations=[OrganizationFactory()]) authoring_organizations=[OrganizationFactory()])
......
...@@ -3,7 +3,6 @@ import json ...@@ -3,7 +3,6 @@ import json
import urllib.parse import urllib.parse
import ddt import ddt
import pytest
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
...@@ -235,17 +234,14 @@ class CourseRunSearchViewSetTests(DefaultPartnerMixin, SerializationMixin, Login ...@@ -235,17 +234,14 @@ class CourseRunSearchViewSetTests(DefaultPartnerMixin, SerializationMixin, Login
} }
self.assertDictContainsSubset(expected, response_data['queries']) self.assertDictContainsSubset(expected, response_data['queries'])
@pytest.mark.skip(reason="turning off temporarily for experiment - ECOM-7346")
def test_exclude_deleted_program_types(self): def test_exclude_deleted_program_types(self):
""" Verify the deleted programs do not show in the program_types representation. """ """ Verify the deleted programs do not show in the program_types representation. """
self._test_exclude_program_types(ProgramStatus.Deleted) self._test_exclude_program_types(ProgramStatus.Deleted)
@pytest.mark.skip(reason="turning off temporarily for experiment - ECOM-7346")
def test_exclude_unpublished_program_types(self): def test_exclude_unpublished_program_types(self):
""" Verify the unpublished programs do not show in the program_types representation. """ """ Verify the unpublished programs do not show in the program_types representation. """
self._test_exclude_program_types(ProgramStatus.Unpublished) self._test_exclude_program_types(ProgramStatus.Unpublished)
@pytest.mark.skip(reason="turning off temporarily for experiment - ECOM-7346")
@ddt.data( @ddt.data(
[{'title': 'Software Testing', 'excluded': True}], [{'title': 'Software Testing', 'excluded': True}],
[{'title': 'Software Testing', 'excluded': True}, {'title': 'Software Testing 2', 'excluded': True}], [{'title': 'Software Testing', 'excluded': True}, {'title': 'Software Testing 2', 'excluded': True}],
......
...@@ -333,14 +333,13 @@ class Course(TimeStampedModel): ...@@ -333,14 +333,13 @@ class Course(TimeStampedModel):
ids = [result.pk for result in results] ids = [result.pk for result in results]
return cls.objects.filter(pk__in=ids) return cls.objects.filter(pk__in=ids)
# This is commented out for a temporary experiment for ECOM-7346 def save(self, *args, **kwargs):
# def save(self, *args, **kwargs): super(Course, self).save(*args, **kwargs)
# super(Course, self).save(*args, **kwargs) try:
# try: self.reindex_course_runs()
# self.reindex_course_runs() except Exception: # pylint: disable=broad-except
# except Exception: # pylint: disable=broad-except logger.exception("An error occurred while attempting to reindex the course runs"
# logger.exception("An error occurred while attempting to reindex the course runs" "of Course with key: [{key}].".format(key=self.key))
# "of Course with key: [{key}].".format(key=self.key))
def reindex_course_runs(self): def reindex_course_runs(self):
index = connections['default'].get_unified_index().get_index(CourseRun) index = connections['default'].get_unified_index().get_index(CourseRun)
...@@ -939,8 +938,7 @@ class Program(TimeStampedModel): ...@@ -939,8 +938,7 @@ class Program(TimeStampedModel):
publisher.publish_program(self) publisher.publish_program(self)
else: else:
super(Program, self).save(*args, **kwargs) super(Program, self).save(*args, **kwargs)
# This is commented out for a temporary experiment for ECOM-7346 self.reindex_courses()
# self.reindex_courses()
def reindex_courses(self): def reindex_courses(self):
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment