Skip to content

Commit

Permalink
Fix threshold colorize
Browse files Browse the repository at this point in the history
  • Loading branch information
suecharo committed Sep 17, 2022
1 parent 047ad82 commit 32890d4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export function compareSummaryContent(
if (val1 == undefined || val2 == undefined) {
return ReproducibilityLevel.DIFFERENT_FEATURES;
}
if (Math.abs(val1 - val2) / val1 < threshold) {
if (Math.abs(val1 - val2) / val1 <= threshold) {
return ReproducibilityLevel.SIMILAR_FEATURES;
} else {
return ReproducibilityLevel.DIFFERENT_FEATURES;
Expand Down Expand Up @@ -501,8 +501,12 @@ export function renderFileStats(
formattedVal1 = color.red(formattedVal1);
formattedVal2 = color.red(formattedVal2);
} else if (result === ReproducibilityLevel.SIMILAR_FEATURES) {
formattedVal1 = color.yellow(formattedVal1);
formattedVal2 = color.yellow(formattedVal2);
if (val1 == val2) {
// do nothing => same value
} else {
formattedVal1 = color.yellow(formattedVal1);
formattedVal2 = color.yellow(formattedVal2);
}
}
data.rows.push([a1(header), formattedVal1, formattedVal2]);
};
Expand Down

0 comments on commit 32890d4

Please sign in to comment.