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:
commit
cd1967ee51
|
|
@ -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 """
|
||||
|
|
|
|||
|
|
@ -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={
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class EstablishmentDocumentSerializer(DocumentSerializer):
|
|||
'schedule',
|
||||
'works_noon',
|
||||
'works_evening',
|
||||
'works_at_weekday',
|
||||
# 'works_now',
|
||||
# 'collections',
|
||||
# 'establishment_type',
|
||||
|
|
|
|||
|
|
@ -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': [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user