Merge branch 'Aufinal/arrondi_ukf' into k-fet

- Arrondis cohérents des UKF lors des divers affichages
- Remplace les arrondis par des floor pour éviter les négatifs de quelques
centimes

Fix #92

See merge request !124
This commit is contained in:
Aurélien Delobelle 2017-01-07 01:02:07 +01:00
commit 1bae76a405
2 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,7 @@ function amountDisplay(amount, is_cof=false, tri='') {
function amountToUKF(amount, is_cof=false) { function amountToUKF(amount, is_cof=false) {
var coef_cof = is_cof ? 1 + settings['subvention_cof'] / 100 : 1; var coef_cof = is_cof ? 1 + settings['subvention_cof'] / 100 : 1;
return Math.round(amount * coef_cof * 10); return Math.floor(amount * coef_cof * 10);
} }
function isValidTrigramme(trigramme) { function isValidTrigramme(trigramme) {

View file

@ -9,6 +9,7 @@ from django.utils.html import escape
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.core.cache import cache from django.core.cache import cache
from kfet.models import Settings from kfet.models import Settings
from math import floor
import re import re
register = template.Library() register = template.Library()
@ -37,5 +38,4 @@ def highlight_clipper(clipper, q):
@register.filter() @register.filter()
def ukf(balance, is_cof): def ukf(balance, is_cof):
grant = is_cof and (1 + Settings.SUBVENTION_COF() / 100) or 1 grant = is_cof and (1 + Settings.SUBVENTION_COF() / 100) or 1
# float nécessaire car sinon problème avec le round de future.builtins return floor(balance * 10 * grant)
return round(float(balance * 10 * grant))