diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 8f2f3bb35..fdaf72440 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -1056,7 +1056,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(10, 2, 27, '15cm', 3),
(11, 2, 36, 'Stark Industries', 4),
(12, 2, 1, 'Silver', 5),
- (13, 2, 67, 'concussion', 6),
+ (13, 2, 67, 'Concussion', 6),
(14, 2, 23, '1', 7),
(15, 3, 56, 'Ranged weapon', 1),
(16, 3, 58, 'sniper rifle', 2),
@@ -1105,7 +1105,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(59, 9, 27, '15cm', 3),
(60, 9, 36, 'Stark Industries', 4),
(61, 9, 1, 'Silver', 5),
- (62, 9, 67, 'concussion', 6),
+ (62, 9, 67, 'Concussion', 6),
(63, 9, 23, '1', 7),
(64, 10, 56, 'Ranged Reinforced weapon', 1),
(65, 10, 58, 'sniper rifle', 2),
diff --git a/modules/order/back/methods/order/specs/catalogFilter.spec.js b/modules/order/back/methods/order/specs/catalogFilter.spec.js
index 12cafa5b7..64bf4f17c 100644
--- a/modules/order/back/methods/order/specs/catalogFilter.spec.js
+++ b/modules/order/back/methods/order/specs/catalogFilter.spec.js
@@ -1,6 +1,9 @@
const app = require('vn-loopback/server/server');
describe('order catalogFilter()', () => {
+ const colorTagId = 1;
+ const categoryTagId = 67;
+
it('should return an array of items', async() => {
let filter = {
where: {
@@ -19,21 +22,30 @@ describe('order catalogFilter()', () => {
});
it('should now return an array of items based on tag filter', async() => {
- let filter = {
+ const filter = {
where: {
categoryFk: 1,
typeFk: 2
}
};
- let tags = [{tagFk: 56, value: 'Melee Reinforced weapon'}];
- let orderFk = 11;
- let orderBy = {field: 'relevancy DESC, name', way: 'DESC'};
- let result = await app.models.Order.catalogFilter(orderFk, orderBy, filter, tags);
+ const tagGroups = [
+ {tagFk: colorTagId, values: [{value: 'Silver'}, {value: 'Brown'}]},
+ {tagFk: categoryTagId, values: [{value: 'Concussion'}]}
+ ];
+ const orderFk = 11;
+ const orderBy = {field: 'relevancy DESC, name', way: 'DESC'};
+ const result = await app.models.Order.catalogFilter(orderFk, orderBy, filter, tagGroups);
- let firstItemId = result[0].id;
+ const randomIndex = Math.round(Math.random());
+ const item = result[randomIndex];
+ const itemTags = item.tags;
- expect(result.length).toEqual(1);
- expect(firstItemId).toEqual(9);
+ const colorTag = itemTags.find(tag => tag.tagFk == colorTagId);
+ const categoryTag = itemTags.find(tag => tag.tagFk == categoryTagId);
+
+ expect(result.length).toEqual(2);
+ expect(colorTag.value).toEqual('Silver');
+ expect(categoryTag.value).toEqual('Concussion');
});
});
diff --git a/modules/order/front/catalog-search-panel/index.html b/modules/order/front/catalog-search-panel/index.html
index 822445a18..19719e00b 100644
--- a/modules/order/front/catalog-search-panel/index.html
+++ b/modules/order/front/catalog-search-panel/index.html
@@ -1,11 +1,6 @@