Revert "group() function Survey::ExpressionEngine that returns 1/0 depending on whether the current user is in a group" -- wrong branch.

This reverts commit eaa29c5f44.

Conflicts:

	docs/changelog/7.x.x.txt
This commit is contained in:
Scott Walters 2012-06-19 19:31:50 -04:00
parent 3fe8f9a080
commit 0422807b32
3 changed files with 1 additions and 38 deletions

View file

@ -36,7 +36,6 @@ my $validate;
my $validTargets;
my $otherInstances;
my $tags;
my $groups;
=head2 value
@ -353,24 +352,6 @@ sub avg {
return sum(@vals) / @vals;
}
=head2 group ($name)
Utility sub that returns a boolean indicating whether the user taking the survey is a member of a specified group, by name
=head3 $name
The name of the group
=cut
sub group {
my ($name) = @_;
my $value = grep( $_ eq $name, @$groups ) ? 1 : 0;
# warn "group($name) resolves to [$value]; groups = " . join( " ", map ">>$_<<", @$groups ) . " for userId " . $session->user->getId;
$session->log->debug("group($name) resolves to [$value]; groups = @$groups");
return $value;
}
=head2 round
Utility sub shared with Safe compartment to allows expressions to easily round numbers
@ -461,15 +442,6 @@ sub run {
$validTargets = $opts->{validTargets};
$tags = $opts->{tags} || {};
$otherInstances = {};
$groups = $session->db->buildArrayRef( qq{
select groupName
from groupings
join groups using (groupId)
where groupings.userId = ?
and expireDate > now()
}, [
$session->user->getId,
] );
if ( !$session->config->get('enableSurveyExpressionEngine') ) {
$session->log->debug('enableSurveyExpressionEngine config option disabled, skipping');
@ -497,7 +469,6 @@ sub run {
$compartment->share('&restart');
$compartment->share('&avg');
$compartment->share('&round');
$compartment->share('&group');
# Give them all of List::Util too
$compartment->share_from( 'List::Util',