TonyHaikara / silk-platform

0 stars 4 forks source link

JSON import: Training are duplicated #27

Open ywarnier opened 3 years ago

ywarnier commented 3 years ago

When importing the same list of training several times (because there were errors the first time), the training records get inserted multiple times. This is not the case with institutions, because we have a unique institution username, but in the case of training there is not "uniqueness".

I suggest adding a validation on training's institution.id+name+location+start_at+end_at. If we find that the 5 fields already exist with the same values in the database, we consider that the training is a duplicate (and don't insert the training).