Skip to content
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

API returns duplicate project updates #206

Closed
osg74 opened this issue May 28, 2013 · 8 comments
Closed

API returns duplicate project updates #206

osg74 opened this issue May 28, 2013 · 8 comments
Assignees
Milestone

Comments

@osg74
Copy link

osg74 commented May 28, 2013

The RSR API call to retrieve project updates returns two of each update, e.g.

http://www.akvo.org/api/v1/project_update/?format=json&project__partnerships__organisation=912

@zzgvh
Copy link
Contributor

zzgvh commented May 28, 2013

This can be resolved by adding distinct=True to the query string. The call above would then look like this:

http://www.akvo.org/api/v1/project_update/?format=json&project__partnerships__organisation=912&distinct=True

Oli commented online that distinct=True should be the default behavior and that sounds like a good idea.

@zzgvh
Copy link
Contributor

zzgvh commented May 28, 2013

Duplicates should probably still happen when using the depth param since you will get different associated data for the duplicates of the "main" objects.

@osg74
Copy link
Author

osg74 commented May 28, 2013

Perhaps rather use the logic behind the depth param to determine when to return duplicates and otherwise return distinct results as discussed above.

@zzgvh zzgvh mentioned this issue Jul 9, 2013
@adriancollier
Copy link
Contributor

@zzgvh Is there a change needed in our API or should we just advise all our partners and modify our documentation to mentioned that distinct should be used on live API calls?

@adriancollier
Copy link
Contributor

@zzgvh your thoughts on this? Just wondering if we need to plan change for coding or for documentation/advice?

@zzgvh
Copy link
Contributor

zzgvh commented Sep 30, 2013

Coding done, but I'm not "publishing" it before we have a pull request workflow in place.

zzgvh added a commit that referenced this issue Oct 21, 2013
When querying the API using the depth paramter there are cases where
you can get multiple copies of the same related object, when that
object is related to more than one object of the "root" kind.

Change this so duplicates are filtered out by default. If for some
reason the dupicates are needed use distinct=False in the query string
of the request.
@zzgvh
Copy link
Contributor

zzgvh commented Oct 21, 2013

The fix was so small it felt like overkill to make a branch and pull request.

@adriancollier
Copy link
Contributor

Reviewed

@MichaelAkvo MichaelAkvo moved this to Done in RSR Dec 8, 2022
@MichaelAkvo MichaelAkvo added this to RSR Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants