source: main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py @ 6742

Last change on this file since 6742 was 6742, checked in by Henrik Bettermann, 13 years ago

Add school fee payment transitions.

Implement set_returning_data function which is triggered when payment transition is fired (returning students only).

Save integer values in session fields. This eases the numerical processing of session values.

  • Property svn:keywords set to Id
File size: 787 bytes
Line 
1"""General helper functions for the student section.
2"""
3
4from random import SystemRandom as r
5from waeup.sirp.students.catalog import search
6
7def generate_student_id(letter):
8    # XXX: using catalog search here might be overkill?
9    if letter == '?':
10        letter= r().choice('ABCDEFGHKLMNPQRSTUVWXY')
11    sid = u"%c%d" % (letter,r().randint(99999,1000000))
12    while search(query=sid,searchtype='student_id'):
13        sid = u"%c%d" % (letter,r().randint(99999,1000000))
14    return sid
15
16def set_returning_data(student):
17    student['studycourse'].current_level += 100
18    student['studycourse'].current_session += 1
19    verdict = student['studycourse'].current_verdict
20    student['studycourse'].current_verdict = ''
21    student['studycourse'].previous_verdict = verdict
22    return
Note: See TracBrowser for help on using the repository browser.