Giter Site home page Giter Site logo

Wrong model count about restfullyii HOT 1 CLOSED

evan108108 avatar evan108108 commented on July 26, 2024
Wrong model count

from restfullyii.

Comments (1)

evan108108 avatar evan108108 commented on July 26, 2024

The reason we don't use "count()" is that query results can be limited so
you will not get the total count. Imagine there are 100,000 results, in
this case we may return 100, if we use "count" the result count would be
100 and not 100,000.

If you are manipulating the findAll just make sure you do the same with the
count event. Remember that inside event callbacks that $this context is
your controller, so you can easily access any abstracted logic and apply to
both count and findAll events.

If you have noticed any specific instances (where you have not manipulated
the findall) and counts are incorrect, I would love to know about them as
that would imply a bug. Also I am open to suggestion if you have a better
way to do the count.

-Evan

On Wednesday, October 16, 2013, blitzjs wrote:

I've noticed in several instances where the model count is not correct,
especially if you modify the find.all events.

In the render event why not just use count($models) instead of performing
a stat query? The count should really reflect what is being passed as $data
and not gathered from another source (although in theory they should
match). Plus, doing a simple count() call will save another query execution.


Reply to this email directly or view it on GitHubhttps://github.com//issues/53
.

from restfullyii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.