Skip Navigation

[Resolved] Calculate with Toolset

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can we perform calculations with Toolset?

Solution:
No, but there are some Custom Code solutions that can be used:
https://toolset.com/forums/topic/creating-a-sports-results-guessing-competition-site-with-toolset/#post-568197

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.99 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Vane 7 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#568058

Hi,

I'm considering to create a WP site where visitors could guess one or more sports events exact results
(like Soccer, Spanish League, Barcelona - Real Madrid, 21th Oct., 2017: 2 - 0 or 1 - 1)
and there could be aggregated leaderboards of the best guessers.
Aggregated leaderboard means:
on sports level, championship level, season level, week or month level, etc.

Creating custom post types, their relationships, their custom fields, the input and edit form for guesses and personal data - with Toolset - would not be a problem for me, I hope ????
Also, visualizing specific filtered leaderboards with Views is OK.

My problem is how can I create with Toolset such arithmetical rules in priority order (rule sets), which determine which guess is better?
(This rule set would determine which guess is better or more accurate from guesses of 4-2 and 2-0, when the final result was 3-1...)

These rules basically would create a custom field value ( of a CPT named "Guess" ), named accuracy score, for every each guess (of an event), and the aggregated leaderboards would display the aggregation and filtering conditions of the leaderboard, the best guessers name and their accuracy score in desc. order
( for example: the best guessers in Soccer, of Spanish League in the 2017-2018 season, or:
the best guessers in Soccer, of Spanish League in the 2017-2018 season's Barcelona - Real Madrid match of 21th Oct. 2017 )

The rule sets would be different for the specific sports and probably would be set on a championship or event level (Spanish League of Soccer or Barca - Real)

So, do you think I can develop this idea completely, only using Toolset or not?

Thanks,
Best,
V.

#568197

You will need soem custom PHP to calculate, as Toolset does not offer these features.

You can then calculate the difference of the guess and the real result and create a View where you order by that calculated value.

But to perform the calculation you need Custom Code.

An example of a calculating ShortCode is here:

global $total;
function add_total_shortcode($atts, $content = '') {
global $total;
 
$total += wpv_do_shortcode($content);
}
 
add_shortcode('add-to-total', 'add_total_shortcode');
function show_total_shortcode() {
global $total;
$totalNew = $total;
$total = 0;
return $totalNew;
}
 
add_shortcode('show-total', 'show_total_shortcode');

USAGE:

<wpv-loop>
    
    [add-to-total]
      
    [/add-to-total]
</wpv-loop>
[show-total]

Similarly you can create other shortcodes to calculate.

#569917

Hi Beda,

thank you for your suggestions, I really appreciate your specific and detailed response.

Do you know such a specific good developer familiar with both Toolset and WPML who is able to develop this idea with Toolset?
I know there is a list of Toolset developers (consultants), but I contacted some of them from the list but never got response...

Thanks,
Best
V.

#570074

We are very sorry for this.

May I give a glimpse in eventual future things?

We plan to add a place where Toolset Users can offer their services.

There are tons of very experienced Developers using Toolset, that we would like to introduce to less experienced Useres, so they could work together (paid, obviously, as that would be an external service)

That would kind of solve your issue, right?

At the moment I cannot offer it, but I can update you when we are ready (if it gets implemented)

Or, you may ask me the details you struggle with, you are a Life Time Subscriber and hence, you have access to our Support Services at all time.

You can even split your project in several Tickets, there is nothing wrong in doing so, it is even better, it makes it easier to help you as well.

I suggest, you create a DEV site, and start with the info I gave you.

Then, open a ticket for each issue you run up against.

We will be more than happy to help!

Maybe a look at the reference sites and modules also is worth a Shot.
Reference:
http://discover-wp.com/
https://toolset.com/home/module-manager/
https://toolset.com/documentation/user-guides/using-toolset-module-manager/

#570097

I've already created some 5+ sites with WPML and Toolset but nowadays I don't use Toolset very often, so my work would not be too cost efficient, I would spend 10-50 times more with reading docs, testing stuffs, communicating with Toolset support, etc. than a Toolset Pro who uses it daily.

So I would definitely would pay for this job, if it is a correct hourly rate and the working hours are not overcounted - and the job is done correctly...

Most of your Toolset license owners know enough and has enough experience with Toolset
about how quickly one can solve specific issues with it, but - like me - would prefer to focus on his / her core business and would outsource these projects if its affordable.

Also, if I'd have a good Toolset, WPML developer (maybe with some PHP and javascript skills like you), the partnership would work in multiple projects.

So - honestly, I think - this idea:
"We plan to add a place where Toolset Users can offer their services..."
is the best new "feature" Toolset team offers for years! 🙂
I hope it will be launched sooner than later...

I really appreciate your attitude to support clients, to their problems and their needs ( no BS, but pure, valuable info, real help ),
so thank you again!

Best,
V.