chief-nerd / Tabbie2

The Tabbie2 project main repo
https://www.tabbie.org
19 stars 10 forks source link

Import Round not working #41

Closed aarajh closed 7 years ago

aarajh commented 7 years ago

Whenever i import a round, the draws arent updated and the adjudicators also disappear from the draws. Even if i export and import the same round

rscoates commented 7 years ago

Hmmm, are you doing anything in the meantime? If you're just exporting a draw, and then reimporting it, that's very strange, and my question would be 'Why are you doing that?'. If you're not, the likelihood is that you're actually importing a different round over. If you're trying to do a pre-draw, I can talk you through it, but it will require the use of a php script until we integrate it into the live version.

aarajh commented 7 years ago

Yes i am trying to import a different round in reality. I am trying to import rounds after running a tournament on a local server Sure, that will be fine

aarajh commented 7 years ago

@rscoates

rscoates commented 7 years ago

Okay, so what you'd need is this php script:

<?php
$jsonfile = file_get_contents('olddraw.json');
$json = json_decode($jsonfile);
$new_id = 'NEWDEBATEID';
foreach($json->draw as $debate){
    $debate->id = $new_id;
    $new_id++;
}
$fp = fopen('newdraw.json', 'w');
fwrite($fp, json_encode($json));
fclose($fp);
echo 'Done!';
?>

Run that php script in a folder with the olddraw json file.

Once you've redrawn, find the debate id of the first debate in the new draw, insert it above (at NEWDEBATEID) and then import the generated file.

Please note that the delay was due to us making this feature as standard, which will hopefully come out in the next ten days or so. I hoped to have it faster, and then you wouldn't need this answer.

Hope that helps.

aarajh commented 7 years ago

Thanks!

But it still didnt work. The same result occurs; the adjudicators disappear and no difference in the draw

rscoates commented 7 years ago

Hmmm. I think I might not have explained it very well. I will be making this feature standard very soon, so writing a detailed instructions is probably not worth it.