avs-code / PREM-Podium-race-E-manager

Description PREM (Podium race e manager) is management software for races and race leagues. It can be used to create overviews of race results. Based on Paddock 7.10beta by: demontpx
https://arv187.github.io/PREM-Podium-race-E-manager/
GNU General Public License v3.0
5 stars 1 forks source link

Improve data importation: race_results_import #40

Open avs-code opened 7 years ago

avs-code commented 7 years ago
busterwolfeman commented 6 years ago

Done the nationality thru the drivers table. Vehicle import for AC and displaying it at race and season table is almost done. Qualify position is not possible for AC, unless we do a separate import of the qualify.json (on my list, low priority). Tire import will be a bigger task, since it has to cover tire changes to another compount as well. This would impact the result_race table. To difficult for me (yet).

busterwolfeman commented 6 years ago

BTW: I would suggest to move the replay and the simresults link away from the race_driver table, because this information will be deleted after a re-import of the .json file. I will move this information to be entered at the race.php and the links stored at the race table of the DB.

avs-code commented 6 years ago

@busterwolfeman I don't understand your last message. simresults link and replay link go to race table not to race_driver, you mean this? When you reimport a json in a result that previously had a replay link and a simresults link, if you do double click on the box you will get the last link used.

Anyway I'm almost sure there must be a way so that when importing the json you do not overwrite those two columns in the table "race", type "if/else" if there is some data not overwrite but it could be the case if you willfully want to overwrite it if you wrote wrong link, which would be better solution to get them to another table more and have to rewrite more code to associate the data of one table with the other. I do not know if Stefan knows how to ensure that the data is not overwritten when importing the json again.

Anyway I do not know if it is a frequent situation, when you import the json for the first time you can see if everything is correct before saving, then re-edit to add for example the replay link and the simresults link for the first time, being able to edit again if there is something that is not correct without the need to upload the json again.

busterwolfeman commented 6 years ago

I just had to re-import the result .jsons from our league to get the car-id´s from it. The code deletes any information about the specific race from the result table when importing the results again (at work now, cant remember the correct table name). And the simresults and replay information is in the same table as the race data. If we can store this two links in the race table together with all the other static infos (laps, ruleset etc..) this cannot happen. You wrote "if you do double click on the box you will get the last link used." You meant the form data that Firefox stores? Yes, I was able to restore the links from the db3, but there have been many of them...

I can easily change the code to store the data in the race table and read from it, that isn´t the point. Excluding the two links from getting deleted at re-import is way more work to do.

avs-code commented 6 years ago

ok, you can export your actual "race" table from phpmyadmin to save the columns replay and simresults (you can use csv, sql, etc). after import your json results on the web, and after import your saved "race" table.

I have not done something similar for a while so I do not remember it well, but you can do two things to reach that, once you have re-imported the jsons you can import in phpmyadmin your "race" table previously exported (the one with the links), you will probably get errors for each column that it already contains a data, telling you that it can not be imported because the data already exists, and you will observe that the replay link and the sim-results links are the columns that do not give an error because they are empty in the destination table.

Another option is to edit the "race" table exported in csv or the format you choose (better csv so that you read it excel or another spreadsheet program), empty the data except the replay and simresults (I do not know if the id also have to keep it). It should work, although I have not done something like that in a long time. Or you can merge both tables in excel and after import to your database. IN ANY CASE MAKE A BACKUP COPY OF THE ENTIRE DATABASE FIRST OF ALL

Too you can use sql console if you know how, using commands type update etc.

busterwolfeman commented 6 years ago

Hi again. Thanks for the clearup :-) Actually I know these possibilities. But I wasn´t aware that the data is getting lost with re-importing of the json. All my writing above refer to the view of a new admin of PREM, who do not know all of this. The goal should be to NOT force the league admin to do anything directly with the DB. PREM lacks also concerning the installation. There should be an install.php which ask the admin for the DB connection, returning the data to itself with a safe use of the PHP_SELF variable (no need of an extra *do.php), then it should creates all the tables, delete itself and that´s it. In any case the user should never be forced to use PHPmyAdmin. I think I´m able to do this install script, but really at low priority and when all is done what I will do (Where is the Todo list here at Github? ;)). My suggest above is all about save usability. I will do the coding for this and push it to Stefans fork with an own branch. You can decide then if you merge it to your master or not, OK?

avs-code commented 6 years ago

In this way, each change is recorded with a theme, and not a change with several themes. It is easier to do the follow-up, and for me also to see the changes and apply them without having to worry about wanting to adopt a change but in the same one a button has been removed, for example.

It also applies if there is something that does not work or you regret it and you go backwards, you undo what does not work without the danger of undoing something that worked and was included in the same push request. For example, in your previous push there were things that I did not want to apply, like the elimination of the slideshow, or things that did not have to be there (username and password of your database) and I had to cancel the push request.

busterwolfeman commented 6 years ago

Just managed to get the qualy position. Imported from the qual.json thru the same form as the race.json. Change is submitted to Stefans fork with an own branch.

avs-code commented 6 years ago

thanks @busterwolfeman I'll see the changes next month