Changeset 1671


Ignore:
Timestamp:
7 Apr 2007, 16:26:28 (17 years ago)
Author:
joachim
Message:

added a new line Check, which calculates the sum of the column

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/getNewStudentStatistics.py

    r1670 r1671  
    7272    sid_in_faculty = [s.id for s in context.students_catalog(faculty=f.getId)]
    7373    new_in_faculty = intersect(new_ids,sid_in_faculty)
    74     rest = len(new_in_faculty)
     74    dict['new'] = rest = len(new_in_faculty)
    7575    for state in special_states:
    7676        state_count = len(intersect(state_ids[state], new_in_faculty))
     
    9696fac_ids = [f.getId for f in faculties]
    9797fac_ids.sort()
     98check_dict = {}
     99check_dict['id'] = 'Check'
     100check_dict['new'] = 0
     101check_dict['new_percent'] = 0
     102check_dict['rest'] = 0
     103check_dict['rest_percent'] = 0
     104for state in special_states:
     105    check_dict[state] = 0
     106    check_dict["%s_percent" % state] = 0
     107   
    98108for f in fac_ids:
    99     sum = 0
     109    total_fac = fac_res[f]['new']
     110    check_dict['new'] = check_dict['new'] + total_fac
     111    check_dict['rest'] = check_dict['rest'] + fac_res[f]['rest']
    100112    for state in special_states:
    101         sum += fac_res[f][state]
    102         fac_res[f]['%s_percent' % state] = "%.0f" % round(fac_res[f][state]*100/total_new)
    103     fac_res[f]['rest_percent'] = "%.0f" % round(fac_res[f]['rest']*100/total_new)
    104     sum += fac_res[f]['rest']
    105     fac_res[f]['new'] = sum
     113        check_dict[state] = check_dict[state] + fac_res[f][state]
     114        if total_fac != 0:
     115            fac_res[f]['%s_percent' % state] = "%.0f" % round(fac_res[f][state]*100/total_fac)
     116        else:
     117            fac_res[f]['%s_percent' % state] = "%.0f" % 0.0
     118    if total_fac != 0:
     119        fac_res[f]['rest_percent'] = "%.0f" % round(fac_res[f]['rest']*100/total_fac)
     120    else:
     121        fac_res[f]['rest_percent'] = "%.0f" % 0.0
    106122    l.append(fac_res[f])
    107    
     123l.append(check_dict)   
    108124
    109125return l
Note: See TracChangeset for help on using the changeset viewer.