miniquest count

This commit is contained in:
ragu 2022-07-15 19:03:07 +02:00
parent f02158998f
commit fd6ddfef8c
2 changed files with 28 additions and 17 deletions

View file

@ -570,23 +570,23 @@ sub service_update(){
$dbt->update_record($dbh_operator,$update_pos,$post_record) if($post_record->{c_id});
#user_miniquest_count on operator
my $adref = {
table => "contentadr",
fetch => "one",
template_id => "202",
c_id => "$auth->{c_id}",
};
my $auth_op = $dbt->fetch_record($dbh_operator,$adref);
#my $adref = {
# table => "contentadr",
# fetch => "one",
# template_id => "202",
# c_id => "$auth->{c_id}",
# };
#my $auth_op = $dbt->fetch_record($dbh_operator,$adref);
my $user_miniquest_count = $auth_op->{int23} || 0;
my $user_miniquest_count = $auth->{int23} || 0;
if($user_miniquest_count <= 3){
$user_miniquest_count++;
my $update_op = {
my $update23 = {
table => "contentadr",
int23 => $user_miniquest_count,
atime => "now()",
};
my $rows = $dbt->update_record($dbh_operator,$update_op,$auth_op);
my $rows = $dbt->update_record($dbh,$update23,$auth);
}
}
}
@ -1584,22 +1584,33 @@ sub booking_update(){
#keep in mind, it works on operator dependency
#only for project=Bayern and developer enabled
#redundant code in APIfunc sub rentals for sig user_miniquery
if($booking->{int10} == 1 && $dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $auth->{int23} < 4){
#TODO $auth int23 seems primary
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
#user_miniquest_count on operator
my $adref = {
table => "contentadr",
fetch => "one",
template_id => "202",
c_id => "$auth->{c_id}",
};
my $auth_prim = $dbt->fetch_record($dbh_primary,$adref);
if($booking->{int10} == 1 && $dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $auth_prim->{int23} < 4){
$bw->log("user_miniquery via $varenv{dbname} user ID $auth->{c_id} exist count:",$auth->{int23},"");
$bw->log("user_miniquery user ID $auth_prim->{c_id} exist count:",$auth_prim->{int23},"");
$booking_values->{user_miniquery} = $dbt->evaluationsfragen($dbh);
#user_miniquest_count
my $user_miniquest_count = $auth->{int23} || 0;
my $user_miniquest_count = $auth_prim->{int23} || 0;
if($user_miniquest_count <= 3){
$user_miniquest_count++;
my $update_op = {
my $update23 = {
table => "contentadr",
int23 => $user_miniquest_count,
atime => "now()",
};
$rows = $dbt->update_record($dbh,$update_op,$auth);
$rows = $dbt->update_record($dbh,$update23,$auth_prim);
}
}#end mini_quest