Coder Social home page Coder Social logo

wrong attribute update about ranked-model HOT 3 CLOSED

brendon avatar brendon commented on September 3, 2024
wrong attribute update

from ranked-model.

Comments (3)

mixonic avatar mixonic commented on September 3, 2024

@tommy-dev ranked-model gets its efficiency gain by not managing position, but instead only providing relative rankings in a large integer space. There is no guarantee there will not be a gap in the ranking.

This should be spelled out pretty clearly at the top of the Readme. It seems here that your ranking column (ranks, not positions) is very tightly clustered. That means a rank rebalance is happening on every change. This is definitely not optimal, maybe this is coming from old data in a position column?

Also, please upload an image without emails addresses, names and phone number.

from ranked-model.

tommybernaciak avatar tommybernaciak commented on September 3, 2024

Here is my implementation, based on the readme:
https://github.com/binarapps/sortable-tables
Position is a field used by ranked-model (ranks :position in user model)
My idea was to use this field as a position in the table, so after changing one elements position, other gonna be updated, and the order will be kept. The problem with update is that it doesnt take under consideration the previous position of changed element. In the posted pics you can see that in all elements after 5 position is added, that why there is a gap here.
If it is not going to work like this, please tell me so I will implement sth on my own. I just thought it is good gem for this task, but maybe I didnt understand how it is working.

And dont worry about the images, data is Faker generated so no real personal data is shown here. :)

from ranked-model.

mixonic avatar mixonic commented on September 3, 2024

@tommy-dev I remain very uncertain as to what you are trying to do.

ranked models stores a rank in the database. You should not manually be setting the rank. It provides a position attribute (explained on the readme) for reading the position, but this is merely a convenience.

If something is awry, a test or example code would help me understand what you are expecting to happen.

from ranked-model.

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.