Title: Prediction rule
Last modified: April 13, 2021

---

# Prediction rule

 *  Resolved [reinispro](https://wordpress.org/support/users/reinispro/)
 * (@reinispro)
 * [5 years ago](https://wordpress.org/support/topic/prediction-rule/)
 * Hello Antoine,
 * Would it be possible to set new rule in addition to “Always show predictions”.
   
   I know it’s not something that’d be used widely, so this might be a bit specific.
 * The new rule would be:
    1. Enable “Always show predictions” 2. This enables additional
   rule, that participants in pool, who are in TOP 3 (1st, 2nd, 3rd place) would
   get different “Dynamic stop threshold for matches”.
 * For example I’m using default 900 seconds, but when “Always show predictions”
   turned on, TOP 3 participants have this time differently 1st place 2700 second,
   2nd place 1800 seconds and 3rd place 900 second. It’d be hard to explain for 
   what is needed, but that’s some specific rule we use in our tournament.
 * The other option, and maybe easier one would be when “Always show predictions”
   turned on TOP 3 participants can only enter score once, then it gets locked, 
   while all other participants can change the score until “Dynamic stop threshold
   for matches” is met.
 * How you got the idea.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [AntoineH](https://wordpress.org/support/users/antoineh/)
 * (@antoineh)
 * [5 years ago](https://wordpress.org/support/topic/prediction-rule/#post-14314229)
 * Hi Reinis,
 * I get the idea: you want to add some disadvantage to the top players so it (hopefully)
   makes it easier for the lower ranked players to catch up.
 * I have to think about it for a bit, because both are not possible right now. 
   And I foresee some problems because it would require to load the ranking on some
   parts of the plugin where I would rather not add this extra sql query (because
   it is the slowest query in the plugin). So my first thought would be to not include
   it in the vanilla plugin. But maybe as an extension.
 * I think having the variable lock time is the easiest as it would only require
   one place to change the code (and then extend on that part with an extension 
   that overwrites the setting). Checking for multiple saves also requires a database
   change to store the time when a save was done by the player. And I also do not
   like the idea of locking the form when a player accidentally saves it with the
   wrong numbers.
 *  Thread Starter [reinispro](https://wordpress.org/support/users/reinispro/)
 * (@reinispro)
 * [5 years ago](https://wordpress.org/support/topic/prediction-rule/#post-14314271)
 * Yes, you got that completely right, it’s for a disadvantage for top players, 
   so others could possibly catch up on final games.
    Which ever solution is better,
   is good by me. As far as you’ve got the idea, I believe you’ll come up with the
   best solution. You’ve helped me out a lot before with extensions, so your support
   is at it’s finest as it has always been 🙂
 *  Plugin Author [AntoineH](https://wordpress.org/support/users/antoineh/)
 * (@antoineh)
 * [5 years ago](https://wordpress.org/support/topic/prediction-rule/#post-14324975)
 * I played around a bit with the idea and came up with the following [extension](https://www.dropbox.com/s/gbx1uu83yo1cg74/football-pool-variable-locktime-based-on-ranking.php?dl=0).
 * This extension also requires a hook in the Football_Pool_Matches class to work.
   I will add the hook in my next version of the plugin (v2.9.6 or higher), but 
   to immediately start using the extension you’ll have to change the following 
   line in that class file:
 * `$this->lock = Football_Pool_Utils::get_fp_option( 'maxperiod', FOOTBALLPOOL_MAXPERIOD,'
   int' );`
 * to:
 *     ```
       $this->lock = apply_filters( 'footballpool_matches_lock_maxperiod',
       				Football_Pool_Utils::get_fp_option( 'maxperiod', FOOTBALLPOOL_MAXPERIOD, 'int' ) );
       ```
   
 * You can change the lock times to your liking via the array definition in the 
   extension. You can add as much ranks as you wish, e.g. (example is for top 3 
   players):
 *     ```
       private static $variable_lock_times = [
       	// format of array: ranking (int) => seconds for lock time (int)
       	1 => 1 * HOUR_IN_SECONDS,
       	2 => 45 * MINUTE_IN_SECONDS,
       	3 => 30 * MINUTE_IN_SECONDS,
       ];
       ```
   
 *  Thread Starter [reinispro](https://wordpress.org/support/users/reinispro/)
 * (@reinispro)
 * [5 years ago](https://wordpress.org/support/topic/prediction-rule/#post-14325613)
 * Amazing, yet again you have proven, that’s support for this plugin is excellent.
 * I’m going to do some testing today, will see how this works out, then I’m gonna
   give my feedback 🙂
 *  Thread Starter [reinispro](https://wordpress.org/support/users/reinispro/)
 * (@reinispro)
 * [5 years ago](https://wordpress.org/support/topic/prediction-rule/#post-14326700)
 * Ok, so I tested it, and everything works like a charm.
    I almost had finished
   my reply how it doesn’t work, but then thought of testing it again. For my surprise,
   I wanted to do the testing in the wrong way. I was the only one in the ranking,
   meaning no other player were participants in pool, and with settings like that,
   this extension doesn’t work, but when I added my test user to pool thus making
   ranking with at least two player (me as 1st place, test as 2nd) then everything
   was fine, so mistake on my side 🙂
 * You can tag this as resolved. Many thanks to you Antoine!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Prediction rule’ is closed to new replies.

 * ![](https://ps.w.org/football-pool/assets/icon-256x256.png?rev=983880)
 * [Football Pool](https://wordpress.org/plugins/football-pool/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/football-pool/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/football-pool/)
 * [Active Topics](https://wordpress.org/support/plugin/football-pool/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/football-pool/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/football-pool/reviews/)

## Tags

 * [predictions](https://wordpress.org/support/topic-tag/predictions/)
 * [time](https://wordpress.org/support/topic-tag/time/)
 * [top](https://wordpress.org/support/topic-tag/top/)

 * 5 replies
 * 2 participants
 * Last reply from: [reinispro](https://wordpress.org/support/users/reinispro/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/prediction-rule/#post-14326700)
 * Status: resolved