The Cool Archive miscounts the number of cools to display; the first page displays cools number 2 through 49, skipping numbers 1 and 50; the second page displays cools 51 through 99, skipping number 100, and so forth. These both appear to be due to glitches in the incrementation of the while loops in the Cool Archive Perl code.

Using my secret edev viewcode powers, I spotted both errors between lines 79 and 85:

  79: my $count = 0;
  80: my $dummy;
  81: while (++$count < $place) {
  82:   $dummy = $csr->fetchrow_hashref;
  83: }
  84: 
  85: while (++$count < 50+$place and my $WR = $csr->fetchrow_hashref) {
If $place = 0, as it is when a user visits the initial Cool Archive page, then the first while loop increments $count to 1, and then the second increments it to 2. The quickest fix would be to replace line 79 with my $count = -1;

nate sez: Actually, we don't want the loop to iterate at all (it would omit the first result, even if $place=0).

The second glitch is entirely within the second loop. If $place = 0, then in line 85 we have 50+$place = 50, and the while loop fails when $count is incremented to 50. Replacing ++$count < 50+$place with ++$count <= 50+$place would solve the problem.

nate sez: Fixd. Goddamn OBOBs.

added: Whoops, now the "next 50" link has vanished. That'll teach me to read the entire code for potential conflicts. The problem is now here, in line 114:

  114:   if $count == $place+50;
...since $count is now greater than 50+$place (line 86). Replacing == with > should fix things.

anotherone sez:
Lookat my cool archive page. At the end of the second page, the last writeup (my first) shows up as number 99. Underneath that, there's a Next 50... link. Clicking it produces a server error, since there are no more.

Log in or register to write something here or to contact authors.