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

Issue occurs while using pagination on query builder , if no data is present #780

Closed
Bindukarkee opened this issue Jul 27, 2022 · 1 comment
Labels
bug An existing feature is not working as intended

Comments

@Bindukarkee
Copy link

Describe the bug

  • An issue occurred as "Error - 'NoneType' object has no attribute 'values'" when I use pagination on query builder.

  • This issue occurs when I don't have any data present on the given table.

Expected behaviour

The result should be null if no any data are present but it throws an error.

Steps to reproduce the bug

  1. Define a function inside any controller. For e.g:
from masonite.controllers import Controller
from masonite.views import View
from masonite.request import Request
from masonite.response import Response
from masoniteorm.query import QueryBuilder

class TestController(Controller):

 def testDocument(self, project_id):
    documents = QueryBuilder().table("documents").where('job_id', project_id).select_raw('document_type,JSON_ARRAYAGG(JSON_OBJECT("id", documents.id, "title", documents.title)) as documents').group_by("document_type").paginate(18, int(self.request.input('page') or 1))
    return documents
  1. Run the api of this function, an issue occur as "Error - 'NoneType' object has no attribute 'values'" while running it.

Screenshots

No response

OS

Linux

OS version

Ubuntu 18.04

Browser

Chrome

Masonite Version

4.6.1

Anything else ?

No response

@Bindukarkee Bindukarkee added the bug An existing feature is not working as intended label Jul 27, 2022
@josephmancuso josephmancuso transferred this issue from MasoniteFramework/masonite Jul 31, 2022
@josephmancuso
Copy link
Member

I can't replicate this. Can you share more information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants