Skip Navigation

[Resolved] Assistance with updating some custom javascript code you provided in the past.

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 22 replies, has 3 voices.

Last updated by Minesh 1 year, 2 months ago.

Assisted by: Minesh.

Author
Posts
#2646587

The ones on the Rome tournament page look good. But switch the filter to the Atlanta tournament for the purposes of this testing. The Rome tournament didn't happen because it got rained out. We just have dummy data in a few matches there. So we'll need to use the Atlanta tournament to get this correct. The Atlanta tournament has all the actual results in those matches.

On this page filtered on Atlanta:

hidden link

You'll see the first team is Kung Fu Picklers. It is showing them with 4 wins. I think it is only pulling data from the first match. If you click on the link to the Kung Fu Picklers team page, you'll see their results have 4 wins in their first match. But then they have 13 more wins in all their subsequent matches. So the number that should be showing for them on the Standings by Session page should be 17. Actually, with how you are doing it right now, it should only show 16 as the wins total, because of their wins was in the TeamMaker game which we aren't counting yet. We'll set it up to first not count TeamMaker and have it working right across the four games, but then I'll try to add the TeamMaker field as a fifth one that gets included in the wins total too. I want to try to do that myself first just so I can better understand how this works and to see if modifying it in this way will be something I'd be able to handle myself if I can learn it. If I fail to understand it, I'll have you make that switch and just show me how to do that. That way if more structural changes are made to the matches and what gets counted in the future, there will be a better chance that I'll be able to handle it myself without having to file another ticket for help.

Let me know if you need me to do anything else for making sure all the data is accessible to the Javascript. I'm not sure what would cause it to only pull wins from the first match instead of all matches for each team. But it looks like you're on the right track with this. After we get the Kung Fu Picklers result to show 16, I'll then go through every team in the Atlanta tournament to make sure the numbers are correct for all.

I wish that Rome tournament didn't get rained out. The next one won't be until October 14th to get more data in here. For now we just have to use Atlanta for making sure all is working.

#2647105

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm able to get the 16 wins for the "coca-cola-series-atlanta" team but not 17.

can you please find what is the missing result.

It seems that when I visit the following page:
- hidden link

I see the last result at bottom "Gold Medal Match" is seems not be not included with the view "teams-list-with-total-points-and-results" for which you hide the output section of the view and based on this view result which is hidden be calculate the wins.
=> hidden link

#2647193

What I'm seeing on the page now is showing Wins as empty for all teams. If you have it showing 16 on your end, then you have it completely right for where we are right now on this. Just let me know if you can tell why it is showing as empty on my end. Once I can see it as 16 on this end, I'll go through all the teams and make sure their wins are tallying correctly.

Once that is done, then the next step will be that I will try to add the TeamMaker game results fields to the hidden View and to what you have set up for doing the tallies. I'd like to try that on my own first just to see if I can figure it out and do it myself. It's important that I get to a point where I can handle some easy structural changes to this in case the client decides on different match structures for future tournaments. He has variables that have to be considered at each tournament location when he decides on the match structure, and I'm trying to get this system to where it can handle every structure he's throwing at me. That's making this very difficult and forcing me to use A LOT of conditionals, but I think it can be done.

Right now, the 16 result is showing results from Men's, Women's, MIxed A and Mixed B doubles games, but it is not including TeamMaker. The change where he asked to include TeamMaker came after I started this ticket originally. So the first step is to have it working without TeamMaker, then I want to try to add TeamMaker to accommodate his subsequent request. Once I add TeamMaker, that should change the result from 16 to 17 and I'll feel more confident that I can at least do something myself with this Standings setup. But I may have to ask you to show me how to do it. Let me try it myself first though, just to see if I can figure it out.

But before I do that, see if you can fix whatever is causing it to be empty on my end right now.

#2647403

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've adjusted the JS code as given under to count total wins and total loss:
=> hidden link


    $('.total-win').each(function( index ) {
      var teamID = $(this).attr('team-id');
       //var countsplitwins = $(".result-" + teamID ).html();
        total_win_count = 0; 
          $(".result-"+teamID).each(function( ind ) {
               countsplitwins = $(this).html();
               countsplitwins = countsplitwins.split('Win').length-1;   
               total_win_count = total_win_count + countsplitwins;    
                
          });
      
      $(this).text(total_win_count);
    });
    
    $('.total-loss').each(function( index ) {
      var teamID = $(this).attr('team-id');
      //var totalLoss = $( ".Loss.result-" + teamID ).length;
      total_loss_count = 0; 
      $(".result-"+teamID).each(function( ind ) {
               countsplitloss = $(this).html();
               countsplitloss = countsplitloss.split('Loss').length-1;   
               total_loss_count = total_loss_count + countsplitloss;    
                
          });

      $(this).text(total_loss_count);
    });

Can you please confirm it displays the correct wins and loss count tally now.
=> hidden link

#2647683

This is looking good. Let me do a manual check on the tallies for all teams. I can see that I also have to do some adjustments to the session field options chosen for some of them. I'll let you know if all tallies are correct and then I'll dig in to try to add TeamMaker results myself. More on this ASAP, but I'm feeling really good about where this is now on first glance.

#2647689

Wow! All I had to do to add TeamMaker was to add the field to the output column in the hidden view and it worked with no adjustment to the Javascript!

All tallies are correct and I've added TeamMaker to the tallies now and those are correct as well. The only thing I'm seeing wrong now is how we have primary sorting on the Total Points field. That's not wrong, but doing it that way is producing a result where the standings are skewed to the teams that played more games. I'm going to talk to the client about that. The result of this has it that the team that won the tournament in the 4.0 session is showing as being in 5th place in that session because they played less games on their path to winning. I'm not sure how to do this differently because I don't think sorting on the Wins tally will necessarily work well in all cases as well. It may be that we just leave it as is.

Very close to calling this one resolved. Just give me a bit to go over everything with this with the client. THANKS YET AGAIN FOR THE AWESOME ASSISTANCE!!!

#2647785

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Really glad to know that the solution I shared help you to resolve the most critical problem you have after changing the structure.

You're welcome to mark resolve this ticket and let me know your feedback if you have any issues 🙂

#2654535

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You should mark resolve this ticket. 🙂

#2654611

Oops. Sorry I forgot to come back to mark it resolved. Lots of chaos going on lately and I just forgot.