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 """
|
""" Used for indexing working by day """
|
||||||
return [ret.weekday for ret in self.schedule.all() if ret.works_at_noon]
|
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
|
@property
|
||||||
def works_evening(self):
|
def works_evening(self):
|
||||||
""" Used for indexing working by day """
|
""" Used for indexing working by day """
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ class EstablishmentDocument(Document):
|
||||||
works_noon = fields.ListField(fields.IntegerField(
|
works_noon = fields.ListField(fields.IntegerField(
|
||||||
attr='works_noon'
|
attr='works_noon'
|
||||||
))
|
))
|
||||||
|
works_at_weekday = fields.ListField(fields.IntegerField(
|
||||||
|
attr='works_at_weekday'
|
||||||
|
))
|
||||||
works_now = fields.BooleanField(attr='works_now')
|
works_now = fields.BooleanField(attr='works_now')
|
||||||
tags = fields.ObjectField(
|
tags = fields.ObjectField(
|
||||||
properties={
|
properties={
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ class EstablishmentDocumentSerializer(DocumentSerializer):
|
||||||
'schedule',
|
'schedule',
|
||||||
'works_noon',
|
'works_noon',
|
||||||
'works_evening',
|
'works_evening',
|
||||||
|
'works_at_weekday',
|
||||||
# 'works_now',
|
# 'works_now',
|
||||||
# 'collections',
|
# 'collections',
|
||||||
# 'establishment_type',
|
# 'establishment_type',
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,12 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
|
||||||
constants.LOOKUP_QUERY_IN,
|
constants.LOOKUP_QUERY_IN,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
'works_at_weekday': {
|
||||||
|
'field': 'works_at_weekday',
|
||||||
|
'lookups': [
|
||||||
|
constants.LOOKUP_QUERY_IN,
|
||||||
|
],
|
||||||
|
},
|
||||||
'works_evening': {
|
'works_evening': {
|
||||||
'field': 'works_evening',
|
'field': 'works_evening',
|
||||||
'lookups': [
|
'lookups': [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user