Giter VIP home page Giter VIP logo

Comments (10)

TobiTenno avatar TobiTenno commented on June 16, 2024

It's probably because they're never really sorted in a particular order....

from warframe-drop-data.

atomicptr avatar atomicptr commented on June 16, 2024

HM, I was more thinking in the lines of giving everything an _id, but sorting might actually be a good idea 🤔

from warframe-drop-data.

Senexis avatar Senexis commented on June 16, 2024

The referenced PR adds an "_id" field and fixes the issue, and it would fix the issue if merged, though instead of using the implementation I suggested in the PR might not be perfect as the conversation in the PR shows. 😄

A live preview of this: https://senexis.github.io/warframe-drop-data/diff.html, though due to the newly added "_id" field it all shows as new items.

from warframe-drop-data.

TobiTenno avatar TobiTenno commented on June 16, 2024

right, @atomicptr doing both.... give an id, sort by ID

from warframe-drop-data.

Senexis avatar Senexis commented on June 16, 2024

There's no need to sort the array as long as it has IDs. Sorting it doesn't add anything because all the transients already have a unique ID at that point and is good enough.

from warframe-drop-data.

TobiTenno avatar TobiTenno commented on June 16, 2024

right, but if the diff is comparing plain text and not id to id, then that would still be needed...

from warframe-drop-data.

Senexis avatar Senexis commented on June 16, 2024

It's not. It seemingly comparing to text (it doesn't; it's the order of the array) is only being done in the case when the ID is missing, so adding an ID to the transients is really good enough.

Edit: Turns out the entire thing is being sorted already anyway.

    function sortModName(a, b) {
        if (a.modName)   { return a.modName.localeCompare(b.modName) }
        else if (a._id)  { return a._id.localeCompare(b._id) }
    }

    function sortEnemyName(a, b) {
        if (a.enemyName) { return a.enemyName.localeCompare(b.enemyName) }
        else if (a._id)  { return a._id.localeCompare(b._id) }
    }

    function sortItemName(a, b) {
        if (a.itemName)  { return a.itemName.localeCompare(b.itemName) }
        else if (a._id)  { return a._id.localeCompare(b._id) }
    }

from warframe-drop-data.

atomicptr avatar atomicptr commented on June 16, 2024

@Senexis your diff page actually shows the one thing that bothers me about this, instead of seeing hey shit changed for this thing you just see "THIS GOT REMOVED", "THIS GOT ADDED". :D

from warframe-drop-data.

Senexis avatar Senexis commented on June 16, 2024

Yep, which is why the PR exists, to attempt to fix it. :-)

The only reason this is happening is because the transients never had an "_id" field.

from warframe-drop-data.

atomicptr avatar atomicptr commented on June 16, 2024

Fixed with #17

from warframe-drop-data.

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.