Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-7238: refactor a few var names for clarity, fix indexing issue im… #15

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/services/export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ export class ExportService {
let headerRow = [];
const testCasesData = [];
//failed test cases will have red text font
const failedIndexes = [];
let index: number = 3;
const failedRows = [];
let rowNumber: number = 3;
testCaseGroupDto.testCaseExecutionResults.forEach(
(result: TestCaseExecutionResultDto) => {
const firstRowData = [];
Expand All @@ -198,10 +198,9 @@ export class ExportService {
testCaseData,
population,
result,
index,
failedIndexes,
rowNumber,
failedRows,
);
index += 1;
});
populations?.forEach((population) => {
headerRowData.push(population.name);
Expand All @@ -212,7 +211,7 @@ export class ExportService {
testCasesData.push(testCaseData);
firstRow = firstRowData;
headerRow = headerRowData;
index += 1;
rowNumber += 1;
},
);
this.populateFirstRow(worksheet, firstRow);
Expand All @@ -226,7 +225,7 @@ export class ExportService {
testCasesData.forEach((testCaseData) => {
worksheet.addRow(testCaseData);
});
failedIndexes.forEach((index) => {
failedRows.forEach((index) => {
worksheet.getRow(index).font = { color: { argb: 'ff0000' } };
});
this.adjustColumnWidth(worksheet);
Expand All @@ -236,8 +235,8 @@ export class ExportService {
testCaseData,
populationDto: PopulationDto,
result,
index: number,
failedIndexes: number[],
rowNumber: number,
failedRows: number[],
) {
let foundPopulation: PopulationDto = null;
result.populations?.forEach((currentPopulation) => {
Expand All @@ -246,9 +245,9 @@ export class ExportService {
}
});
if (foundPopulation?.expected !== foundPopulation?.actual) {
if (failedIndexes.indexOf(index) === -1) {
if (failedRows.indexOf(rowNumber) === -1) {
//if not in the array
failedIndexes.push(index);
failedRows.push(rowNumber);
}
}
testCaseData.push(foundPopulation?.expected);
Expand Down
Loading