NAME

CMS::Drupal::Modules::MembershipEntity::Stats - Generate statistics about MembershipEntity memberships on a Drupal site.

VERSION

version 0.91

SYNOPSIS

 use CMS::Drupal::Modules::MembershipEntity;
 use CMS::Drupal::Modules::MembershipEntity::Stats { into => 'CMS::Drupal::Modules::MembershipEntity' };
 
 my $ME = CMS::Drupal::Modules::MembershipEntity->new( dbh => $dbh ); 
 $ME->fetch_memberships();
 
 print $ME->count_active_memberships;
 print $ME->pct_active_memberships_were_renewal; 

 ...

METHODS

count_memberships

Returns the number of Memberships in the set.

count_expired_memberships

Returns the number of Memberships from the set that have status of 'expired'.

count_active_memberships

Returns the number of Memberships from the set that have status of 'active'.

count_cancelled_memberships

Returns the number of Memberships from the set that have status of 'cancelled'.

count_pending_memberships

Returns the number of Memberships from the set that have status of 'pending'.

count_were_renewal_memberships

Returns the number of Memberships from the set whose current Term was a renewal.

pct_active_memberships

Returns the percentage of all Memberships that currently have status of 'active'.

Accepts an integer value representing floating point precision as the single parameter; this parameter is optional and defaults to 2.

$ME->pct_active_memberships(4); # returns like 99.9999
$ME->pct_active_memberships;    # returns like 99.99

pct_expired_memberships

Returns the percentage of all Memberships that currently have status of 'expired'.

Accepts an integer value representing floating point precision as the single parameter; this parameter is optional and defaults to 2.

$ME->pct_expired_memberships(4); # returns like 99.9999
$ME->pct_expired_memberships;    # returns like 99.99

pct_active_memberships_were_renewal

Returns the percentage of active Memberships for which the current Term was not the first Term in the Membership.

Accepts an integer value representing floating point precision as the single parameter; this parameter is optional and defaults to 2.

$ME->pct_active_memberships_were_renewal(4); # returns like 99.9999
$ME->pct_active_memberships_were_renewal;    # returns like 99.99

AUTHOR

Nick Tonkin <tonkin@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Nick Tonkin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.