Index: trunk/tools/editor_trends/js_scripts/burnout.js |
— | — | @@ -0,0 +1,34 @@ |
| 2 | +db.editors_dataset.find().forEach(function(user){ |
| 3 | + var edits= db.editors_dataset.findOne({'username': user.username}, {'monthly_edits':1}); |
| 4 | + editor = new Object(); |
| 5 | + editor.burnout = new Array(); |
| 6 | + editor.username = user.username; |
| 7 | + editor.count = 0; |
| 8 | + editor.sum = 0; |
| 9 | + var burnout = false; |
| 10 | + var time = 0 |
| 11 | + for (year=2001;year<2011;year++){ |
| 12 | + var y = year; |
| 13 | + year = year + ''; |
| 14 | + time = (y-2001) * 12; |
| 15 | + for (month=1;month<13;month++){ |
| 16 | + var m = month; |
| 17 | + month = month +''; |
| 18 | + time = time + m; |
| 19 | + if (edits.monthly_edits[year][month] > 249) { |
| 20 | + editor.burnout[time] = edits.monthly_edits[year][month]; |
| 21 | + burnout = true; |
| 22 | + } |
| 23 | + if (burnout == true) { |
| 24 | + editor.sum = editor.sum + edits.monthly_edits[year][month]; |
| 25 | + editor.count = editor.count +1; |
| 26 | + } |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + if (editor.sum / editor.count < 10 && editor.burnout.length >0){ |
| 31 | + print(editor.username, editor.count, editor.sum, burnout); |
| 32 | + |
| 33 | + } |
| 34 | + |
| 35 | +}); |
\ No newline at end of file |