Tracker::CouchDbBackend::arbitBackendCouchDbTrackerStatisticsView
Class arbitBackendCouchDbTrackerStatisticsView
View on issue tracker issues View on issue tracker issues
phpillowView
|
--arbitBackendCouchDbTrackerStatisticsView
Author(s):
|
Version:
|
$Revision: 1236 $ |
|
License:
|
GPL |
Member Variables
|
protected array |
$viewDefinitions
= array( // Add plain view on all users 'types' => 'function( doc ) { if ( doc.type == "tracker_issue" ) { emit( doc.issueType, 1 ); } }', 'states' => 'function( doc ) { if ( doc.type == "tracker_issue" ) { emit( doc.state, 1 ); } }', 'issue_activity' => 'function( doc ) { if ( doc.type == "tracker_issue" ) { var dates = [] dates.push( doc.edited );
for ( var i = 1; i < doc.revisions.length; ++i ) { dates.push( doc.revisions[i].edited ); }
for ( var i = 0; i < dates.length; ++i ) { date = new Date(); date.setTime( dates[i] * 1000 ); emit( [ date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), ], 1 ); } } }', 'comment_activity' => 'function( doc ) { if ( doc.type == "tracker_comment" ) { var dates = [doc.edited]
for ( var i = 0; i < dates.length; ++i ) { date = new Date(); date.setTime( dates[i] * 1000 ); emit( [ date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), ], 1 ); } } }', )
View functions to be registered on the server
View functions to be registered on the server |
|
protected array |
$viewReduces
= array( 'types' => 'function( keys, values, combine ) { if ( combine ) { return sum( values ); } else { return values.length; } }', 'states' => 'function( keys, values, combine ) { if ( combine ) { return sum( values ); } else { return values.length; } }', 'issue_activity' => 'function( keys, values, combine ) { if ( combine ) { return sum( values ); } else { return values.length; } }', 'comment_activity' => 'function( keys, values, combine ) { if ( combine ) { return sum( values ); } else { return values.length; } }', )
Reduce function for a view function.
Reduce function for a view function.
A reduce function may be used to aggregate / reduce the results calculated by a view function. See the CouchDB documentation for more results.
Each view reduce function MUST have a view definition with the same name, otherwise there is nothing to reduce. |
Method Summary
Methods
getViewName
string
getViewName(
)
Get name of view Get name of view
Get name of view
|