From fd6ddfef8c7ef7e8710edd1ad22a4f45f62c053b Mon Sep 17 00:00:00 2001 From: ragu Date: Fri, 15 Jul 2022 19:03:07 +0200 Subject: [PATCH] miniquest count --- copri4/main/src/Mod/APIfunc.pm | 41 +++++++++++++-------- copri4/shareeapp-operator/src/Lib/Mlogic.pm | 4 +- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index 72ee926..90bc50d 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -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 diff --git a/copri4/shareeapp-operator/src/Lib/Mlogic.pm b/copri4/shareeapp-operator/src/Lib/Mlogic.pm index 3503674..7fc8fc0 100755 --- a/copri4/shareeapp-operator/src/Lib/Mlogic.pm +++ b/copri4/shareeapp-operator/src/Lib/Mlogic.pm @@ -42,11 +42,11 @@ sub tpl(){ if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test" || $users_sharee->{txt08} eq "sigo\@sharee.bike")){ my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; - my $api_test = "sharee_fr01"; my $bike="FR1538"; + # my $api_test = "sharee_fr01"; my $bike="FR1538"; #my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test #my $api_test = "sharee_kn"; my $bike="KN205"; #my $api_test = "sharee_wue"; my $bike="WUE5525"; - #my $api_test = "sharee_sx"; my $bike="S3X1001"; + my $api_test = "sharee_sx"; my $bike="S3X1001"; #my $api_test = "sharee_ren"; my $bike="REN2"; print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n";