diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-03-10 02:05:28 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-11 11:02:21 -0700 |
commit | 9e09bc0f523df6d7fa30ad1a15e619e5622bffb1 (patch) | |
tree | d6185c40d813c11bbe508dd162497a604725d6ff | |
parent | d922dbbd99d1da3b86bff5371dd10d32aec2ac61 (diff) | |
download | subsurface-9e09bc0f523df6d7fa30ad1a15e619e5622bffb1.tar.gz |
HTML: Report start cylinder pressure correctly.
Report start cylinder pressure from the samples with empty value.
Must search for the first nonzero value.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-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 === "--") { |