I've checked the code now and confirmed that 'past' courses are those which have been completed and 'current' courses are those which are enrolled and not yet complete.
As for why this would happen on a teacher's dashboard - as far as I am aware the block is generic for all users on the site. It does not distinguish between users who may have the 'teacher' role on some courses and those who may have the 'student' role on some courses.
$today = time();
is the time on the server correct? Or are you sure its actually the course with the end date set and not another course that looks similar but is not and does not have the end date set.
Yep, end date is set, server time is correct... and it's the same course because the teacher who has it on her dashboard just clicks it, enters the course and shows me the settings of that course (start and finish date)
But... I have found out something. I disabled 'completion tracking' on this course and now it has moved to 'past' on the dashboard. So that's good.
But.. it's still in the 'my courses' top menu. I thought the 'my courses' top menu was following the 'in progress' courses on the dashboard. Is that yet a wrong assumption of mine