-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
add an alternate flat locations fixture #12543
Conversation
Errors look real:
|
tmp_location = location | ||
while tmp_location.parent: | ||
tmp_location = tmp_location.parent | ||
attrs['{}_id'.format(tmp_location.location_type.code)] = tmp_location.location_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this looks useful!
@@ -60,6 +60,11 @@ def should_sync_locations(last_sync, location_db, restore_user): | |||
class LocationFixtureProvider(object): | |||
id = 'commtrack:locations' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snopoke I updated this fixture generator to optionally return two fixtures. as per the comment on https://github.com/dimagi/commcare-hq/blob/master/corehq/ex-submodules/casexml/apps/phone/fixtures.py#L33 it seems like I should change the id
to just be 'commtrack'
based on that change, but was wondering exactly how the ID is used. 'commtrack'
is also a prefix for the product fixture and not sure how that would affect it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea that should work. it will just mean that for any commtrack fixture requested by cloudcare it will generate both of these even if they aren't required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice thanks. ended up just making two providers with different IDs
I can definitely remove it form the new one. for the old one we can cover it in the migration conversation |
Looks g2m on build |
id = 'locations' | ||
|
||
def get_xml_nodes(self, restore_user, all_locations): | ||
if not toggles.FLAT_LOCATION_FIXTURE.enabled(restore_user.project.name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really that important since project is memoized, but more as an fyi the restore user has a domain
property that is exactly what this is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to use different providers and moved the location queries to the user so they could be cached. this should be g2g when ✅ |
✅ |
🌐 |
👍 |
This adds a feature flag that adds a second locations fixture in a flat format (which is often easier to work with in apps).
The format might change a bit, but want to iterate on this with kriti for UATBC.
@esoergel @sheelio and @proteusvacuum probably interested. can review either way. tried to break up by 🐟 but took a couple small detours.