API Sort Order

PhantomBot Version: v3.0.0
OS Version: Ubuntu 16.04.3 LTS
Java Version: 1.8.0_191
Browser and Version (for Panel Support): Chrome (72.0.3626.121)
Stock PhantomBot: Yes

Let us know what help you need:
I’ve recently moved to mySQL as a data source for my personal ease.
However I have noticed that the Sorting when using the web API is not pulling information through in the specified order.

An example below shows the query I’ve run and then the ‘User4’ being sorted to the lowest value even when this is higher. This affects both time and points which I’ve tested.
Is this an issue with the mysql database method?

/dbquery?table=points&getSortedRowsByValue&order=DESC&webauth=XXXX

{"table":
  {"table_name":"points","results":
    [
      {"key":"user1","value":"220"},
      {"key":"user2","value":"220"},
      {"key":"user3","value":"180"},
      {"key":"user4","value":"1000"}
    ]
  }
}

First off welcome to the Forum :slight_smile:

i do believe for some odd reason when using the mysql storage 0’s on the end of numbers dont seem to be picked up

example

  {"table_name":"points","results":
    [
      {"key":"user1","value":"22"},
      {"key":"user2","value":"210"},
      {"key":"user3","value":"1200"},
      {"key":"user4","value":"100"}
    ]
  }
}```

We will need to add a new API method or parameter that will call GetKeysByNumberOrder() rather than GetKeysByOrder() when the desire is to have numeric data sorted.

I have added this as a Bug to our internal tracking system.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.