Commit e49f8928 authored by Romain DELEAU's avatar Romain DELEAU

fix on move up/down task

parent 33ae663c
...@@ -63,7 +63,7 @@ export class Role { ...@@ -63,7 +63,7 @@ export class Role {
this.tasks[i][j + 1] = tmp; this.tasks[i][j + 1] = tmp;
} else if (direction == 'top') { } else if (direction == 'top') {
if (!(this.tasks[i - 1].some(element => element instanceof Task))) { if (!(this.tasks[i - 1].some(element => element instanceof Task))) {
this.tasks[i - 1][j] = tmp; this.tasks[i - 1][this.getRealIndex(i,j)] = tmp;
this.tasks[i][j] = null; this.tasks[i][j] = null;
} else if (this.tasks[i - 1].some(element => element?.type == 'final' || element?.type == 'repeat')) { } else if (this.tasks[i - 1].some(element => element?.type == 'final' || element?.type == 'repeat')) {
if (this.tasks[i][j]?.type == 'final' || this.tasks[i][j]?.type == 'repeat') { if (this.tasks[i][j]?.type == 'final' || this.tasks[i][j]?.type == 'repeat') {
...@@ -101,7 +101,7 @@ export class Role { ...@@ -101,7 +101,7 @@ export class Role {
this.tasks[i + 2] = []; this.tasks[i + 2] = [];
} }
if (!(this.tasks[i + 1].some(element => element instanceof Task))) { if (!(this.tasks[i + 1].some(element => element instanceof Task))) {
this.tasks[i + 1][j] = tmp; this.tasks[i + 1][this.getRealIndex(i,j)] = tmp;
this.tasks[i][j] = null; this.tasks[i][j] = null;
} else if (this.tasks[i + 1].some(element => element?.type == 'final' || element?.type == 'repeat')) { } else if (this.tasks[i + 1].some(element => element?.type == 'final' || element?.type == 'repeat')) {
if (this.tasks[i][j]?.type == 'final' || this.tasks[i][j]?.type == 'repeat') { if (this.tasks[i][j]?.type == 'final' || this.tasks[i][j]?.type == 'repeat') {
...@@ -154,38 +154,8 @@ export class Role { ...@@ -154,38 +154,8 @@ export class Role {
return res; return res;
} }
/*
getRealIndex(i: number, j: number): number { getRealIndex(i: number, j: number): number {
let realj: number = 0; let realj: number = 0;
let index: number = 0;
while (index < j) {
let task: Task|null = this.tasks[i][index];
if (task instanceof Task) {
if (task.durationUnit == 'UT') {
if (task.duration <= 10) {
index = index+task.duration;
realj++;
} else {
index = index + 10;
realj++;
}
} else {
realj++;
index++;
}
} else {
realj++;
index++;
}
}
return realj;
}
*/
getRealIndex(i: number, j: number): number {
let realj: number = 0;
for(let k = 0; k < j; k++) { for(let k = 0; k < j; k++) {
let task: Task|null = this.tasks[i][k]; let task: Task|null = this.tasks[i][k];
if (task instanceof Task) { if (task instanceof Task) {
...@@ -202,7 +172,6 @@ export class Role { ...@@ -202,7 +172,6 @@ export class Role {
realj++; realj++;
} }
} }
return realj; return realj;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment