Bläddra i källkod

HUE-4238 [doc2] Ignore history docs in find_jobs_with_no_doc during sync documents

Only exclude for Document2
Jenny Kim 9 år sedan
förälder
incheckning
4f062ec
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      desktop/core/src/desktop/models.py

+ 4 - 1
desktop/core/src/desktop/models.py

@@ -371,7 +371,10 @@ class DocumentManager(models.Manager):
   def sync(self):
 
     def find_jobs_with_no_doc(model):
-      return model.objects.filter(doc__isnull=True).exclude(is_history=True).select_related('owner')
+      jobs = model.objects.filter(doc__isnull=True)
+      if model == Document2:
+        jobs = jobs.exclude(is_history=True)
+      return jobs.select_related('owner')
 
     def find_oozie_jobs_with_no_doc(model):
       return model.objects.filter(doc__isnull=True).exclude(name__exact='').select_related('owner')