Index: openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl,v
diff -u -r1.1.2.8 -r1.1.2.9
--- openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl 17 Feb 2021 08:22:51 -0000 1.1.2.8
+++ openacs-4/packages/acs-automated-testing/tcl/coverage-procs.tcl 27 Feb 2021 20:17:05 -0000 1.1.2.9
@@ -130,7 +130,27 @@
}
return "procs $procs covered $procs_covered coverage [format {%0.2f} $coverage]"
}
+ad_proc -private aa::percentage_to_color {
+ percentage
+} {
+ Calculates a color from the percentage. 0 gives red, 100 gives
+ green.
+ @author Gustaf neumann
+
+ @param percentage A value between 0 and 100.0
+ @return color code in hex (three double-digit figures)
+} {
+ set red 255
+ set green 255
+ if {$percentage >= 0 && $percentage <= 50} {
+ set green [expr {510 * $percentage/100.0}]
+ } elseif {$percentage > 50.0 && $percentage <= 100.0} {
+ set red [expr {-510 * $percentage/100.0 + 510}]
+ }
+ return [format %.2x [expr {int($red)}]][format %.2x [expr {int($green)}]]00
+}
+
ad_proc -public aa::coverage::proc_coverage_level {
coverage
} {
Index: openacs-4/packages/acs-automated-testing/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/admin/index.adp,v
diff -u -r1.21.2.9 -r1.21.2.10
--- openacs-4/packages/acs-automated-testing/www/admin/index.adp 3 Sep 2019 09:14:50 -0000 1.21.2.9
+++ openacs-4/packages/acs-automated-testing/www/admin/index.adp 27 Feb 2021 20:17:05 -0000 1.21.2.10
@@ -138,7 +138,8 @@
- |
- |
- |
- @packageinfo.proc_coverage@% |
+
+ @packageinfo.proc_coverage@% |
@packageinfo.total@ |
@packageinfo.passes@ |
@@ -155,12 +156,14 @@
OK
- @packageinfo.proc_coverage@% |
+
+ @packageinfo.proc_coverage@% |
-
+ |
Global proc coverage: @global_test_coverage_percent@%
|
Index: openacs-4/packages/acs-automated-testing/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/admin/index.tcl,v
diff -u -r1.16.2.7 -r1.16.2.8
--- openacs-4/packages/acs-automated-testing/www/admin/index.tcl 5 Sep 2019 13:58:39 -0000 1.16.2.7
+++ openacs-4/packages/acs-automated-testing/www/admin/index.tcl 27 Feb 2021 20:17:05 -0000 1.16.2.8
@@ -101,17 +101,22 @@
set global_test_coverage [aa::coverage::proc_coverage]
set global_test_coverage_percent [dict get $global_test_coverage coverage]
set global_test_coverage_level [aa::coverage::proc_coverage_level $global_test_coverage_percent]
+ set global_test_coverage_color [aa::percentage_to_color $global_test_coverage_percent]
+
#
# Prepare the template data for a view_by "package"
#
- template::multirow create packageinfo key total passes fails warnings proc_coverage proc_coverage_level
+ template::multirow create packageinfo key total passes fails warnings proc_coverage proc_coverage_level color
foreach package_key [lsort [array names packages]] {
- #ns_log notice "view_by $view_by package_key=$package_key"
lassign $packages($package_key) total passes fails warnings
set proc_coverage [dict get [aa::coverage::proc_coverage -package_key $package_key] coverage]
set proc_coverage_level [aa::coverage::proc_coverage_level $proc_coverage]
+ set proc_coverage_color [aa::percentage_to_color $proc_coverage]
+ #ns_log notice "view_by $view_by package_key=$package_key $proc_coverage_level $proc_coverage_color"
- template::multirow append packageinfo $package_key $total $passes $fails $warnings $proc_coverage $proc_coverage_level
+ template::multirow append packageinfo $package_key $total \
+ $passes $fails $warnings \
+ $proc_coverage $proc_coverage_level $proc_coverage_color
}
} else {
#