Index: trunk/tools/editor_trends/analyses/plugins/taxonomy_burnout.py |
— | — | @@ -24,18 +24,30 @@ |
25 | 25 | edits = editor['monthly_edits'] |
26 | 26 | |
27 | 27 | burnout = False |
28 | | - sum =0.0 |
| 28 | + sum = 0.0 |
29 | 29 | count = 0.0 |
30 | 30 | |
31 | | - for year in xrange(new_wikipedian.year, var.max_year): |
| 31 | + for year in xrange(2001, var.max_year): |
32 | 32 | for month in xrange(1, 13): |
33 | | - if edits[str(year)][str(month)] > 249: |
34 | | - burnout = True |
35 | | - if burnout == True: |
36 | | - sum += edits[str(year)][str(month)] |
37 | | - count +=1.0 |
| 33 | + str_year = str(year) |
| 34 | + str_month = str(month) |
38 | 35 | |
39 | | - if sum / count < 10 and burnout == True: |
40 | | - var.add(editor['username'], 1) |
41 | | - |
| 36 | + try: |
| 37 | + if edits[str_year][str_month] > 149: |
| 38 | + burnout = True |
| 39 | + if burnout == True: |
| 40 | + sum += edits[str_year][str_month] |
| 41 | + count += 1.0 |
| 42 | + except (AttributeError, KeyError): |
| 43 | + # print 'Editor ' + editor['username'] + ' does not have data for year ' + str_year + ' and month ' + str_month |
| 44 | + pass |
| 45 | + |
| 46 | + if count > 0.0 and sum / count < 10 and burnout == True: |
| 47 | + |
| 48 | + try: |
| 49 | + var.add(editor['new_wikipedian'], 1, {'username' : editor['username']}) |
| 50 | + except: |
| 51 | + print 'error: ' + editor['username'] |
| 52 | + pass |
| 53 | + |
42 | 54 | return var |