org.ametys.odf.schedulable.CoursePartPurgeSchedulable calls solr to find all coursepart not linked to a course.
If there was an indexation problem, some coursepart can be deleted just because solr does not know their real state.
There are 2 ways of fixing this :
- Instead of solr, query the repository (take care, it is possible to have an empty array or no value at all, both cases must be checked)
- Continue to use solr, but check in the repository if the result is correct before deletion.
And some logs could be added.