Open kuaka opened 3 years ago
update: blowing away the DB and reimporting gives the same error with the same code ('FORFLA17_10'). This import was working fine a day (or 2) ago.
I think The code is limited to 10 chars, so 10th repetition of same name is failing. I think it it quite unusual to have so many comps named the same in real life, and as that is a code I wouldn't make it bigger than 10 chars, but I will think a solution to fail without breaking. Meanwhile delete folders in tracks.
yes it looks like it is becasue I have old track folders. Yes it is something that would be rare, but the point is we are creating a code and trying to send to the DB that exceeds the field length. This is 'not great' code and something that a unit test should pick up...
Related to this, I changed delete comp function to delete comp folder (if files are selected to be deleted but at the moment it is the only option)( https://github.com/FAI-CIVL/FAI-Airscore/commit/ba519633ad8db5592e38378078730dcd561ebe41) I also changed the function to create comp code, now it cannot go over 10 chars (https://github.com/FAI-CIVL/FAI-Airscore/commit/774fb7f0c7d1c1fb092e2592be4e0284e304a0e3).
Great. The other files will also need to be deleted. I am not sure if they are or not.
Yes it deletes everything, included results and map files.
I also changed the function to create comp code, now it cannot go over 10 chars (774fb7f).
my advice would be to write a unit test for this. Should never create the same code for the same comp (if already exists) and never go over 10 chars.
Yes now it goes through all the alphabet, so we have 64 slots for events with same name and season. I think it should be enough, but I can add an error message just in case routine is not able to create a unique short name.
I tested a bit and should work correctly now.
When importing from FSDB, the comp code is being generated however it appears that there is no forcing it to not exceed the filed length in the DB.
I believe that as I have imported this comp many times before it is adding an index on the end, which now is '10' and the generated code is too long for the DB.