PyPlanet icon indicating copy to clipboard operation
PyPlanet copied to clipboard

Add commands /pay2extend & /pay2skip to the transactions app

Open jirislav opened this issue 2 years ago • 0 comments

Motivation or cause

See https://github.com/PyPlanet/PyPlanet/issues/1290

Change description

I'm adding two commands to the transactions app:

  • /pay2extend
  • /pay2skip

The skip has a fairly simple configuration, allowing to enable/disable the feature and to set the planets cost of a skip.

The extension has tight integration with the voting app in order to have the extend_current_count on one place so we can respect the already existing extend_max_amount setting.

It also supports to define the multiplier that will be applied to the base cost in case of multiple extensions of a single map (each successive extension gets more expensive). But this is optional and the multiplier can be set to 1 (effectively disabling this multiplying feature), or even to something lower, such as 0.5, to make the extensions cheaper, if someone wanted to do so.

Since the transactions take some time to process, it might occasionally happen, that the user, who paid for track extension, might receive a feedback of a successful transaction in various scenarios: a) Transaction succeeded on the same map he requested to be extended - before podium.

  • everything is great an expected, the time extends according to the extension settings b) Transaction succeeded on the same map he requested to be extended - on podium.
  • that's not so great, because we can't extend the time anymore, the time is up already
  • so we immediately restart the track in this case c) Transaction succeeded on any other map than the one he requested to be extended.
  • we issue a refund and inform the user about it

Checklist of pull request

Make sure that your pull request follow the following 'rules':

  • [x] I have read the CONTRIBUTING document.
  • [x] My code follows the code style of this project.
  • [x] All new and existing tests passed, except in few situations.
  • [x] My change requires a change to the documentation.

Please leave a comment here if your pull need any updates for the docs or tests.

Additional Comments (optional)

Yes, this needs an update of a documentation, but I've prepared it already, as you can see within the commit.

jirislav avatar Oct 13 '23 22:10 jirislav