MasoniteFramework / orm

Masonite ORM is a beautiful Python ORM. It's also a nearly drop in replacement of the Orator ORM
https://orm.masoniteproject.com
MIT License
165 stars 48 forks source link

Query with where_in function returns out of list index error #701

Closed leannextang closed 2 years ago

leannextang commented 2 years ago

Describe the bug When I called defined function with where_in(), returns out of list index error.

To Reproduce Steps to reproduce the behavior:

  1. Set Model:
    
    Class BillingAccountProjectContracts(Model):
    @has_one('id', 'contract_id')
    def contract(self):
        return models.Contract
    @scope
    def bbc(self, query):
        return query.where_has(
              "contract", lambda query: query.where_in("company_id", [1,2,3,4])
        )
    
  2. call defined function: obj = models.BillingAccountProjectContracts.bbc().get()
  3. See error

Expected behavior Return collection which match the conditions.

Screenshots or code snippets image

Desktop (please complete the following information):

What database are you using?

Additional context None

josephmancuso commented 2 years ago

Can you upgrade Masonite ORM to latest version and try again? This should have been fixed in one of the latest releases

josephmancuso commented 2 years ago

Can reopen if it is still an issue

leannextang commented 2 years ago

Had updated to v2.12.0, but stil have the same problem...

josephmancuso commented 2 years ago

Ok thanks we'll look into this

josephmancuso commented 2 years ago

Also fixed in #709