diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-06-28 17:14:29 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-30 08:00:59 -0700 |
commit | 3a28507dc154907ecdc637a948fed41f8dd89ff0 (patch) | |
tree | fd3ee35cf0e6e52f3fe144577b923ec6156f55b2 /save-html.c | |
parent | a110b2858d91a3b998ddd93f99f2e108fbe7e021 (diff) | |
download | subsurface-3a28507dc154907ecdc637a948fed41f8dd89ff0.tar.gz |
HTML: Show nice values when pressure is not available
Show nice values instead of the undefined when the pressure is not
available.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-html.c')
-rw-r--r-- | save-html.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/save-html.c b/save-html.c index 451a3dab9..d459b0e6e 100644 --- a/save-html.c +++ b/save-html.c @@ -41,13 +41,23 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive) write_attribute(b, "Size", "--"); } put_pressure(b, cylinder->type.workingpressure, "\"WPressure\":\"", " bar\","); - put_pressure(b, cylinder->start, "\"SPressure\":\"", " bar\","); - put_pressure(b, cylinder->end, "\"EPressure\":\"", " bar\","); + + if (cylinder->start.mbar) { + put_milli(b, "\"EPressure\":\"", cylinder->start.mbar, " bar\","); + } else { + write_attribute(b, "EPressure", "--"); + } + + if (cylinder->end.mbar) { + put_milli(b, "\"SPressure\":\"", cylinder->end.mbar, " bar\","); + } else { + write_attribute(b, "SPressure", "--"); + } if (cylinder->gasmix.o2.permille) { - put_format(b, "\"O₂\":\"%u.%u%%\",", FRACTION(cylinder->gasmix.o2.permille, 10)); + put_format(b, "\"O2\":\"%u.%u%%\",", FRACTION(cylinder->gasmix.o2.permille, 10)); } else { - write_attribute(b, "O₂", "--"); + write_attribute(b, "O2", "--"); } put_string(b, "},"); } |