From 56f774a07f051fcd7a529a22e63940f8c3624c72 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 27 Mar 2018 14:16:42 +0200 Subject: [PATCH] =?UTF-8?q?Bug=20#210=20=20A=C3=B1adir=20automaticamente?= =?UTF-8?q?=20en=20el=20campo=20relevancy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/item/src/tags/item-tags.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/item/src/tags/item-tags.js b/client/item/src/tags/item-tags.js index f2a0b6e5d1..de750b294b 100644 --- a/client/item/src/tags/item-tags.js +++ b/client/item/src/tags/item-tags.js @@ -37,7 +37,7 @@ class ItemTags { addItemTag() { if (this.instancedItemTags) { - this.instancedItemTags.push({value: null, itemFk: this.params.id, tagFk: null, priority: null, showAddIcon: true}); + this.instancedItemTags.push({value: null, itemFk: this.params.id, tagFk: null, priority: this.getMaxPriority(this.instancedItemTags) + 1, showAddIcon: true}); this._setIconAdd(); } } @@ -54,6 +54,15 @@ class ItemTags { } } + getMaxPriority(instancedItemTags) { + let max = 0; + instancedItemTags.forEach(tag => { + if (tag.priority > max) + max = tag.priority; + }); + return max; + } + _equalItemTags(oldTag, newTag) { return oldTag.tagFk === newTag.tagFk && oldTag.value === newTag.value && oldTag.priority === newTag.priority; }