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

Sort items by price doesn't work in rubles #95

Closed
pacopepepipo opened this issue Nov 1, 2018 · 3 comments · Fixed by #209
Closed

Sort items by price doesn't work in rubles #95

pacopepepipo opened this issue Nov 1, 2018 · 3 comments · Fixed by #209

Comments

@pacopepepipo
Copy link

pacopepepipo commented Nov 1, 2018

Hello

sorting listed prices when russian rubles (pуб) is the currency of the account, doesn't work right.

While the program sort them, it doesn't recognize correctly the items that are not using the "," comma for the decimals, so you end with items that have a value of 1000, sorted after items with a value of 10,xx

another example

item 1 = 1500,01
item 2 = 1500
item 3 = 15,15

the extension would sort the items by price like

item 1, item 3, item 2.

If the item price doesn't have a decimal, SEE will think that it's 15,00 instead of 1500.

https://i.imgur.com/Mt0dhU6.png

https://i.imgur.com/RJ7coBN.png

Could it be because on UK and US the decimal symbol is a point (.) and not a comma (,) so the program is confused?

this is also sorted by price, but I can't find the sense of this as 78, should be with 7,8?

https://i.imgur.com/VSXfpjN.png

it's really weird.

Also, I've been trying with a friend with an account in pounds and hundreds of items on sale and it works flawless to him, but here not, so really weird.

@Nuklon
Copy link
Owner

Nuklon commented Nov 3, 2018

I think it's not sorted correctly because RUB is very large. For example, 512 RUB vs 16,03 RUB would be parsed as 512 vs 1603 RUB. In USD/EUR this is all OK since 1,00 USD would be more than 0,02 USD. I would welcome a PR for this.

@pacopepepipo
Copy link
Author

Sorry, what PR means?

If I can help you to solve it, just tell me what data do you need and I gladly will give it to you.

thanks for the extension anways!

@xPaw
Copy link
Contributor

xPaw commented Jul 14, 2024

Can you test this code? It's using Valve's parser

            } else if (isPrice) {
                list.sort('market_listing_price', {
                    order: asc ? "asc" : "desc",
                    sortFunction: function(a, b) {
                        var listingPriceA = $(a.values().market_listing_price).text();
                        listingPriceA = listingPriceA.substr(0, listingPriceA.indexOf('('));

                        var listingPriceB = $(b.values().market_listing_price).text();
                        listingPriceB = listingPriceB.substr(0, listingPriceB.indexOf('('));

                        var firstPrice = unsafeWindow.GetPriceValueAsInt(listingPriceA);
                        var secondPrice = unsafeWindow.GetPriceValueAsInt(listingPriceB);

                        return firstPrice - secondPrice;
                    }
                })
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants