Skip to content

[BUGFIX] Fixed EagerLoadingMixin early return error#898

Open
calumbell wants to merge 2 commits intoopen5e:stagingfrom
calumbell:897/EagerLoadingMixin-bugfix
Open

[BUGFIX] Fixed EagerLoadingMixin early return error#898
calumbell wants to merge 2 commits intoopen5e:stagingfrom
calumbell:897/EagerLoadingMixin-bugfix

Conversation

@calumbell
Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in the EagerLoadingMixin where the follow conditional:

if not requested_fields:

Would never evaluate as True due to requested_fields being an array and arrays being Truthy in Python. This was replaced with a call to any() (which outputs true if any of the elements of an array is not false/falsey)

if not any(requested_fields):

The way that the fields were filtered in this mixin was also refactored to fix some additoinal bugs that taking a look at this issue exposed: specifically fields being filtered by sub-string matches, which might mess with nested fields with the same name, ie. a Creatures name matching to its document__name.

Related Issue

Closes #897

How was this tested

  • pytest (all tests passing)
  • Spot checked on local Django develpoment server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] EagerLoadingMixin early return never occurs due to logic errors

1 participant