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

Slaves not being removed from DB (I am guessing - in presence of Imperial slaves) #25

Closed
Tromador opened this issue Sep 17, 2018 · 5 comments

Comments

@Tromador
Copy link
Collaborator

See the following excerpt from my TradeDangerous.prices. There are no slaves presently for sale at this station (HR 8208/Sturgeon Station)

   + Slavery
      Imperial Slaves                 17152   17510          ?   139659M  2018-09-17 13:02:48
      Slaves                          11039   11650          ?    54801M  2018-09-15 18:03:56

My best guess is that because "Slaves" is a subset of "Imperial Slaves" it did not get deleted when the new station data was uploaded, you can see the disparity of date/time information.

@eyeonus
Copy link
Owner

eyeonus commented Sep 18, 2018

Yay. I'll look into it.

eyeonus added a commit that referenced this issue Sep 27, 2018
@eyeonus
Copy link
Owner

eyeonus commented Sep 27, 2018

So, the problem is, the plugin doesn't remove no longer existing items from the DB. I just hadn't implemented it.

I /think/ I have a solution, but I haven't tested it yet and I don't really have the time to do so right now.

I'm uploading it to the dev branch now, in case you want to test it. I'll push it to main once we know for sure it works.

@Tromador
Copy link
Collaborator Author

Other than that odd one I found, it's likely somewhat difficult to find test cases (or we would have found this before).

Is it reasonable to add "bogus" commodities to a given station by adding fake, but valid lines to the DB and then see if the plugin removes it?

@eyeonus
Copy link
Owner

eyeonus commented Sep 28, 2018

Do an update, remove some entries from one or more of the stations in the source file and save it. Do a second update with the force option, see if the entries you removed from the source file are gone in the DB.

The code I added, assuming no bugs or unintended results, does the following:

Set current station to -1, create empty dict.

For each item in the source file:

Check if current station matches item's station. (Will be false for the first item.)

If not, delete all items in the current dict set to false, delete the dict, set current station to the new station, and create a dict of all the possible items set to false

If so, set the current item to true in the dict.

@eyeonus
Copy link
Owner

eyeonus commented Oct 28, 2018

Fixed in 8a43404

@eyeonus eyeonus closed this as completed Oct 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants