Some students can not see their grades

Bug #484485 reported by Jeffrey Elkner
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool Gradebook
Fix Released
Medium
Douglas Cerna

Bug Description

About 1/3 of my students got an error when they clicked on Gradebook after logging in to SchoolTool this afternoon. replaceafill hacked a solution, but wanted me to file this bug anyway. He will add details of what he found.

Revision history for this message
Douglas Cerna (replaceafill) wrote :

jelkner's instance for some unexplained reason, has sections with no courses associated. I'll try to find out how this happened.

When the student logins and then hit the "Gradebook" tab, some methods like getSections, getCurrentSection and handleTermChange in schooltool/gradebook/browser/gradebook.py try to convert the section.courses relationship to a list and then access the [0] element to get the course title:

>>> list(section.courses)[0].title

I learned from Ignas that since sections theorically could have several courses associated, you should do something like:

>>> ", ".join([course.title for course in section.courses])

I don't know if it's the solution but it avoids the IndexError. If there is no courses associated, you get nothing as the course title and I can live with that. I'm sending a patch here. The fix for the handleTermChange method should be revised though (that's the only part I'd call a 'hack').

affects: schooltool → schooltool.gradebook
Revision history for this message
Douglas Cerna (replaceafill) wrote :

The "unexplained reason" from my previous comment is that 66 courses were manually deleted from the 2009--2010 school year. This left the sections and their enrollments alive but without a courses relationship.

Changed in schooltool.gradebook:
assignee: nobody → Alan Elkner (aelkner)
Revision history for this message
Alan Elkner (aelkner) wrote :

The change that Ignas suggested, using the join, is the correct change to be made throughout schooltool.gradebook. Perhaps you could do that for the whole package at once and see if any unforeseen situations arise.

Changed in schooltool.gradebook:
assignee: Alan Elkner (aelkner) → Douglas Cerna (replaceafill)
Changed in schooltool.gradebook:
status: New → Fix Committed
Changed in schooltool.gradebook:
milestone: none → 0.6.1
Changed in schooltool.gradebook:
importance: Undecided → Medium
Changed in schooltool.gradebook:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.