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

add-ons can and probably should be checked every refresh #49

Open
eengstrom opened this issue Dec 9, 2015 · 7 comments
Open

add-ons can and probably should be checked every refresh #49

eengstrom opened this issue Dec 9, 2015 · 7 comments

Comments

@eengstrom
Copy link
Contributor

The current method of checking for add-ons does so infrequently (depending upon config). It should be easy to track existing unshipped traders and ship additional cards to them every time we refresh the trades page and search for new bundles.

@eengstrom
Copy link
Contributor Author

I have a partial solution that I hacked together this afternoon. Will test and then send you a pull-request.

@tomreece
Copy link
Owner

@eengstrom Cool. I'm anxious to see what you come up with! In the current implementation, you can remove the "minutes_between_add_ons_check" key altogether from config and it will check for add-ons every cycle. So like: check for addons, check for bundles, check for addons, check for bundles, etc.

I'm assuming you have a plan where these are combined by keeping track of things in a dict or something. I'm anxious to see your solution! Thanks for contributing!

@eengstrom
Copy link
Contributor Author

Running live tests now. I think I've got it right, though you may not like the volume of changes I made. If you want, I can generate a pull request from my always_addon branch now, but I was going to wait until I felt it was stable.

@tomreece
Copy link
Owner

I'll leave it up to your discretion. I'd definitely appreciate that if you're going to submit a pull request, you thoroughly test it. At the moment I don't have unit tests or anything to help with this so all of my testing is done in the real world so I'm quite cautious about changes.

Whenever you feel it is stable and solves the problem you set out to solve, feel free to submit a PR and I'll review.

@tomreece
Copy link
Owner

@eengstrom PS: I'm about to merge my PR which has a few changes throughout the file, this will likely cause a merge conflict for you. Hopefully it's not too bad!

@eengstrom
Copy link
Contributor Author

@tomreece -- I was able to merge your changes in without much difficulty, as I was already using your refactor branch. I then left it run overnight and got some examples of both new and add-on trades. So, I think this is ready for review. I'll generate a pull-request in just a moment.

The output from both new and add-on trades is unified and looks like this:

Found 12 card(s) worth 328 points to trade to xxxxx who has 1593 points...
  Sent 'Immerwolf' for 43 PucaPoints!
  Sent 'Immerwolf' for 43 PucaPoints!
  Sent 'Immerwolf' for 43 PucaPoints!
  Sent 'Immerwolf' for 43 PucaPoints!
  Sent 'Sacred Wolf' for 20 PucaPoints!
  Sent 'Sacred Wolf' for 20 PucaPoints!
  Sent 'Sacred Wolf' for 20 PucaPoints!
  Sent 'Sacred Wolf' for 20 PucaPoints!
  Sent 'Wandering Wolf' for 19 PucaPoints!
  Sent 'Wandering Wolf' for 19 PucaPoints!
  Sent 'Wandering Wolf' for 19 PucaPoints!
  Sent 'Wandering Wolf' for 19 PucaPoints!
Successfully sent 12 out of 12 cards worth 328 points!

Found 5 additional card(s) worth 110 points to trade to yyyyy who has 125 points...
  Added 'Madcap Skills' for 23 PucaPoints!
  Added 'Inquisitor's Flail' for 23 PucaPoints!
  Added 'Fungal Sprouting' for 22 PucaPoints!
  Added 'Clock of Omens' for 22 PucaPoints!
  Added 'Toil // Trouble' for 20 PucaPoints!
Successfully added 5 out of 5 cards worth 110 points!

There are new config.json options that I put into the config.example.json file.

  • DEBUG -- if true, don't actually send any cards.
  • reload_trades_interval_s -- seconds between trade page reload/search. You had 5 seconds hard coded, which felt a bit faster than I wanted. I made it default to 60, and minimum of 5.
  • reload_unshipped_interval_m -- minutes between unshipped trader list refresh. Default: 60; Min: 5. This is how often we will go back to the "sending" page and refresh the list of unshipped senders. Normally the unshipped traders list is maintained (added to) on every new trade, so this is necessary ONLY to cull the list while you are actively shipping cards. I'm likely to run this in the 360 to 720 range and then just restart PucAuto when I'm done packaging cards. It may be that we can get rid of it altogether. Thoughts?

I removed the previous two (obsolete) options having to do with checking for add_ons and the refresh period for that activity. Currently, add-ons are always looked for. We can change if you want to make it an option. Personally, since there are a lot of people who add cards to their wants list serially, plus times when traders get new points often, I see this as an obvious "always on" or at least "on by default" feature.

The one change that I would like to make better, but I will save for a future day, is to somehow speed up loading of the trades table more. Currently, if you have unshipped traders, it will always load the entire trades list. If we didn't, we'd miss potential add-ons. I don't like it currently, but it works.

Finally, I also did my best to mimic your new LOGGING.* usage, but again, feel free to modify as you see fit.

Let me know if there are changes you want to see before merging.

@tomreece
Copy link
Owner

Awesome! Thanks for your contribution. I won't be able to look it over thoroughly until tomorrow or this weekend, but expect some feedback soon.

Loading the full trade list sucks for users with large collections. That's what motivated me to introduce a solution that only checks for addons every so often in the first place, because normal bundle checking can get by by only scrolling down a few times.

I'm anxious to look closer at what you came up with though.

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

No branches or pull requests

2 participants