Draft page problems caused by expansion

Everything about the STHS Web Portal - Open Source Version / Tout ce qui touché le STHS WebPortal – Open Source
Post Reply
Owen
The Crazy / Le Fou
Posts: 386
Joined: Tue Jan 01, 2013 12:43 pm
Contact:

Draft page problems caused by expansion

Post by Owen » Mon May 15, 2017 1:36 am

The addition of a 31st team (Vegas) to the web portal causes it to improperly show tables for the Entry Draft and Waiver Draft pages of past drafts. One would think that it would just be coded to read whichever round the picks are made in and go from there. However, for some dumb reason, the number of teams in the league is tied to the coding on these pages.

After adding a new team to your league directory (in my case, I had 30 teams), the coding essentially dies after pick 31, then corrects itself briefly before breaking again for each subsequent round.

I played around and found a partial fix but it's not a full one. Near the bottom of the code there is:

Code: Select all

if ($_SESSION['total_teams'] == $i){
	$i=0;
	$tmppos=0;
When changing the value of $i from 0 to 31 (or higher), it fixes everything from round 3 and beyond. I have also found that this fixes issues for leagues who give extra compensatory picks to teams (as my league sometimes does) without breaking the table by having more than 30 picks in one round. However, with this, the second-round after pick #31 is still entirely broken no matter what value you choose.

Please also note again -- this issue only occurs when viewing your previous drafts. Does anyone know how to recode it to not be tied to the number of teams a league may have?
Elite Hockey Experience

We're not just any league. We're the competitive league that you've waited years to find!
Now available en Français & auf Deutsch!
www.elitehockeysim.com

DNHL Commish
New in Town / Le Ptit Nouveau
Posts: 39
Joined: Wed Jun 01, 2011 9:24 am
Contact:

Re: Draft page problems caused by expansion

Post by DNHL Commish » Mon May 15, 2017 8:15 am

Hi,

I had this issue too with compensatory picks I give at the end of the prospect draft.
After your question I overlooked the code and found a solution that worked for me, hopefully it helps you out as well.

I commented the following out:

Code: Select all

/*if ($_SESSION['total_teams'] == $i){
	$i=0;
	$tmppos=0;
?>
</tbody>
</table><br />
<?php
}*/
and after:

Code: Select all

do {
	$i=$i+1;
	$pos=$pos+1;
I insert the following code:

Code: Select all

if ($LastRound <> $row_GetRounds['Round']){
	$i=0;
	$tmppos=0;
?>
</tbody>
</table><br />
<?php
}
I think the $i variables are now being irrelevant, but I left them over because they don't hurt.
I didn't use the waiver draft page, but it seemed to be the same problem.
Mike
DNHL Commish
http://www.dnhl.oo.gd

Owen
The Crazy / Le Fou
Posts: 386
Joined: Tue Jan 01, 2013 12:43 pm
Contact:

Re: Draft page problems caused by expansion

Post by Owen » Fri May 19, 2017 12:43 am

What you transcribed doesn't seem right. You closed out a table (which doesn't exist) in the middle of a php code section. Also started a new one without closing it at the bottom of the coding, as well as leaving the entire draft table open by having </table> inside of /* */. For kicks, I tried doing as you described and it causes a blank screen PHP error.

I did try adding $i=0; directly below:

Code: Select all

if ($LastRound <> $row_GetRounds['Round']){
	$LastRound=$row_GetRounds['Round'];
and it did fix the issue where the Round 2 picks weren't showing properly. However, the coding for the very last pick of the draft remains broken.

DNHL Commish
New in Town / Le Ptit Nouveau
Posts: 39
Joined: Wed Jun 01, 2011 9:24 am
Contact:

Re: Draft page problems caused by expansion

Post by DNHL Commish » Fri May 19, 2017 5:33 am

The openings and closure looking weird because its all in the middle of a loop. The </table> inside /**/ for example, there is one right at the end of the file after the loop which closes the entire draft table.

Did you do exactly what I wrote?
IMPORTANT: Please note after the change there are 2 if clauses with:

Code: Select all

if ($LastRound <> $row_GetRounds['Round']){
here you see how it fits between the "do {" and the second "if ("

Code: Select all

do {
	$i=$i+1;
	$pos=$pos+1;
/* New code starts here */
if ($LastRound <> $row_GetRounds['Round']){
	$i=0;
	$tmppos=0;
?>
</tbody>
</table><br />
<?php
/New code ends here */
if ($LastRound <> $row_GetRounds['Round']){
	$LastRound=$row_GetRounds['Round'];
?>
<table  cellspacing="0" border="0" width="100%" class="tablesorter" >
<thead>
<tr>
I know having two If clauses looking the same is not neccessary but I didn't want to change too much of the original code.

here you can see how it works:
http://www.dnhl.oo.gd/entry_draft.php
Mike
DNHL Commish
http://www.dnhl.oo.gd

DNHL Commish
New in Town / Le Ptit Nouveau
Posts: 39
Joined: Wed Jun 01, 2011 9:24 am
Contact:

Re: Draft page problems caused by expansion

Post by DNHL Commish » Fri May 19, 2017 12:12 pm

I merged the if clauses now the code looks like:

Code: Select all

$timeExpired=0;
/* new code starts here */
?>
<table>
<tbody>
<?php
do {
	$i=$i+1;
	$pos=$pos+1;
if ($LastRound <> $row_GetRounds['Round']){
	$i=0;
	$tmppos=0;
	$LastRound=$row_GetRounds['Round'];
?>
</tbody>
</table><br />
/* new code Ends here */
<table  cellspacing="0" border="0" width="100%" class="tablesorter" >
I also added a <table> and a <tbody> element as your were right (only at the first loop) the table was closed before it was opened.

The /* */ from my first post have to be done as well.
Mike
DNHL Commish
http://www.dnhl.oo.gd

Owen
The Crazy / Le Fou
Posts: 386
Joined: Tue Jan 01, 2013 12:43 pm
Contact:

Re: Draft page problems caused by expansion

Post by Owen » Sun May 21, 2017 6:05 pm

That'll do! Thanks for your help with this! Prost!
Elite Hockey Experience

We're not just any league. We're the competitive league that you've waited years to find!
Now available en Français & auf Deutsch!
www.elitehockeysim.com

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest