Changeset 1432

Show
Ignore:
Timestamp:
03/02/11 14:49:17 (15 months ago)
Author:
winfried
Message:

Fixing bug in generating stats when db is incosistent

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • stable/HelpIM/chatdb.py

    r713 r1432  
    691691 
    692692    for id in ids: 
    693         staff_lines = getlines(id=id[0], owner = 'staff') 
    694         client_lines = getlines(id=id[0], owner = 'client') 
    695         staff_words = 0 
    696         client_words = 0 
    697         for line in staff_lines: 
    698             staff_words += len(line[2].split()) 
    699         for line in client_lines: 
    700             client_words += len(line[2].split()) 
    701         storeproperty(id = id[0], 
    702                       prop = 'staff_lines', 
    703                       propertydescription = settings['staff_lines_description'], 
    704                       propertygroup = 'general', 
    705                       valueid = len(staff_lines), 
    706                       replace = True) 
    707         storeproperty(id = id[0], 
    708                       prop = 'staff_words', 
    709                       propertydescription = settings['staff_words_description'], 
    710                       propertygroup = 'general', 
    711                       valueid = staff_words, 
    712                       replace = True) 
    713         storeproperty(id = id[0], 
    714                       prop = 'client_lines', 
    715                       propertydescription = settings['client_lines_description'], 
    716                       propertygroup = 'general', 
    717                       valueid = len(client_lines), 
    718                       replace = True) 
    719         storeproperty(id = id[0], 
    720                       prop = 'client_words', 
    721                       propertydescription = settings['client_words_description'], 
    722                       propertygroup = 'general', 
    723                       valueid = client_words, 
    724                       replace = True) 
     693        if id[0]: 
     694            staff_lines = getlines(id=id[0], owner = 'staff') 
     695            client_lines = getlines(id=id[0], owner = 'client') 
     696            staff_words = 0 
     697            client_words = 0 
     698            for line in staff_lines: 
     699                staff_words += len(line[2].split()) 
     700            for line in client_lines: 
     701                client_words += len(line[2].split()) 
     702            storeproperty(id = id[0], 
     703                          prop = 'staff_lines', 
     704                          propertydescription = settings['staff_lines_description'], 
     705                          propertygroup = 'general', 
     706                          valueid = len(staff_lines), 
     707                          replace = True) 
     708            storeproperty(id = id[0], 
     709                          prop = 'staff_words', 
     710                          propertydescription = settings['staff_words_description'], 
     711                          propertygroup = 'general', 
     712                          valueid = staff_words, 
     713                          replace = True) 
     714            storeproperty(id = id[0], 
     715                          prop = 'client_lines', 
     716                          propertydescription = settings['client_lines_description'], 
     717                          propertygroup = 'general', 
     718                          valueid = len(client_lines), 
     719                          replace = True) 
     720            storeproperty(id = id[0], 
     721                          prop = 'client_words', 
     722                          propertydescription = settings['client_words_description'], 
     723                          propertygroup = 'general', 
     724                          valueid = client_words, 
     725                          replace = True) 
    725726 
    726727def cleanup(days):