Пример #1
0
    def add_mapping_version(self, mapping_version):
        from mappings.models import MappingVersion
        # Using raw query to atomically add item to the list
        MappingVersion.objects.raw_update({'_id': ObjectId(mapping_version.id)},
                                          {'$push': {'source_version_ids': self.id}})
        updated_at = datetime.now()
        MappingVersion.objects.filter(id=mapping_version.id).update(updated_at=updated_at)

        SourceVersion.objects.filter(id=self.id).update(active_mappings=F('active_mappings')+1, last_mapping_update=updated_at, last_child_update=updated_at, updated_at=updated_at)

        update_search_index(mapping_version)
Пример #2
0
    def add_mapping_version(self, mapping_version):
        from mappings.models import MappingVersion
        # Using raw query to atomically add item to the list
        MappingVersion.objects.raw_update({'_id': ObjectId(mapping_version.id)},
                                          {'$push': {'source_version_ids': self.id}})
        updated_at = datetime.now()
        MappingVersion.objects.filter(id=mapping_version.id).update(updated_at=updated_at)

        SourceVersion.objects.filter(id=self.id).update(active_mappings=F('active_mappings')+1, last_mapping_update=updated_at, last_child_update=updated_at, updated_at=updated_at)

        update_search_index(mapping_version)
Пример #3
0
    def update_mapping_version(self, mapping_version):
        mapping_previous_version = mapping_version.previous_version

        if mapping_previous_version:
            from mappings.models import MappingVersion
            #Using raw query to atomically remove item from the list
            MappingVersion.objects.raw_update({'_id': ObjectId(mapping_previous_version.id)},{'$pull': {'source_version_ids': self.id}})
            MappingVersion.objects.filter(id=mapping_previous_version.id).update(updated_at=datetime.now())
            update_search_index(mapping_previous_version)

        self.add_mapping_version(mapping_version)
Пример #4
0
    def update_mapping_version(self, mapping_version):
        mapping_previous_version = mapping_version.previous_version

        if mapping_previous_version:
            from mappings.models import MappingVersion
            #Using raw query to atomically remove item from the list
            MappingVersion.objects.raw_update({'_id': ObjectId(mapping_previous_version.id)},{'$pull': {'source_version_ids': self.id}})
            MappingVersion.objects.filter(id=mapping_previous_version.id).update(updated_at=datetime.now())
            update_search_index(mapping_previous_version)

        self.add_mapping_version(mapping_version)
Пример #5
0
 def add_mapping_version(self, mapping_version):
     from mappings.models import MappingVersion
     # Using raw query to atomically add item to the list
     MappingVersion.objects.raw_update(
         {'_id': ObjectId(mapping_version.id)},
         {'$push': {
             'source_version_ids': self.id
         }})
     MappingVersion.objects.filter(id=mapping_version.id).update(
         updated_at=datetime.now())
     self.save()  # save to update counts
     update_search_index(mapping_version)
Пример #6
0
 def add_concept_version(self, concept_version):
     from concepts.models import ConceptVersion
     # Using raw query to atomically add item to the list
     ConceptVersion.objects.raw_update(
         {'_id': ObjectId(concept_version.id)},
         {'$push': {
             'source_version_ids': self.id
         }})
     ConceptVersion.objects.filter(id=concept_version.id).update(
         updated_at=datetime.now())
     self.save()  #save to update counts
     update_search_index(concept_version)
Пример #7
0
    def update_concept_version(self, concept_version):
        concept_previous_version = concept_version.previous_version

        if concept_previous_version:
            from concepts.models import ConceptVersion
            # Using raw query to atomically remove item from the list
            ConceptVersion.objects.raw_update({'_id': ObjectId(concept_previous_version.id)},
                                              {'$pull': {'source_version_ids': self.id}})
            ConceptVersion.objects.filter(id=concept_previous_version.id).update(updated_at=datetime.now())
            update_search_index(concept_previous_version)

        self.add_concept_version(concept_version)
Пример #8
0
    def update_concept_version(self, concept_version):
        concept_previous_version = concept_version.previous_version

        if concept_previous_version:
            from concepts.models import ConceptVersion
            # Using raw query to atomically remove item from the list
            ConceptVersion.objects.raw_update({'_id': ObjectId(concept_previous_version.id)},
                                              {'$pull': {'source_version_ids': self.id}})
            ConceptVersion.objects.filter(id=concept_previous_version.id).update(updated_at=datetime.now())
            update_search_index(concept_previous_version)

        self.add_concept_version(concept_version)
Пример #9
0
    def add_concept_version(self, concept_version):
        from concepts.models import ConceptVersion
        # Using raw query to atomically add item to the list
        ConceptVersion.objects.raw_update({'_id': ObjectId(concept_version.id)},
                                          {'$push': {'source_version_ids': self.id}})

        updated_at = datetime.now()
        ConceptVersion.objects.filter(id=concept_version.id).update(updated_at=updated_at)

        SourceVersion.objects.filter(id=self.id).update(active_concepts=F('active_concepts')+1, last_concept_update=updated_at,
                                                        last_child_update=updated_at, updated_at=updated_at)

        update_search_index(concept_version)
Пример #10
0
    def add_concept_version(self, concept_version):
        from concepts.models import ConceptVersion
        # Using raw query to atomically add item to the list
        ConceptVersion.objects.raw_update({'_id': ObjectId(concept_version.id)},
                                          {'$push': {'source_version_ids': self.id}})

        updated_at = datetime.now()
        ConceptVersion.objects.filter(id=concept_version.id).update(updated_at=updated_at)

        SourceVersion.objects.filter(id=self.id).update(active_concepts=F('active_concepts')+1, last_concept_update=updated_at,
                                                        last_child_update=updated_at, updated_at=updated_at)

        update_search_index(concept_version)