# HG changeset patch # User verrierj # Date 1327674417 -3600 # Node ID 5e7942f049a6563bb51042de90ed132544816904 # Parent a400c401f78ba58919f6d04f94f7961b55f7de92 Fix bug in regenerating stat command diff -r a400c401f78b -r 5e7942f049a6 src/ldt/ldt/ldt_utils/stat.py --- a/src/ldt/ldt/ldt_utils/stat.py Fri Jan 27 15:18:36 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/stat.py Fri Jan 27 15:26:57 2012 +0100 @@ -76,6 +76,8 @@ def get_empty_stat_vector(): return [0] * (settings.DIVISIONS_FOR_STAT_ANNOTATION + 4) # + 4 for polemic syntax +def get_empty_stat_field(): + return ("%s" % get_empty_stat_vector())[1:-1].replace(' ', '') def find_buckets(buckets, limits, begin, end): diff -r a400c401f78b -r 5e7942f049a6 src/ldt/ldt/management/commands/statannotation.py --- a/src/ldt/ldt/management/commands/statannotation.py Fri Jan 27 15:18:36 2012 +0100 +++ b/src/ldt/ldt/management/commands/statannotation.py Fri Jan 27 15:26:57 2012 +0100 @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand from ldt.ldt_utils.models import Content -from ldt.ldt_utils.stat import update_stat_content, get_empty_stat_vector +from ldt.ldt_utils.stat import update_stat_content, get_empty_stat_vector, get_empty_stat_field class Command(BaseCommand): help = 'Computes annotation for all contents' @@ -13,7 +13,7 @@ for c in Content.objects.all(): if not c.stat_annotation or len( c.stat_annotation.split(',')) != size_stat: - c.stat_annotation = c.list2str(empty_stat_vector) + c.stat_annotation = get_empty_stat_field() c.save() update_stat_content(c)