diff --git a/theme/list_lib.js b/theme/list_lib.js
index 718ea4cc7..798c40a41 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -669,13 +669,32 @@ var points; //reference to the samples array of the shown dive.
var ZERO_C_IN_MKELVIN = 273150;
var plot1;
+function lastNonZero()
+{
+ for(var i = items[dive_id].samples.length-1; i >= 0; i--){
+ if(items[dive_id].samples[i][2] != 0)
+ return items[dive_id].samples[i][2];
+ }
+}
+
/**
*Return the HTML string for a dive cylinder entry in the table.
*/
function get_cylinder_HTML(cylinder)
{
- return '
| ' + cylinder.Type + ' | ' + cylinder.Size + ' | ' + cylinder.WPressure + ' | ' +
- '' + cylinder.SPressure + ' | ' + cylinder.EPressure + ' | ' + cylinder.O2 + ' |
';
+ var cSPressure = cylinder.SPressure;
+ var cEPressure = cylinder.EPressure;
+
+ if (cSPressure === "--") {
+ cSPressure = mbar_to_bar(items[dive_id].samples[0][2]) + " bar";
+ }
+
+ if (cEPressure === "--") {
+ var nonZeroCEPressure = lastNonZero();
+ cEPressure = mbar_to_bar(nonZeroCEPressure) + " bar";
+ }
+
+ return '| ' + cylinder.Type + ' | ' + cylinder.Size + ' | ' + cylinder.WPressure + ' | ' + '' + cSPressure + ' | ' + cEPressure + ' | ' + cylinder.O2 + ' |
';
}
/**
@@ -705,6 +724,7 @@ function get_bookmark_HTML(event)
*/
function get_bookmarks_HTML(dive)
{
+ if (dive.events <= 0) return "";
var result = "";
result += 'Events
| Name | Time |
';
for (var i in dive.events) {