diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-10-07 00:14:21 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-10-07 00:14:21 (GMT) |
commit | fdb8d0f78ad94dbaa352c6bb096cbf63863dfe7d (patch) | |
tree | 6443d650cdba451324eec2a81dfdf2d8a1f3cd9c | |
parent | ddcb9685d9ab3c59cabfdd69614315af668435ec (diff) |
minor refactoring
-rwxr-xr-x | lib/RHRD/rddb.pm | 6 | ||||
-rwxr-xr-x | utils/rhrd-group | 4 | ||||
-rwxr-xr-x | utils/rhrd-sanity-check | 10 | ||||
-rwxr-xr-x | utils/rhrd-show | 4 |
4 files changed, 16 insertions, 8 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 6730127..1064505 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -604,7 +604,7 @@ sub check_group return (0, 'OK', "group '" . $groupname . "' does not exist"); } -sub get_group_carts +sub get_group_cart_range { my ($ctx, $groupname) = @_; @@ -623,7 +623,7 @@ sub get_group_carts return ($low_cart, $high_cart, $cart_type, $enforce_cart_range); } -sub set_group_carts +sub set_group_cart_range { my ($ctx, $groupname, $low_cart, $high_cart, $cart_type, $enforce_cart_range) = @_; if(!defined $low_cart) { @@ -1069,7 +1069,7 @@ sub get_next_free_showid { my ($ctx) = @_; - my ($low, $high, $type, undef) = RHRD::rddb::get_group_carts($ctx, $ctx->{'config'}{'specialgroups'}{'shows'}); + my ($low, $high, $type, undef) = RHRD::rddb::get_group_cart_range($ctx, $ctx->{'config'}{'specialgroups'}{'shows'}); unless(defined $low) { return (undef, $high, $type); } diff --git a/utils/rhrd-group b/utils/rhrd-group index 246d450..0f82c33 100755 --- a/utils/rhrd-group +++ b/utils/rhrd-group @@ -150,7 +150,7 @@ sub get_carts { my ($ctx, $groupname) = @_; - my ($low, $high, $type, $enforce_range) = RHRD::rddb::get_group_carts($ctx, $groupname); + my ($low, $high, $type, $enforce_range) = RHRD::rddb::get_group_cart_range($ctx, $groupname); unless(defined $low) { print STDERR "$type\n"; return 1; @@ -163,7 +163,7 @@ sub set_carts { my ($ctx, $groupname, $low_cart, $high_cart, $cart_type, $enforce_cart_range) = @_; - my ($cnt, undef, $errorstring) = RHRD::rddb::set_group_carts($ctx, $groupname, $low_cart, $high_cart, $cart_type, $enforce_cart_range); + my ($cnt, undef, $errorstring) = RHRD::rddb::set_group_cart_range($ctx, $groupname, $low_cart, $high_cart, $cart_type, $enforce_cart_range); unless(defined $cnt) { print STDERR "$errorstring\n"; return 1; diff --git a/utils/rhrd-sanity-check b/utils/rhrd-sanity-check index ced1d30..9a698d8 100755 --- a/utils/rhrd-sanity-check +++ b/utils/rhrd-sanity-check @@ -60,7 +60,15 @@ sub check_groups next if($group eq $ctx->{'config'}{'specialgroups'}{'allshows'}); next if($group eq $ctx->{'config'}{'specialgroups'}{'allpools'}); next if($group eq $ctx->{'config'}{'specialgroups'}{'alljingles'}); - print " " . $group . "\n"; + + my @users = RHRD::rddb::get_group_members($ctx, $group); + if(!defined $users[0] && defined $users[1]) { + print STDERR "$users[2]\n"; + return 1; + } + if(scalar @users == 0) { + print " group: '" . $group . "' has no members\n"; + } } return 0; } diff --git a/utils/rhrd-show b/utils/rhrd-show index 0ad2426..276eaef 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -154,7 +154,7 @@ sub add__create_group } print " using carts " . $low_cart . " - " . $high_cart . " for new group .. "; - ($cnt, $status, $errorstring) = RHRD::rddb::set_group_carts($ctx, $groupname, $low_cart, $high_cart, 1, 'Y'); + ($cnt, $status, $errorstring) = RHRD::rddb::set_group_cart_range($ctx, $groupname, $low_cart, $high_cart, 1, 'Y'); unless(defined $cnt) { print STDERR $status . ": " . $errorstring . "\n"; return undef; @@ -176,7 +176,7 @@ sub add__get_free_group_carts { my ($ctx, $groupname, $num_carts) = @_; - my ($low_cart, $high_cart, $type, undef) = RHRD::rddb::get_group_carts($ctx, $groupname); + my ($low_cart, $high_cart, $type, undef) = RHRD::rddb::get_group_cart_range($ctx, $groupname); unless(defined $low_cart) { print STDERR $high_cart . ": " . $type . "\n"; return undef; |