“shuffle” action was broken, fixed it
This commit is contained in:
parent
d5c8b70abf
commit
7593f1b65c
1 changed files with 3 additions and 6 deletions
|
@ -219,16 +219,13 @@ if ($opts['revive']) {
|
|||
|
||||
if ($opts['shuffle']) {
|
||||
eecho('randomizing values in «RPos» column...'.N,1);
|
||||
$res=myq($link,'SELECT ID FROM Instances');
|
||||
$res=myq($link,'SELECT ID FROM Instances ORDER BY RAND()');
|
||||
$i=0;
|
||||
while ($row=mysqli_fetch_assoc($res)) {
|
||||
myq($link,"UPDATE Instances SET RPos={$i} WHERE ID={$row['ID']}");
|
||||
$i++;
|
||||
$buf[$row['ID']]=$i;
|
||||
}
|
||||
shuffle($buf);
|
||||
foreach ($buf as $key=>$val)
|
||||
myq($link,'UPDATE Instances SET RPos='.$val.' WHERE ID='.$key);
|
||||
eecho('done! Affected rows: '.count($buf).'.'.N,1);
|
||||
eecho("done! Affected rows: {$i}.\n",1);
|
||||
}
|
||||
|
||||
if ($opts['updstats']) {
|
||||
|
|
Loading…
Reference in a new issue