From 2be5b68d3a7ff93a7f377296d9f3eaefaef8c4db Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Sat, 14 Dec 2024 11:05:33 +0100 Subject: [PATCH] when all the same version and java, sort runs by start time --- custom/spreadsheet-cfml/test/report.cfm | 29 ++++++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/custom/spreadsheet-cfml/test/report.cfm b/custom/spreadsheet-cfml/test/report.cfm index 1a31e06..0b6e259 100644 --- a/custom/spreadsheet-cfml/test/report.cfm +++ b/custom/spreadsheet-cfml/test/report.cfm @@ -30,6 +30,7 @@ "java": json.javaVersion, "version": json.CFMLEngineVersion, "totalDuration": json.totalDuration, + "startTime": json.startTime, "stats": queryToStruct(q, "suiteSpec") }); }; @@ -98,13 +99,29 @@ var sortedRuns = duplicate(runs); - arraySort( - sortedRuns, - function (e1, e2){ - return compare(e1.version & e1.java, e2.version & e2.java); - } - ); // sort runs by oldest version to newest version + // check if the version and java is all the same, then sort by starttime + var runKeys = {}; + loop array=sortedRuns index="r" item="i" { + runKeys[ i.version & i.java ] = true; + } + if ( structCount( runKeys ) eq 1 ){ + // all the same version and java, sort runs by start time + arraySort( + sortedRuns, + function (e1, e2){ + return compare( e1.startTime, e2.startTime ); + } + ); + } else { + // sort runs by oldest version to newest version + arraySort( + sortedRuns, + function (e1, e2){ + return compare( e1.version & e1.java, e2.version & e2.java ); + } + ); + } var hdr = [ "Suite / Spec" ]; var div = [ "---" ];