diff options
Diffstat (limited to 'theme')
-rw-r--r-- | theme/list_lib.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js index ceaa9c9bc..986833a13 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -805,6 +805,14 @@ var points; //reference to the samples array of the shown dive. var ZERO_C_IN_MKELVIN = 273150; var plot1; +function firstNonZero() +{ + for(var i = 0; i <= items[dive_id].samples.length-1; i++){ + if(items[dive_id].samples[i][2] !== 0) + return items[dive_id].samples[i][2]; + } +} + function lastNonZero() { for(var i = items[dive_id].samples.length-1; i >= 0; i--){ @@ -847,7 +855,8 @@ function get_cylinder_HTML(cylinder) var cEPressure = cylinder.EPressure; if (cSPressure === "--") { - cSPressure = Math.round(put_pressure_unit(items[dive_id].samples[0][2])).toFixed(1) + " " + pressure_unit; + var nonZeroCSPressure = firstNonZero(); + cSPressure = Math.round(put_pressure_unit(nonZeroCSPressure)).toFixed(1) + " " + pressure_unit; } if (cEPressure === "--") { |