Exemplo n.º 1
0
def set_unit_source_data(apps, schema_editor):
    from pootle_store.models import Unit
    UnitSource = apps.get_model("pootle_store.UnitSource")
    counter = wordcount.get(Unit)
    unit_sources = (UnitSource.objects.select_related('unit').filter(
        source_wordcount=0).only("unit__source_f", "id").order_by("id"))
    Batch(unit_sources, batch_size=BATCH_SIZE).update(
        unit_sources,
        update_method=functools.partial(unit_source_update, counter),
        update_fields=['source_hash', 'source_length', 'source_wordcount'])
Exemplo n.º 2
0
def set_unit_source_data(apps, schema_editor):
    from pootle_store.models import Unit
    UnitSource = apps.get_model(
        "pootle_store.UnitSource")
    counter = wordcount.get(Unit)
    unit_sources = (
        UnitSource.objects.select_related('unit')
                          .filter(source_wordcount=0)
                          .only("unit__source_f", "id")
                          .order_by("id"))
    Batch(unit_sources, batch_size=BATCH_SIZE).update(
        unit_sources,
        update_method=functools.partial(unit_source_update, counter),
        update_fields=[
            'source_hash',
            'source_length',
            'source_wordcount'])
Exemplo n.º 3
0
 def counter(self):
     return wordcount.get(Unit)
Exemplo n.º 4
0
    def target_wordcount(self):
        from pootle_store.models import Unit

        counter = wordcount.get(Unit)
        return counter.count_words(self.target_f)
Exemplo n.º 5
0
    def target_wordcount(self):
        from pootle_store.models import Unit

        counter = wordcount.get(Unit)
        return counter.count_words(self.target_f)
Exemplo n.º 6
0
 def counter(self):
     return wordcount.get(Unit)