# HG changeset patch # User verrierj # Date 1327677414 -3600 # Node ID 260f3438cb7875dd047f411095e20f68df1a40e3 # Parent 1c4894a4de729f96987f269c5b6093f323ceb1fb Fix bug when annotations are added in the metadataplayer diff -r 1c4894a4de72 -r 260f3438cb78 src/ldt/ldt/api/ldt/handlers.py --- a/src/ldt/ldt/api/ldt/handlers.py Fri Jan 27 15:57:14 2012 +0100 +++ b/src/ldt/ldt/api/ldt/handlers.py Fri Jan 27 16:16:54 2012 +0100 @@ -175,7 +175,7 @@ content = project.contents.get(iri_id=a['media']) - add_annotation_to_stat(content, project, a['begin'], a['end']) + add_annotation_to_stat(content, a['begin'], a['end']) # We update the ids a['type'] = type_id diff -r 1c4894a4de72 -r 260f3438cb78 src/ldt/ldt/ldt_utils/stat.py --- a/src/ldt/ldt/ldt_utils/stat.py Fri Jan 27 15:57:14 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/stat.py Fri Jan 27 16:16:54 2012 +0100 @@ -52,12 +52,16 @@ def add_annotation_to_stat(content, begin, end): - + nb_division = settings.DIVISIONS_FOR_STAT_ANNOTATION + if not content.nb_annotation or not content.stat_annotation: content.nb_annotation = 1 content.stat_annotation = get_empty_stat_vector() - buckets = find_buckets(content.stat_annotation, begin, end) + size_division = content.duration / nb_division + limits = [x * size_division for x in range(nb_division+1)] + + buckets = find_buckets(content.annotation_volume, limits, begin, end) content.annotation_volume = buckets content.last_annotated = datetime.datetime.now()