[6651] | 1 | """General helper functions for the student section. |
---|
| 2 | """ |
---|
[6920] | 3 | from grok import getSite |
---|
[6662] | 4 | from random import SystemRandom as r |
---|
[6915] | 5 | from waeup.sirp.interfaces import academic_sessions_vocab |
---|
[6651] | 6 | |
---|
[6749] | 7 | def generate_student_id(students,letter): |
---|
[6651] | 8 | if letter == '?': |
---|
[6664] | 9 | letter= r().choice('ABCDEFGHKLMNPQRSTUVWXY') |
---|
| 10 | sid = u"%c%d" % (letter,r().randint(99999,1000000)) |
---|
[6749] | 11 | while sid in students.keys(): |
---|
[6664] | 12 | sid = u"%c%d" % (letter,r().randint(99999,1000000)) |
---|
[6662] | 13 | return sid |
---|
[6742] | 14 | |
---|
| 15 | def set_returning_data(student): |
---|
| 16 | student['studycourse'].current_level += 100 |
---|
| 17 | student['studycourse'].current_session += 1 |
---|
| 18 | verdict = student['studycourse'].current_verdict |
---|
[6804] | 19 | student['studycourse'].current_verdict = '0' |
---|
[6742] | 20 | student['studycourse'].previous_verdict = verdict |
---|
| 21 | return |
---|
[6876] | 22 | |
---|
[6920] | 23 | # To be specified in customization packages. |
---|
| 24 | # This function is for demonstration and testing only. |
---|
[6876] | 25 | def getPaymentDetails(category, student): |
---|
| 26 | surcharge_1 = surcharge_2 = surcharge_3 = 0 |
---|
[6877] | 27 | p_item = u'' |
---|
[6898] | 28 | amount = 0 |
---|
[6920] | 29 | error = u'' |
---|
| 30 | p_session = student['studycourse'].current_session |
---|
| 31 | session = str(p_session) |
---|
| 32 | try: |
---|
| 33 | academic_session = getSite()['configuration'][session] |
---|
| 34 | except KeyError: |
---|
| 35 | error = u'Session configuration object is not available.' |
---|
| 36 | return (amount, p_item, p_session, |
---|
| 37 | surcharge_1, surcharge_2, surcharge_3, error) |
---|
| 38 | if category == 'schoolfee': |
---|
| 39 | amount = academic_session.fee_1 |
---|
[6929] | 40 | surcharge_1 = academic_session.surcharge_1 |
---|
| 41 | surcharge_2 = academic_session.surcharge_2 |
---|
| 42 | surcharge_3 = academic_session.surcharge_3 |
---|
[6920] | 43 | p_item = student['studycourse'].certificate.code |
---|
[6929] | 44 | elif category == 'clearance': |
---|
| 45 | p_item = student['studycourse'].certificate.code |
---|
| 46 | amount = academic_session.fee_2 |
---|
[6920] | 47 | return (amount, p_item, p_session, |
---|
| 48 | surcharge_1, surcharge_2, surcharge_3, error) |
---|