rafaelgomesxyz / esgst

An extension that enhances SteamGifts / SteamTrades.
MIT License
147 stars 23 forks source link

Fix a bug that does not filter giveaways correctly with the option to show game categories in real time enabled #837

Closed Eiion closed 6 years ago

Eiion commented 6 years ago

Comparing the two pictures you can see that after activating the i.e. trading cards filter it shows a number of affected giveaways on the filter but the list isn't properly filtered. https://i.imgur.com/2NyewIc.png https://i.imgur.com/ne5pwAw.png

Instead giveaways get filtered away that shouldn't be filtered in the first place (e.g. Attrition).

764esgst.js:8103 SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at gc_getCategories (esgst.js:7970)

Eiion commented 6 years ago

Fixed in new Dev. 3 version.

EDIT: I was wrong... it's not fixed. It works for the first three pages but for not after that. Maybe an issue caused by https://github.com/revilheart/ESGST/issues/829 ?

rafaelgomesxyz commented 6 years ago

Well, can you try disabling that option and seeing if it works? It could be that the filters are filtering before the categories are retrieved.

Eiion commented 6 years ago

Disabling 7.2.1 doesn't help. Additionally disabling 7.2.2 did. Only disabling 7.2.2 but having 7.2.1 active also did fix it. So 7.2.2 seems to be causing the issue.

rafaelgomesxyz commented 6 years ago

Thanks for the info.

Eiion commented 6 years ago

By the way, loading in game categories takes forever. About 40 seconds per page. Either steam is freaking slow today or the requests go out a bit too slow with 7.2.1 activated.

rafaelgomesxyz commented 6 years ago

That's normal with 7.2.1 activated. It slows down the requests to prevent the user from being blocked by the Steam store for making too many requests at a short period of time.

Eiion commented 6 years ago

But then there should be some kind of database where the categories get stored (or variables representing the categories) for all the games for a certain amount of days. Having to load them in new with every page refresh or going back and forward again on pages seems unnecessary a added up is quite time consuming.

(Besides, even with having it turned on, just from visiting a few won pages after turning on the PC a few minutes ago, the all page and back to the entered page got me the old "Access Denied You don't have permission to access "http://store.steampowered.com/app/593680" on this server. Reference #18.1dbb1002.1532388317.403dc7f".)

rafaelgomesxyz commented 6 years ago

Yes, but a database needs a server, and a server needs money to maintain on a monthly basis, which I don't have at the moment. I tried to have the database on a Google sheet (like I do for username history and reduced / no CV games), but it quickly went down because it wasn't able to handle it.

I added a Patreon page in the attempt to get a server. So far there is one person supporting, so maybe we'll get there (need 5 more).

Eiion commented 6 years ago

It could be lokal.

rafaelgomesxyz commented 6 years ago

There already is a local database, it's called the cache.

Eiion commented 6 years ago

It seems to be not working then if going back and forth again to the a page that has been visited just seconds before still needs to reload all the data for 40 seconds. I'm turning 7.2.1 off for now.

rafaelgomesxyz commented 6 years ago

That's probably it then. It should load them immediately if they just loaded (or take a few seconds if there are new games in the page). I'll look into it.

rafaelgomesxyz commented 6 years ago

What's weird is that in your screenshots Attrition doesn't have any tags, so it shouldn't be filtered regardless of what filters are configured.

Eiion commented 6 years ago

I'm not sure what you mean. According to the steam shop Attrition does not have trading cards so there's no trading card tag. It should be filtered away once the trading card filter gets activated in the second screenshot, which it does. The problem is that other giveaways for games without trading cards do not get filtered away once the filter gets activated. I wrote that wrong in the original post (but the screenshots show what I meant to say). And as said before, with Dev3. it works as intended - only for the first few pages though. After that, it doesn't filter correctly anymore.

SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at gc_getCategories (esgst.js:7973)

But yesterday more weird things happened... games showed the trading card tag that didn't have trading cards and vice versa but it was late and I gave up on it. Today I haven't checked for that, yet.

EDIT: And just after loading two pages I again get a temp suspension from the steam store with 7.2.2 turned on. Something's not working right. Though the "Access Denied" message shows only up for a few minutes rather than half an hour as usually. Odd.

rafaelgomesxyz commented 6 years ago

Ah okay, thanks for clarifying. That could just be because the categories for those giveaways in particular haven't finished loading or failed to load (which the error you posted showcases). In fact, I think this is very likely to be the case. The latest dev version (Dev.13) should add an error message to the giveaway if the categories failed to load, which can help separate giveaways that loaded and found no trading cards from giveaways that did not load at all.

Giveaways that failed to load (most likely because of the suspension) are not filtered by Game Categories filters, because that could be misleading.

The case of games showing the tag when they don't have it is very weird and it would be nice if you could identify which games are getting that specifically. The script retrieves all the info directly from the store API, so I don't see how it could show false information unless the API is providing wrong information.

And also in the latest dev version the cache problem should be gone, so revisiting the page again after loading it should not make the same requests anymore, which should alleviate some of that server stress.

So if you could try the latest dev version and see which issues remain that would be appreciated.

Eiion commented 6 years ago

The error message showed up for a few games after a while - but only for a few seconds. So I'm not sure if the missing data eventually came in or if there's a problem and the error message should not go away but stay.

I remembered only one game with false data and after looking into it, it seems that the data on the steam store is wrong i.e. there's other issues. So at least for that one I can say that ESGST causing it.

rafaelgomesxyz commented 6 years ago

The message does not go away for me, at least in the latest dev version. And with the new global limit it should be harder to get the message anyway. If you still have issues with it after I release v7.26.2, let me know. I'm closing this for now.