Bug #210 Añadir automaticamente en el campo relevancy

This commit is contained in:
Gerard 2018-03-27 14:16:42 +02:00
parent a746d2d58f
commit 56f774a07f
1 changed files with 10 additions and 1 deletions

View File

@ -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;
}