From b516b2a33a1f4242143002d364d6b42ec1eed94f Mon Sep 17 00:00:00 2001 From: vovastelmashchuk Date: Sat, 14 Sep 2024 20:04:27 +0300 Subject: [PATCH] add sort type --- database/filters.js | 50 ++++++++++++++++----------------- features/filters/description.js | 1 - 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/database/filters.js b/database/filters.js index 45ed6bf..18570a7 100644 --- a/database/filters.js +++ b/database/filters.js @@ -142,21 +142,13 @@ async function getAlcohole() { async function getFiltersData() { return [ - { - id: 6, - queryName: 'alcohol', - name: 'Алкоголь', - items: await getAlcohole(), - selectionType: 'MULTIPLE', - sortOrder: 2, - }, { id: 4, queryName: 'alcohol-volume', name: 'Міцність', items: await getAlcoholoVolume(), selectionType: 'SINGLE', - sortOrder: 1, + isOpen: true, }, { id: 3, @@ -164,7 +156,23 @@ async function getFiltersData() { name: 'Смак', items: await getTastes(), selectionType: 'MULTIPLE', - sortOrder: 3, + isOpen: false, + }, + { + id: 1, + queryName: 'goods', + name: 'Інгрідієнти', + items: await getGoods(), + selectionType: 'MULTIPLE', + isOpen: false, + }, + { + id: 6, + queryName: 'alcohol', + name: 'Категорія алкоголю', + items: await getAlcohole(), + selectionType: 'MULTIPLE', + isOpen: false, }, { id: 5, @@ -172,15 +180,15 @@ async function getFiltersData() { name: 'Стакан', items: await getGlasswares(), selectionType: 'SINGLE', - sortOrder: 4, + isOpen: false, }, { - id: 1, - queryName: 'goods', - name: 'Інгрідієнти', - items: await getGoods(), + id: 2, + queryName: 'tools', + name: 'Приладдя', + items: await getToolsData(), selectionType: 'MULTIPLE', - sortOrder: 5, + isOpen: false, }, { id: 0, @@ -188,16 +196,8 @@ async function getFiltersData() { name: 'Інше', items: await getTagsData(), selectionType: 'MULTIPLE', - sortOrder: 6, + isOpen: false, }, - { - id: 2, - queryName: 'tools', - name: 'Приладдя', - items: await getToolsData(), - selectionType: 'MULTIPLE', - sortOrder: 7, - } ] } diff --git a/features/filters/description.js b/features/filters/description.js index 92dce1a..bfd1b3f 100644 --- a/features/filters/description.js +++ b/features/filters/description.js @@ -61,7 +61,6 @@ class DescriptionBuilder { } async addAlchoholDescriptionIfExist(alcoholSlugs) { - console.log('alcoholSlugs', alcoholSlugs); if (alcoholSlugs?.length > 0) { const alcohols = await Database.collection('alcohol').find({ slug: { $in: alcoholSlugs } }).toArray(); if (alcohols.length > 0) {