gerwaric / acquisition

Stash and forum shop management for Path of Exile
GNU General Public License v3.0
16 stars 3 forks source link

All prices listed as "just now" #14

Closed aiolos01 closed 10 months ago

aiolos01 commented 10 months ago

Acquisition used to display how old a listing was. This worked even for prices that were set using the premium tab interface. Now it displays all items as listed "just now". And this never changes, even after hours of running acquisition, all items stay listed as "just now".

I can't be 100% sure but I believe the previous version worked correctly. I also checked the poe search engine and all items display the correct listing age there.

gerwaric commented 10 months ago

Thanks for reporting this. I'll look into where that age information comes from and see if I can get it working again.

gerwaric commented 10 months ago

This should be fixed in v0.10.1

aiolos01 commented 10 months ago

It's still not fixed in my case. All prices now have the same age. They're not stuck at "just now" but they're all listed as 10 min ago which is the time I updated the tabs. Looked again at the PoE search engine and all prices there are listed with their proper age.

gerwaric commented 10 months ago

Reopened.

Are these buyouts you set in acquisition, or in game, or both?

The fact the trade site still sees the correct dates is encouraging.

aiolos01 commented 10 months ago

Both, And both used to work properly in previous versions so it's some regression that broke it.

gerwaric commented 10 months ago

It was the port from Qt 5 to Qt 6, because there are some QDateTime methods that acquisition used that went away in Qt 6.

(Qt 5 is unfortunately already officially past it's end of support, except for paying enterprise customers, and it no longer works on macOS at all without building it from source, which I've had trouble with because it won't build with the current version of Xcode).

gerwaric commented 10 months ago

Now I'm not sure this is fixable, except by going to back to the automatically backed-up data folder.

There's nothing in the json returned by the API about when the item (or tab) was listed. That means Acquisition must be using the dates stored internally. Since those dates were messed up by v0.9.10, the only way to restore them that I can think of is to go back to a previous data director, which acquisition backs up in %appdata%/Local/acquisition. There were no changes to the database format, so it should work. However, that will mean losing any buyouts you've set in acquisition since then.

I'll try doing this with the current version later today or tomorrow and report back.

In the meantime, if you try it yourself, please keep extra copies of all the relevant data folders, just in case.

I'm not sure where the trade site is getting it's date information. I suspect it's stored internally, but there's nothing that I can see in the json that Acquision gets from the old-school api, and nothing in the current [https://www.pathofexile.com/developer/docs/reference#stashes](account stash api), either.

aiolos01 commented 10 months ago

Indeed I tried the previous versions again and they displayed the same time for all prices. As you suggested I restored the prices from the 0.9.9 backup and now the old prices (those that were part of that backup) display correctly. The new ones are shown as just priced.

It's strange that you don't see a date in the item json. If you can't get the age of the listing then how is awakened poe trade displaying this information when you search for item prices? Acquisition does have a backup of all user items so it could be stored there (easy to check I suppose) but APT just fetches some results from the search engine.

gerwaric commented 10 months ago

I think awakened poe trade is using the trade api, which is a whole different beast. I don't the trade api is officially documented anywhere, but then again, neither is the legacy api that acquisition uses.

Were you able to get the behavior with your wanted using v0.10.1 by copying an old data folder over? If so, I'd like to close this issue, otherwise, I'll keep it open so I know it still needs work.

aiolos01 commented 10 months ago

Yesterday when I restored the backup all the old prices had the right dates. As long as I had it running everything was ok. The prices that were not part of the backup were of course set to "now".

Today I reopened acquisition and everything is set at 14 hours. So it seems that acquisition reset everything in the database even though while it was running it was displaying the correct age. I assume this happened when I closed it because that was 14h ago.

gerwaric commented 10 months ago

Do you have any data folders from v0.9.7?

If so, please try one. I think it might solve the problem, but I don't have any to test with myself, so I'm not sure.

Otherwise, I think you can "fix" the problem by opening the latest version of Acquisition once using a data folder from v0.9.9-beta.1 or later, then closing Acquisition. This will reset all of the last update times. Unfortunately, this resets them to the time you closed Acquisition. However, from that point forward Acquisition should keep track of the update times properly.

I've tested this on my computer, and it seems to work. If it works for you, is this an acceptable solution?

Notes:

gerwaric commented 10 months ago

Thank you for helping me narrow down the problem. I think I found it.

Like you figured out, It was a regression introduced in v0.9.10, which was when I ported Acquisition from Qt 5 to Qt 6. The functions acquisition had used to save/load timestamps into the database were removed from Qt 6. I got the replacements wrong in two places. As a result, buyouts were being saved with the current system time instead of the time associated with the buyout. That's why resetting the data folder fixed the problem, but only at first. (There were actually two bugs, but up until this morning I was missing one of them).

There's a fix in v0.9.11-beta.1: https://github.com/gerwaric/acquisition/releases/tag/v0.9.11-beta.1

Before making a non-beta release, I would very much like someone to confirm that it's working--if or when either of you have time.

In my own testing, I didn't have any pre-0.9.9 datafiles to work with, so all my existing buyouts are bugged due to beta 1. (For anyone who skipped that beta, this shouldn't be a problem). Those bugged buyouts get reset to the current time the first time I load them. However, they are not reset again in the way you described. I'm able to open and close acquisition repeatedly without losing the last update time. Hopefully this works for you as well.

aiolos01 commented 10 months ago

First of all sorry for the confusion, I posted the previous message from my work account. Forgot to switch.

I tried the beta version you posted and the problem seems to be fixed now. All the old prices keep their age after closing acquisition. I added a new item, waited a bit then restarted acquisition and the time is saved normally.

Almost everything works now. I say almost because I have 5 items whose age resets every time I restart acquisition. Everything else is ok but for some reason those 5 items are always shown as "just now" at every application start. I tried changing their prices but they are not updated in acquisition. I removed them from the tab, refreshed and then put them back. That seems to have fixed things. I'm only reporting this because it might reappear. For now everything seems to work.

Thanks for fixing this.

gerwaric commented 10 months ago

Thanks again for helping me track this down. I will update v0.9.11, and bring this fix into the v0.10 series as well.

I've untagged that account from my comment, so you're welcome to delete that reply if you like to keep your personas separate.

This has been a useful learning exercise for me, because I'm going to have to redo how items and buyouts are stored before Acquisition moves to OAuth. Currently acquisition creates an MD5 hash of the json objects returned by GGG, and uses this hash as the key in the database. The problem is that acquisition uses the legacy api. When we switch to OAuth, the api will change, which means different json, which means different hashes, which means all the items and buyouts in your data files will become useless.

If I change the database like that, it means everyone has to start over, so I'm thinking about how to import databases from older versions, e.g. v0.9.x or v0.x10.x.

My plan is to use the unique id field returned by GGG with every item and stash tab as the database keys. I've looked into the code for the early versions of acquisition back in 2014, and there was no sign of this field, so I suspect GGG added it somewhere along the way. Hopefully this is the last big bug with the current version of acquisition, so I can focus on the backend rewrite.

I'm going to go ahead and close this issue (again), but I can reopen if it something else comes up.