Optional isa_filter for wikidata_isa_counts
This commit is contained in:
		
							parent
							
								
									87005dea18
								
							
						
					
					
						commit
						302da85e33
					
				| 
						 | 
				
			
			@ -418,7 +418,7 @@ def wikidata_items_count(bounds, isa_filter=None):
 | 
			
		|||
 | 
			
		||||
    return q.count()
 | 
			
		||||
 | 
			
		||||
def wikidata_isa_counts(bounds):
 | 
			
		||||
def wikidata_isa_counts(bounds, isa_filter=None):
 | 
			
		||||
    db_bbox = make_envelope(bounds)
 | 
			
		||||
 | 
			
		||||
    q = (
 | 
			
		||||
| 
						 | 
				
			
			@ -426,6 +426,9 @@ def wikidata_isa_counts(bounds):
 | 
			
		|||
        .filter(func.ST_Covers(db_bbox, model.ItemLocation.location))
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    if isa_filter:
 | 
			
		||||
        q = add_isa_filter(q, isa_filter)
 | 
			
		||||
 | 
			
		||||
    db_items = q.all()
 | 
			
		||||
 | 
			
		||||
    counts = get_isa_count(db_items)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue