Skip to content

Commit

Permalink
feat(dev): gastrotourism outside (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugena committed Oct 15, 2023
1 parent 6d4a030 commit d3715ed
Showing 1 changed file with 36 additions and 21 deletions.
57 changes: 36 additions & 21 deletions acesta/stats/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,20 @@ def get_interest(
if interesant_area == settings.AREA_REGIONS
else RegionCityPopularity
)
return ppt_model.objects.filter(
home_code=region,
qty__gt=0,
**dict(tourism_type=tourism_type)
if tourism_type
else dict(tourism_type__isnull=True)
).annotate(
ppt=models.functions.Round(
"popularity_mean", output_field=models.IntegerField()
return (
ppt_model.objects.filter(
home_code=region,
qty__gt=0,
**dict(tourism_type=tourism_type)
if tourism_type
else dict(tourism_type__isnull=True)
)
.annotate(
ppt=models.functions.Round(
"popularity_mean", output_field=models.IntegerField()
)
)
.distinct()
)
else:
if home_area == settings.AREA_CITIES:
Expand All @@ -123,27 +127,38 @@ def get_interest(
if interesant_area == settings.AREA_REGIONS
else CityCityPopularity
)
return ppt_model.objects.filter(
home_code=id,
qty__gt=0,
**dict(tourism_type=tourism_type)
if tourism_type
else dict(tourism_type__isnull=True)
).annotate(
ppt=models.functions.Round(
"popularity_mean", output_field=models.IntegerField()
return (
ppt_model.objects.filter(
home_code=id,
qty__gt=0,
**dict(tourism_type=tourism_type)
if tourism_type
else dict(tourism_type__isnull=True)
)
.annotate(
ppt=models.functions.Round(
"popularity_mean", output_field=models.IntegerField()
)
)
.distinct()
)
elif home_area == settings.AREA_SIGHTS:
ppt_model = (
AllRegionPopularity
if interesant_area == settings.AREA_REGIONS
else AllCityPopularity
)
return ppt_model.objects.filter(sight__id=id, qty__gt=0,).annotate(
ppt=models.functions.Round(
"popularity_mean", output_field=models.IntegerField()
return (
ppt_model.objects.filter(
sight__id=id,
qty__gt=0,
)
.annotate(
ppt=models.functions.Round(
"popularity_mean", output_field=models.IntegerField()
)
)
.distinct()
)


Expand Down

0 comments on commit d3715ed

Please sign in to comment.