Merge branch 'feature/works-whole-day-es-filter' into 'develop'

Feature/works whole day es filter

See merge request gm/gm-backend!113
This commit is contained in:
d.kuzmenko 2019-11-12 12:33:45 +00:00
commit cd1967ee51
4 changed files with 15 additions and 0 deletions

View File

@ -461,6 +461,11 @@ class Establishment(ProjectBaseMixin, URLImageMixin, TranslatedFieldsMixin):
""" Used for indexing working by day """
return [ret.weekday for ret in self.schedule.all() if ret.works_at_noon]
@property
def works_at_weekday(self):
""" Used for indexing by working whole day criteria """
return [ret.weekday for ret in self.schedule.all()]
@property
def works_evening(self):
""" Used for indexing working by day """

View File

@ -37,6 +37,9 @@ class EstablishmentDocument(Document):
works_noon = fields.ListField(fields.IntegerField(
attr='works_noon'
))
works_at_weekday = fields.ListField(fields.IntegerField(
attr='works_at_weekday'
))
works_now = fields.BooleanField(attr='works_now')
tags = fields.ObjectField(
properties={

View File

@ -108,6 +108,7 @@ class EstablishmentDocumentSerializer(DocumentSerializer):
'schedule',
'works_noon',
'works_evening',
'works_at_weekday',
# 'works_now',
# 'collections',
# 'establishment_type',

View File

@ -156,6 +156,12 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
constants.LOOKUP_QUERY_IN,
],
},
'works_at_weekday': {
'field': 'works_at_weekday',
'lookups': [
constants.LOOKUP_QUERY_IN,
],
},
'works_evening': {
'field': 'works_evening',
'lookups': [