Course credits field

1 view
Skip to first unread message

John Milner

unread,
Aug 10, 2012, 7:26:54 PM8/10/12
to student-worker-relational-database-dev
Should course.credits be required? A lot of TC courses have credits=None, which causes this ugliness:
Traceback (most recent call last):
  File "/opt/sword/ecwsp/sis/models.py", line 486, in _calculate_grade_for_single_course
    credit = float(course.credits) / float(course.marking_period.count())
TypeError: float() argument must be a string or a number

We deal with this now by doing try/except: pass, essentially treating these courses as if they had zero credits. I'd argue that we should force registrars to consciously set the field to 0.

David Burke

unread,
Aug 10, 2012, 10:03:41 PM8/10/12
to student-worker-rela...@googlegroups.com
Why not use a default field instead? The default could be configurable.

David Burke
davidmburke.com

John Milner

unread,
Aug 10, 2012, 10:19:44 PM8/10/12
to student-worker-rela...@googlegroups.com
I think it should be blank by default when creating a course and fail validation if the registrar doesn't enter a value.

Really, it's a question of minimizing data entry error. The gross exception is easy to dispense with using .exclude(credits=None), but it still seems really easy to accidentally (and silently) exclude a course from being included in GPA calculations.

David Burke

unread,
Aug 10, 2012, 10:23:20 PM8/10/12
to student-worker-rela...@googlegroups.com
Ok.

and as for removing gross try excepts absolutely

David Burke
davidmburke.com

John Milner

unread,
Aug 10, 2012, 10:27:32 PM8/10/12
to student-worker-rela...@googlegroups.com
I'll make a low-priority ticket about it. I'll have to figure out how to get South to set a default value (0) where it was NULL (or empty?) before.
Reply all
Reply to author
Forward
0 new messages