Opened 5 years ago
Closed 5 years ago
#377 closed Defect (fixed)
count_annotations returns incorrect value
| Reported by: | kevinjardine | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Core | Version: | 1.0 |
| Severity: | major | Keywords: | |
| Cc: | brettp | Difficulty: |
Description
If the name specified for the annotation string is not already in the metastrings table, then count_annotations falsely returns the total number of annotations attached to the entity.
This is because the line:
$name = get_metastring_id($name);
returns an empty string in get_annotations_calculate_x
and the function erroneously assumes that a name was not specified.
Change History (2)
comment:1 in reply to: ↑ description Changed 5 years ago by kevinjardine
comment:2 Changed 5 years ago by ben
- Resolution set to fixed
- Status changed from new to closed
(In [svn:2133]) Count annotations now fails properly if a metastring is not found. Fixes #377
Note: See
TracTickets for help on using
tickets.

I should add that if $name is not-empty and get_metastring_id *is* empty, then the function can safely return a count (or sum or avg) of zero.