Changed task sort logic. Adjusted test cases.
This commit is contained in:
parent
0d82c5b39b
commit
83eb1b5000
|
|
@ -232,8 +232,15 @@ export function buildBigSmallReportRows(
|
||||||
const clientLossIndex = BIG_SMALL_HEADERS.indexOf('Ведет к потере клиента');
|
const clientLossIndex = BIG_SMALL_HEADERS.indexOf('Ведет к потере клиента');
|
||||||
const executorIndex = BIG_SMALL_HEADERS.indexOf('Исполнитель');
|
const executorIndex = BIG_SMALL_HEADERS.indexOf('Исполнитель');
|
||||||
const taskTypeIndex = BIG_SMALL_HEADERS.indexOf('Большая или мелкая');
|
const taskTypeIndex = BIG_SMALL_HEADERS.indexOf('Большая или мелкая');
|
||||||
|
const parentTaskIdIndex = BIG_SMALL_HEADERS.indexOf('ID Р. задачи');
|
||||||
|
|
||||||
body.sort((a, b) => {
|
body.sort((a, b) => {
|
||||||
|
const parentTaskIdA = a[parentTaskIdIndex];
|
||||||
|
const parentTaskIdB = b[parentTaskIdIndex];
|
||||||
|
if (parentTaskIdA != parentTaskIdB) {
|
||||||
|
return String(parentTaskIdA).localeCompare(String(parentTaskIdB));
|
||||||
|
}
|
||||||
|
|
||||||
const clientLossA = a[clientLossIndex];
|
const clientLossA = a[clientLossIndex];
|
||||||
const clientLossB = b[clientLossIndex];
|
const clientLossB = b[clientLossIndex];
|
||||||
if (clientLossA != clientLossB) {
|
if (clientLossA != clientLossB) {
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,9 @@ describe('buildBigSmallReportRows', () => {
|
||||||
expect(result.length).toBe(2);
|
expect(result.length).toBe(2);
|
||||||
expect(result[1][0]).toBe('ЕПМ* Подзадача А');
|
expect(result[1][0]).toBe('ЕПМ* Подзадача А');
|
||||||
expect(result[1][1]).toBe('ЕПБ* Родитель');
|
expect(result[1][1]).toBe('ЕПБ* Родитель');
|
||||||
expect(result[1][7]).toBe('М');
|
expect(result[1][8]).toBe('М');
|
||||||
expect(result[1][11]).toBe(60);
|
expect(result[1][12]).toBe(60);
|
||||||
expect(result[1][12]).toBe('Да');
|
expect(result[1][13]).toBe('Да');
|
||||||
expect(result[1][6]).toBe('сделка 1');
|
expect(result[1][7]).toBe('сделка 1');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue