From fdb8d0f78ad94dbaa352c6bb096cbf63863dfe7d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 7 Oct 2015 02:14:21 +0200 Subject: minor refactoring 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; -- cgit v0.10.2