Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/323324
Change subject: Record bytes change ...................................................................... Record bytes change Note the bytes changed by the first revision are not available and since we throw away bot edits we can't tell the total amount of bytes changed by all users. Thus, this number is not as accurate as it could be but accurate enough. Bug: T145554 Change-Id: I04ba6e57e8e02917ea48388346524ed4a08498bd --- M test/features/lib/processor.js 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/trending-edits refs/changes/24/323324/1 diff --git a/test/features/lib/processor.js b/test/features/lib/processor.js index 7782d80..e74eead 100644 --- a/test/features/lib/processor.js +++ b/test/features/lib/processor.js @@ -37,7 +37,7 @@ page_id: 3 }; -function edit( id, username, ts, ns, isBot ) { +function edit( id, username, ts, ns, isBot, data ) { var performer = { user_groups: ["*"], user_is_bot: isBot, @@ -47,7 +47,7 @@ if ( username.indexOf( '.' ) === -1 ) { performer.user_id = 1; } - return { + return Object.assign( { comment: '', meta: { topic: "mediawiki.revision-create" }, page_id: id, @@ -58,14 +58,14 @@ rev_len: 200, rev_minor_edit: false, rev_timestamp: ts - }; + }, data ); } describe('processor - series of events', function() { processor.reset(); processor.process( edit( 1, 'Jon', '2016-11-15T18:00:55+00:00' ) ); processor.process( edit( 1, 'Corey', '2016-11-15T18:02:55+00:00' ) ); - processor.process( edit( 1, 'Bernd', '2016-11-15T18:03:55+00:00' ) ); + processor.process( edit( 1, 'Bernd', '2016-11-15T18:03:55+00:00', 0, false, { rev_len: 600 } ) ); processor.process( edit( 2, 'Talker', '2016-11-15T18:03:55+00:00', 1 ) ); processor.process( edit( 1, 'Bot', '2016-11-15T18:03:55+00:00', 0, true ) ); @@ -74,6 +74,8 @@ assert.ok( pages.length === 1, 'Pages with same name are combined into single page' ); assert.ok( pages[0].edits === 3, 'Edits are counted for all non-bot edits' ); assert.ok( pages[0].title === 'Foo', 'Title is present' ); + assert.ok( pages[0].bytes === 400, + 'Bytes are calculated based on the rev_len of the first edit and last' ); assert.ok( pages[0].updated.toISOString() === '2016-11-15T18:03:55.000Z', 'Updated is timestamp of last edit' ); assert.ok( pages[0].from.toISOString() === '2016-11-15T18:00:55.000Z', -- To view, visit https://gerrit.wikimedia.org/r/323324 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I04ba6e57e8e02917ea48388346524ed4a08498bd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/trending-edits Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits