Ticket #544 (closed defect: fixed)

Opened 6 months ago

Last modified 6 weeks ago

Sorting of translated POFiles is done by integer part of percentage instead of the actual float value.

Reported by: korki Owned by: korki
Priority: major Milestone: 1.0
Component: Core Version: devel
Keywords: Cc:
Easy Task: no Blocked By:
Blocking: Ready for Review: no
Patch Review: Needs Patch: yes

Description

For instance  http://www.transifex.net/projects/p/fetchmail/c/master/ are shown incorrectly.

Thanks to Matthias Andree that pointed this out

Change History

Changed 6 months ago by korki

  • owner set to korki
  • status changed from new to assigned
  • milestone changed from 0.8.1 to 0.9

This needs 3 changes
a) In the models of translations the

trans_perc = models.PositiveIntegerField?(default=0, editable=False)
fuzzy_perc = models.PositiveIntegerField?(default=0, editable=False)
untrans_perc = models.PositiveIntegerField?(default=100, editable=False)

needs to be FloatField?

b) @ line 248 @ file translations/models.py

self.trans_perc = round(float(self.trans * 100) / self.total, 2)
self.fuzzy_perc = round(float(self.fuzzy * 100) / self.total, 2)
self.untrans_perc = round(float(self.untrans * 100) / self.total, 2)

if we don't use the round function we need also to create a filter for the templatetag to present those better

c) create the south migrations to the database model.

Since on minor revisions we do not change the models i am moving this for 0.9 :)

Changed 6 months ago by glezos

Notes:

  1. Use from __future__ import division like I suggested, instead of float.
  2. We also need a template update (to convert to an integer or a one-digit number). There's the {{|floatformat}} filter.

Changed 6 months ago by korki

I am reluctant to use the from __future__ import division because according to  http://www.python.org/dev/peps/pep-0238/ the whole file module will be affected and I don't think that this is wanted

However do as you please.

Changed 6 weeks ago by glezos

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone changed from 0.9 to 1.0

Fixed in the 1.0 codebase.

Note: See TracTickets for help on using tickets.