Index: trunk/tools/editor_trends/analyses/plugins/cohort_dataset_forward_bar.py |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | yearly_edits = editor['edits_by_year'] |
33 | 33 | n = editor['edit_count'] |
34 | 34 | |
35 | | - if n >= var.cum_cutoff: |
| 35 | + if n >= var.cum_cutoff and new_wikipedian != False: |
36 | 36 | for year in xrange(new_wikipedian.year, var.max_year): |
37 | 37 | max_edits = max(monthly_edits.get(str(year), {0:0}).values()) |
38 | 38 | if yearly_edits.get(str(year), 0) == 0 or max_edits < var.cutoff: |
Index: trunk/tools/editor_trends/analyses/plugins/time_to_new_wikipedian.py |
— | — | @@ -18,9 +18,14 @@ |
19 | 19 | __version__ = '0.1' |
20 | 20 | |
21 | 21 | def time_to_new_wikipedian(var, editor, **kwargs): |
22 | | -# headers = ['year', 'time_to_new_wikipedian'] |
| 22 | + ''' |
| 23 | + This plugin calculates how long it takes for an editor to become a |
| 24 | + new wikipedian. A new wikipedian is defined as someone who has made 10 |
| 25 | + edits |
| 26 | + ''' |
23 | 27 | new_wikipedian = editor['new_wikipedian'] |
24 | | - first_edit = editor['first_edit'] |
25 | | - dt = new_wikipedian - first_edit |
26 | | - var.add(new_wikipedian, dt.days) |
| 28 | + if new_wikipedian != False: |
| 29 | + first_edit = editor['first_edit'] |
| 30 | + dt = new_wikipedian - first_edit |
| 31 | + var.add(new_wikipedian, dt.days) |
27 | 32 | return var |
Index: trunk/tools/editor_trends/analyses/plugins/total_number_of_new_wikipedians.py |
— | — | @@ -20,6 +20,8 @@ |
21 | 21 | |
22 | 22 | |
23 | 23 | def total_number_of_new_wikipedians(var, editor, **kwargs): |
| 24 | + |
24 | 25 | new_wikipedian = editor['new_wikipedian'] |
25 | | - var.add(new_wikipedian, 1, {'year':new_wikipedian.year}) |
| 26 | + if new_wikipedian != False: |
| 27 | + var.add(new_wikipedian, 1, {'year':new_wikipedian.year}) |
26 | 28 | return var |
Index: trunk/tools/editor_trends/analyses/plugins/histogram_by_backward_cohort.py |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | new_wikipedian = editor['new_wikipedian'] |
28 | 28 | n = editor['edit_count'] |
29 | 29 | |
30 | | - if n >= var.cum_cutoff: |
| 30 | + if n >= var.cum_cutoff and new_wikipedian != False: |
31 | 31 | windows = data_converter.create_windows(var, break_down_first_year=break_down) |
32 | 32 | for year in xrange(new_wikipedian.year, var.max_year): |
33 | 33 | year = str(year) |
Index: trunk/tools/editor_trends/analyses/plugins/cohort_dataset_forward_histogram.py |
— | — | @@ -22,7 +22,6 @@ |
23 | 23 | import calendar |
24 | 24 | |
25 | 25 | def cohort_dataset_forward_histogram(var, editor, **kwargs): |
26 | | -# headers = ['year', 'month', 'edits'] |
27 | 26 | ''' |
28 | 27 | The forward looking histogram looks for every month that an editor |
29 | 28 | was part of the Wikimedia community whether this person made at least cutoff |
— | — | @@ -35,7 +34,7 @@ |
36 | 35 | yearly_edits = editor['edits_by_year'] |
37 | 36 | n = editor['edit_count'] |
38 | 37 | |
39 | | - if n >= var.cum_cutoff: |
| 38 | + if n >= var.cum_cutoff and new_wikipedian != False: |
40 | 39 | for year in xrange(new_wikipedian.year, final_edit): |
41 | 40 | edits = editor['monthly_edits'].get(str(year), {0:0}) |
42 | 41 | if year == new_wikipedian.year: |
Index: trunk/tools/editor_trends/analyses/plugins/cohort_dataset_backward_bar.py |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | new_wikipedian = editor['new_wikipedian'] |
35 | 35 | n = editor['edit_count'] |
36 | 36 | |
37 | | - if n >= var.cum_cutoff: |
| 37 | + if n >= var.cum_cutoff and new_wikipedian != False: |
38 | 38 | windows = data_converter.create_windows(var, break_down_first_year=break_down) |
39 | 39 | for year in xrange(new_wikipedian.year, var.max_year): |
40 | 40 | year = str(year) |
Index: trunk/tools/editor_trends/analyses/plugins/edit_patterns.py |
— | — | @@ -27,12 +27,13 @@ |
28 | 28 | if dt.days < 366: |
29 | 29 | return var |
30 | 30 | |
31 | | - for year in xrange(new_wikipedian.year, new_wikipedian.year + 2): |
32 | | - obs = [False for x in xrange(13)] |
33 | | - for month in xrange(new_wikipedian.month, 13): |
34 | | - n = monthly[str(year)][str(month)] |
35 | | - date = datetime.datetime(year, month, 1) |
36 | | - if n >= var.cutoff: |
37 | | - obs[month] = True |
38 | | - var.add(date, obs) |
| 31 | + if new_wikipedian != False: |
| 32 | + for year in xrange(new_wikipedian.year, new_wikipedian.year + 2): |
| 33 | + obs = [False for x in xrange(13)] |
| 34 | + for month in xrange(new_wikipedian.month, 13): |
| 35 | + n = monthly[str(year)][str(month)] |
| 36 | + date = datetime.datetime(year, month, 1) |
| 37 | + if n >= var.cutoff: |
| 38 | + obs[month] = True |
| 39 | + var.add(date, obs) |
39 | 40 | return var |
Index: trunk/tools/editor_trends/analyses/plugins/histogram_edits.py |
— | — | @@ -22,5 +22,6 @@ |
23 | 23 | # headers = ['year', 'num_edits', 'frequency'] |
24 | 24 | cnt = editor['edit_count'] |
25 | 25 | new_wikipedian = editor['new_wikipedian'] |
26 | | - var.add(new_wikipedian, cnt) |
| 26 | + if new_wikipedian != False: |
| 27 | + var.add(new_wikipedian, cnt) |
27 | 28 | return var |