Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

AgencyObject.stats_set retrieves office data. #813

Open
geramirez opened this issue May 19, 2015 · 2 comments
Open

AgencyObject.stats_set retrieves office data. #813

geramirez opened this issue May 19, 2015 · 2 comments
Milestone

Comments

@geramirez
Copy link
Contributor

I was looking closely at the Stats model and realized that using AgencyObject.stats_set returns the stats from both the Agency and Office. This bug isn't visible because it only affects agencies that have offices and we don't display stats for them.

We can fix the issue by either a quick patch to the API or changing the Stats model to work like the ReadingRoomUrls model. Personally, I rather refactor the Stats model.

@geramirez geramirez added the bug label May 19, 2015
@khandelwal
Copy link
Contributor

What is the manifestation of the code? Where do we use stats_set?

@geramirez
Copy link
Contributor Author

Ok so my bad. This is false alarm. My connect came from this test, which says is testing for both Office and Agency stats but only tests for office stats.

In general, however, we need to be very carful using the Stats model because AgencyObject.stats_set returns the stats for both the AgencyObject and all of its associated offices. I still don't think we should have a model like this but its probably not a priority to change it now.

@geramirez geramirez added this to the Backlog milestone May 19, 2015
@geramirez geramirez removed the bug label May 19, 2015
@geramirez geramirez changed the title stats_set cannot be used with Agency data AgencyObject.stats_set retrieves office data. May 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants