Skip to content

Commit

Permalink
Fix Summary dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisV committed Jan 27, 2023
1 parent 1d99152 commit 75665cb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions OpenNumismat/SummaryDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def fillSummary(self, model, filter_=None):
comment = self.tr("(calculated for %d coins)") % gold_quantity
else:
comment = self.tr("(calculated for %d/%d coins)") % (gold_quantity, gold_count)
gold_weight_str = locale.toString(gold_weight, format='f', precision=2)
gold_weight_str = locale.toString(float(gold_weight), format='f', precision=2)
lines.append(' '.join((self.tr("Gold weight: %s gramm") % gold_weight_str, comment)))

count_silver = 0
Expand Down Expand Up @@ -172,7 +172,7 @@ def fillSummary(self, model, filter_=None):
comment = self.tr("(calculated for %d coins)") % silver_quantity
else:
comment = self.tr("(calculated for %d/%d coins)") % (silver_quantity, silver_count)
silver_weight_str = locale.toString(silver_weight, format='f', precision=2)
silver_weight_str = locale.toString(float(silver_weight), format='f', precision=2)
lines.append(' '.join((self.tr("Silver weight: %s gramm") % silver_weight_str, comment)))

sql = "SELECT count(*) FROM coins WHERE status='wish'"
Expand Down Expand Up @@ -222,12 +222,12 @@ def fillSummary(self, model, filter_=None):
paid_without_commission = query.record().value(0)
if paid_without_commission:
commission = self.tr("(commission %d%%)") % ((paid - paid_without_commission) / paid_without_commission * 100)
paid_str = locale.toString(paid, format='f', precision=2)
paid_str = locale.toString(float(paid), format='f', precision=2)
lines.append(' '.join((self.tr("Paid: %s") % paid_str, commission)))

if count_owned:
val = paid / count_owned
val_str = locale.toString(val, format='f', precision=2)
val_str = locale.toString(float(val), format='f', precision=2)
lines.append(self.tr("Average paid per item: %s") % val_str)

earned = 0
Expand All @@ -245,17 +245,17 @@ def fillSummary(self, model, filter_=None):
earn_without_commission = query.record().value(0)
if earn_without_commission:
commission = self.tr("(commission %d%%)") % ((earn_without_commission - earned) / earn_without_commission * 100)
earned_str = locale.toString(earned, format='f', precision=2)
earned_str = locale.toString(float(earned), format='f', precision=2)
lines.append(' '.join((self.tr("Earned: %s") % earned_str, commission)))

if count_sold:
val = earned / count_sold
val_str = locale.toString(val, format='f', precision=2)
val_str = locale.toString(float(val), format='f', precision=2)
lines.append(self.tr("Average earn per item: %s") % val_str)

if paid and earned:
total = paid - earned
total_str = locale.toString(total, format='f', precision=2)
total_str = locale.toString(float(total), format='f', precision=2)
lines.append(self.tr("Total (paid - earned): %s") % total_str)

sql = "SELECT paydate FROM coins WHERE status IN ('owned', 'ordered', 'sale', 'sold', 'missing', 'duplicate') AND paydate<>'' AND paydate IS NOT NULL ORDER BY paydate LIMIT 1"
Expand Down

0 comments on commit 75665cb

Please sign in to comment.