Resources are not visible in some courses.
If you enable debug mode when you try to add a resource have a output:
SELECT * FROM mdl_course_sections WHERE section = '39 'AND course = '40' (with limits 0 and 100)
Found more than one record in get_record_sql!
On table mdl_course_sections I see multiple entries for one section and the courses. see a screenshot.
If I remove. duplicate entries then all is well.
With the query I've found a lot more of these duplicates.
SELECT s1.id AS id1, s1.course, s1.section, s2.id AS id2
FROM mdl_course_sections s1
INNER JOIN mdl_course_sections s2 ON s2.id > s1.id
AND s1.section = s2.section
AND s1.course = s2.course
LIMIT 0 , 30