Fixes bug in missing resources scheduling check

Avoids IndexError that occurs when a class is not yet scheduled.

Also increases the performance of that scheduling check by moving some
calculations out of a for-loop.
Merge pull request #1414 from learning-unlimited/missing-resources-fix

Fixes bug in missing resources scheduling check