New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected result from elgg_list_entities_from_annotation_calculation (Trac #4393) #4393
Comments
ewinslow wrote on 42365480-04-07 I'm confused about what the problem is. Your description sounds like the appropriate behavior. |
brettp wrote on 42366179-06-12 This is a documentation problem. It needs to be clearer what count means in this context. |
cash wrote on 42373059-11-23 I would expect it to count the entities, not the annotations. |
trac user coldtrick wrote on 42374723-03-17 cash: +1 The problem is it counts the annotations not the entities. thus with only two blogs (which have more then 10 pageviews) I get pagination :( |
Milestone changed to |
cash wrote on 42479763-10-08 There is a more fundamental problem with the annotation code. The query generated looks like this:
The problem with elgg_list_entities_from_annotation_calculation() is that it uses elgg_get_entities_from_annotation_calculation() to do a count. The annotation code supports a shortcut of passing 'count' for an annotation count. If I turn off the shortcut, the count gets ignored because elgg_get_metastring_based_objects() does not support counting entities. If the metadata/annotation code documentation says nothing about supporting 'count' for counting annotations/metadata, then I may be able to remove that shortcut and add code to support counting entities. Longer term, we should think about improving this code. |
trac user mrclay wrote on 42732055-09-20 Is this still high priority, or can it go in a later release? Sounds like Cash has one solution, is this implementable anytime soon? |
cash wrote on 42737441-08-08 It can go in a later release. The solution wasn't that clean. |
Milestone changed to |
Milestone changed to |
Milestone changed to |
Milestone changed to |
@cash Could you please take look? I think this fixes the problem. I have added more tests with the same PR |
redirecting to @Elgg/owners since I'm not an active Elgg developer |
Allow custom or no callback in Annotations::getEntitiesFromCalculation() Fixes Elgg#7398 fix(metastrings): cast metastring calculation to an integer egefac() with count => true was returning a string, which was not in line with the documentation and general ege* pattern fix(annotations): fixes egefac() count shortcut Passing count => true to egefac() makes ege* logic identitical to a normal elgg_get_entities_from_annotations(). Fixes Elgg#4393 chore(tests): improve egefac() test coverage Adds more egefac() tests and cleans up some of the lint
Annotations::getEntitiesFromCalculation() now allows custom or no callback. Metastring calculations returned by ege* are now cast as integer. Passing count => true to elgg_get_entities_from_annotation_calculation() now uses elgg_get_entities_from_annotations() (this removes the magic and flags used previously). Adds more egefac() tests and cleans up some of the lint. Fixes Elgg#7398, Elgg#4393
Original ticket http://trac.elgg.org/ticket/4393 on 42166844-10-28 by trac user coldtrick, assigned to unknown.
Elgg version: 1.8
use case:
i log every view of a blog in an annotation. I added a tab on blogs to show the popular (most viewed) blogs.
i've setup my options as:
this will result in the 10 most viewed blog in the past 30 days.
Now the problem:
If i use elgg_get_entities_from_annotation_calculation i get the object i requested, for example 2 blogs.
If i use elgg_list_entities_from_annotation_calculation i still get a list of the same 2 blog, but (depending on the number of views these blogs have) i get pagination.
This is because if you tell elgg_get_entities_from_annotation_calculation to count ($options["count"] = true) it counts the number of annotations, not the number of entities with the annotation. This is done in elgg_get_metastring_based_objects()
The text was updated successfully, but these errors were encountered: