Don't show a SAC of 0.0l/min (or cuft/min)

When we have no data about the gas consumption it makes no sense to show a
SAC of 0. Instead we should show either "unknown" or nothing.

Fixes #693

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-08-06 07:38:18 -07:00
parent eb63ccfed5
commit 74e7b8e879
2 changed files with 21 additions and 9 deletions

View file

@ -1263,10 +1263,13 @@ QString DiveItem::displaySac() const
{
QString str;
struct dive *dive = get_dive_by_uniq_id(diveId);
const char *unit;
int decimal;
double value = get_volume_units(dive->sac, &decimal, &unit);
return QString::number(value, 'f', decimal).append(unit).append(tr("/min"));
if (dive->sac) {
const char *unit;
int decimal;
double value = get_volume_units(dive->sac, &decimal, &unit);
return QString::number(value, 'f', decimal).append(unit).append(tr("/min"));
}
return QString("");
}
QString DiveItem::displayWeight() const