def handle_store(self, store, **options): self.stdout.write("Processing %r" % (store)) store.total_wordcount = 0 store.translated_wordcount = 0 store.fuzzy_wordcount = 0 suggestions = Suggestion.objects.filter(unit__store=store, unit__state__gt=OBSOLETE) store.suggestion_count = suggestions.count() QualityCheck.objects.filter(unit__store=store).delete() for unit in store.units.all(): wordcount = count_words(unit.source_f.strings) store.total_wordcount += wordcount if unit.state == TRANSLATED: store.translated_wordcount += wordcount elif unit.state == FUZZY: store.fuzzy_wordcount += wordcount if options["calculate_checks"]: store.update_qualitychecks() store.failing_critical_count = QualityCheck.objects.filter( unit__store=store, unit__state__gt=UNTRANSLATED, category=Category.CRITICAL, false_positive=False, ).values('unit').distinct().count() store.save() self._updated_tps.add(store.translation_project)
def handle_store(self, store, **options): self.stdout.write("Processing %r" % (store)) store.total_wordcount = 0 store.translated_wordcount = 0 store.fuzzy_wordcount = 0 store.suggestion_count = Suggestion.objects.filter( unit__store=store, unit__state__gt=OBSOLETE, state=SuggestionStates.PENDING, ).count() QualityCheck.objects.filter(unit__store=store).delete() for unit in store.units.all(): wordcount = count_words(unit.source_f.strings) store.total_wordcount += wordcount if unit.state == TRANSLATED: store.translated_wordcount += wordcount elif unit.state == FUZZY: store.fuzzy_wordcount += wordcount try: last_unit = store.unit_set.latest('creation_time') # creation_time field has been added recently, so it can have NULL # value. if last_unit.creation_time is not None: store.last_unit = last_unit except Unit.DoesNotExist: pass units = store.unit_set.all().order_by('-submitted_on')[:1] try: store.last_submission = Submission.simple_objects.filter( unit=units[0] ).order_by('-creation_time')[0] except IndexError: pass if options["calculate_checks"]: self.stdout.write("Calculating checks for %r" % (store)) store.update_qualitychecks() store.failing_critical_count = QualityCheck.objects.filter( unit__store=store, unit__state__gt=UNTRANSLATED, category=Category.CRITICAL, false_positive=False, ).values('unit').distinct().count() store.save() self._updated_tps.add(store.translation_project)
def handle_store(self, store, **options): self.stdout.write("Processing %r" % (store)) store.total_wordcount = 0 store.translated_wordcount = 0 store.fuzzy_wordcount = 0 store.suggestion_count = Suggestion.objects.filter( unit__store=store, unit__state__gt=OBSOLETE, state=SuggestionStates.PENDING, ).count() QualityCheck.objects.filter(unit__store=store).delete() for unit in store.units.all(): wordcount = count_words(unit.source_f.strings) store.total_wordcount += wordcount if unit.state == TRANSLATED: store.translated_wordcount += wordcount elif unit.state == FUZZY: store.fuzzy_wordcount += wordcount try: last_unit = store.unit_set.latest('creation_time') # creation_time field has been added recently, so it can have NULL # value. if last_unit.creation_time is not None: store.last_unit = last_unit except Unit.DoesNotExist: pass units = store.unit_set.all().order_by('-submitted_on')[:1] try: store.last_submission = Submission.simple_objects.filter( unit=units[0]).order_by('-creation_time')[0] except IndexError: pass if options["calculate_checks"]: self.stdout.write("Calculating checks for %r" % (store)) store.update_qualitychecks() store.failing_critical_count = QualityCheck.objects.filter( unit__store=store, unit__state__gt=UNTRANSLATED, category=Category.CRITICAL, false_positive=False, ).values('unit').distinct().count() store.save() self._updated_tps.add(store.translation_project)
def handle_store(self, store, **options): print("Processing %r" % (store)) store.total_wordcount = 0 store.translated_wordcount = 0 store.fuzzy_wordcount = 0 suggestions = Suggestion.objects.filter(unit__store=store, unit__state__gt=OBSOLETE) store.suggestion_count = suggestions.count() QualityCheck.objects.filter(unit__store=store).delete() for unit in store.units.all(): wordcount = count_words(unit.source_f.strings) store.total_wordcount += wordcount if unit.state == TRANSLATED: store.translated_wordcount += wordcount elif unit.state == FUZZY: store.fuzzy_wordcount += wordcount if options["calculate_checks"]: store.update_qualitychecks() store.save() self._updated_tps.add(store.translation_project)