Skip to content

Commit

Permalink
Fix this is undefined in plain javascript function
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikVerheul committed Feb 28, 2022
1 parent af328a4 commit d3af536
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/views/coarse_product/c_product_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ const methods = {
* precondition: the selected nodes have all the same parent (same level)
* Area PO's need not to be member of the item's team
*/
function areAlldependenciesFound(nodes) {
function areAlldependenciesFound(vm, nodes) {
for (const node of nodes) {
for (const depId of node.dependencies) {
const item = this.$store.state.helpersRef.getNodeById(depId)
const item = vm.$store.state.helpersRef.getNodeById(depId)
if (!item) return false
}
}
return true
}
function areAllConditionsFound(nodes) {
function areAllConditionsFound(vm, nodes) {
for (const node of nodes) {
for (const conId of node.conditionalFor) {
const item = this.$store.state.helpersRef.getNodeById(conId)
const item = vm.$store.state.helpersRef.getNodeById(conId)
if (!item) return false
}
}
Expand Down Expand Up @@ -205,14 +205,14 @@ const methods = {
cancel(true)
}

if (!areAlldependenciesFound(draggingNodes)) {
if (!areAlldependenciesFound(this, draggingNodes)) {
if (draggingNodes.length === 1) {
this.showLastEvent('Cannot move the item as it has dependencies on a PBI or task level. Use the Product details view instead.', SEV.WARNING)
} else this.showLastEvent('Cannot move these items as one of them has dependencies on a PBI or task level. Use the Product details view instead.', SEV.WARNING)
cancel(true)
}

if (!areAllConditionsFound(draggingNodes)) {
if (!areAllConditionsFound(this, draggingNodes)) {
if (draggingNodes.length === 1) {
this.showLastEvent('Cannot move the item as it has conditions on a PBI or task level. Use the Product details view instead.', SEV.WARNING)
} else this.showLastEvent('Cannot move these items as one of them has conditions on a PBI or task level. Use the Product details view instead.', SEV.WARNING)
Expand Down

0 comments on commit d3af536

Please sign in to comment.