Example #1
0
File: models.py Project: pixyj/feel
 def _create_and_load_quiz_index(self):
     concept_ids = [cc.concept_id for cc in self.courseconcept_set.all()]
     concepts = Concept.objects.filter(pk__in=concept_ids)
     concept_quizzes = [concept.quiz_index_data for concept in concepts]
     objects = list(itertools.chain(*concept_quizzes))
     for obj in objects:
         obj['url'] = "{}{}/?quiz-id={}".format(self.url, obj['slug'], obj['quiz_id'])
     search.add_objects_to_index("concept_quizzes", objects)
     return objects
Example #2
0
File: models.py Project: pixyj/feel
 def _create_and_load_quiz_index(self):
     concept_ids = [cc.concept_id for cc in self.courseconcept_set.all()]
     concepts = Concept.objects.filter(pk__in=concept_ids)
     concept_quizzes = [concept.quiz_index_data for concept in concepts]
     objects = list(itertools.chain(*concept_quizzes))
     for obj in objects:
         obj['url'] = "{}{}/?quiz-id={}".format(self.url, obj['slug'],
                                                obj['quiz_id'])
     search.add_objects_to_index("concept_quizzes", objects)
     return objects
Example #3
0
File: models.py Project: pixyj/feel
 def _map_concepts_to_index(self, index_name, map_func):
     concept_ids = [cc.concept_id for cc in self.courseconcept_set.all()]
     concepts = Concept.objects.filter(pk__in=concept_ids)
     objects = [map_func(concept) for concept in concepts]
     search.add_objects_to_index(index_name, objects)
     return objects
Example #4
0
File: models.py Project: pixyj/feel
 def _map_concepts_to_index(self, index_name, map_func):
     concept_ids = [cc.concept_id for cc in self.courseconcept_set.all()]
     concepts = Concept.objects.filter(pk__in=concept_ids)
     objects = [map_func(concept) for concept in concepts]
     search.add_objects_to_index(index_name, objects)
     return objects