mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
sig miniquery on bikes_available
This commit is contained in:
parent
39e3a0568e
commit
ef5a791c6a
8 changed files with 87 additions and 26 deletions
|
@ -543,6 +543,8 @@ sub service_update(){
|
|||
$update->{txt01} = $q->escapeHTML($q->param('q1')) if($q->param('q1'));
|
||||
$update->{txt02} = $q->escapeHTML($q->param('q2')) if($q->param('q2'));
|
||||
$update->{txt03} = $q->escapeHTML($q->param('q3')) if($q->param('q3'));
|
||||
|
||||
#just a assumption
|
||||
my $last_used_operator = $auth->{txt19};
|
||||
if($last_used_operator){
|
||||
my $dbh_operator = $dbt->dbconnect_extern("$last_used_operator");
|
||||
|
@ -551,35 +553,40 @@ sub service_update(){
|
|||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
ca_id => "$auth->{c_id}",
|
||||
int26 => ">::0.1",#if cloud distance km > 0,1
|
||||
end_time => ">=::(now() - interval '10 minutes')",
|
||||
#end_time => ">=::(now() - interval '10 minutes')",
|
||||
};
|
||||
my $post_record = $dbt->collect_post($dbh_operator,$postref);
|
||||
my $post_record = { c_id => 0 };
|
||||
$post_record = $dbt->collect_post($dbh_operator,$postref);
|
||||
$update->{int02} = $post_record->{int26} if($post_record->{int26});
|
||||
$update->{txt10} = $dbt->{operator}->{$last_used_operator}->{oprefix};
|
||||
}
|
||||
|
||||
#to update sig int28 counter
|
||||
$ctpos = $dbt->collect_post($dbh,$pref) if($bike_id);
|
||||
if($ctpos->{c_id} > 0){
|
||||
#to update sig int28 counter
|
||||
my $update_pos = {
|
||||
table => "contenttranspos",
|
||||
mtime => "now()",
|
||||
int28 => "1",
|
||||
};
|
||||
$dbt->update_record($dbh,$update_pos,$ctpos);
|
||||
$dbt->update_record($dbh_operator,$update_pos,$post_record) if($post_record->{c_id});
|
||||
|
||||
#user_miniquest_count
|
||||
my $user_miniquest_count = $auth->{int23} || 0;
|
||||
if($user_miniquest_count <= 3){
|
||||
#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 $user_miniquest_count = $auth_op->{int23} || 0;
|
||||
#if($user_miniquest_count <= 3){
|
||||
$user_miniquest_count++;
|
||||
my $update_op = {
|
||||
table => "contentadr",
|
||||
int23 => $user_miniquest_count,
|
||||
atime => "now()",
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update_op,$auth);
|
||||
}
|
||||
my $rows = $dbt->update_record($dbh_operator,$update_op,$auth_op);
|
||||
#}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1607,7 +1614,7 @@ sub booking_update(){
|
|||
my $co2diff = $pri->co2calc($booking);
|
||||
my $sprit_price = $pri->sprit2calc($booking);
|
||||
$co2saving .= "$co2diff kg CO2, ";
|
||||
$co2saving .= "$sprit_price EUR " if($sprit_price > 0);
|
||||
$co2saving .= "$sprit_price EUR " if($sprit_price !~ /-/);
|
||||
$booking->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei einer Strecke von $booking->{int26} KM";
|
||||
$booking_values->{co2saving} = $co2saving;
|
||||
|
@ -1726,6 +1733,49 @@ sub user_rentals_history(){
|
|||
}#end user_rental_history
|
||||
|
||||
|
||||
#last used rental to feedback
|
||||
sub rental_to_feedback{
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $auth = shift;
|
||||
|
||||
my $pref = {
|
||||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
template_id => "218",
|
||||
ca_id => "$auth->{c_id}",
|
||||
"ct.close_time" => "is::null",
|
||||
int10 => "1",
|
||||
int11 => "3",#sig system
|
||||
int28 => "3",#set count on sig rental_end
|
||||
#end_time => ">=::(now() - interval '5 min')",
|
||||
};
|
||||
my $ctpos = { c_id => 0 };
|
||||
$ctpos = $dbt->collect_post($dbh,$pref);
|
||||
|
||||
|
||||
my $show_dialog = {};
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{project} eq "Bayern"){
|
||||
if($auth->{int23} < 4){
|
||||
$bw->log("user_miniquery via $varenv->{dbname} user ID $auth->{c_id} exist count:",$auth->{int23},"");
|
||||
$show_dialog->{user_miniquery} = $dbt->evaluationsfragen($dbh);
|
||||
}
|
||||
if($ctpos->{int26}){
|
||||
my $co2saving = "Einsparung: ";
|
||||
my $co2diff = $pri->co2calc($ctpos);
|
||||
my $sprit_price = $pri->sprit2calc($ctpos);
|
||||
$co2saving .= "$co2diff kg CO2, ";
|
||||
$co2saving .= "$sprit_price EUR " if($sprit_price !~ /-/);
|
||||
$ctpos->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei einer Strecke von $ctpos->{int26} KM";
|
||||
$show_dialog->{co2saving} = $co2saving;
|
||||
}
|
||||
}
|
||||
return ($ctpos,$show_dialog);
|
||||
}
|
||||
|
||||
|
||||
#user bikes occupied
|
||||
sub user_bikes_occupied(){
|
||||
my $self = shift;
|
||||
|
@ -1747,7 +1797,7 @@ sub user_bikes_occupied(){
|
|||
|
||||
##selects also int28 > 0 bikes to view once miniquery
|
||||
#it will only defined on booking_request, because there must be available
|
||||
$pref->{show_dialog} = "1" if($show_dialog);
|
||||
#$pref->{show_dialog} = "1" if($show_dialog);
|
||||
my $record = $dbt->collect_post($dbh,$pref);
|
||||
return $record;
|
||||
}#end user_bikes_occupied
|
||||
|
@ -1788,7 +1838,8 @@ sub rentals(){
|
|||
}
|
||||
}
|
||||
#sig update station_lock_state=locked to cancel once miniquery
|
||||
elsif($record->{$id}->{int11} && $record->{$id}->{int11} == 3){
|
||||
#disabled, moving to bikes_available
|
||||
elsif(1==2 && $record->{$id}->{int11} && $record->{$id}->{int11} == 3){
|
||||
$return->{$id}->{rentalId} = "$record->{$id}->{txt11}";
|
||||
|
||||
if($record->{$id}->{int28}){
|
||||
|
|
|
@ -68,7 +68,13 @@ sub sig_available {
|
|||
|
||||
my $authed = 0;
|
||||
my $tariff_content = {};
|
||||
$authed = 1 if(ref($ctadr) eq "HASH" && $ctadr->{c_id} && $ctadr->{c_id} > 0);
|
||||
my $ctpos = { c_id => 0 };
|
||||
my $show_dialog = {};
|
||||
if(ref($ctadr) eq "HASH" && $ctadr->{c_id} && $ctadr->{c_id} > 0){
|
||||
$authed = 1;
|
||||
($ctpos,$show_dialog) = $apif->rental_to_feedback($varenv,$ctadr);
|
||||
}
|
||||
|
||||
(my $bike_group,my $user_group,$tariff_content,my $user_tour) = $apif->fetch_tariff($varenv->{dbname},$ctadr,$q->param('authcookie'));
|
||||
|
||||
my $hotline_hash = {
|
||||
|
@ -165,6 +171,10 @@ sub sig_available {
|
|||
print FILE "bike_group $bike_id | $resp->{site}->{id} | @{$bike_group}[0]\n";
|
||||
if($bike && looks_like_number($bike_id) && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){
|
||||
print FILE "Bike: $bike\n";
|
||||
if($ctpos->{barcode} && $ctpos->{barcode} == $bike_id){
|
||||
$response_out->{$bike}->{user_miniquery} = $show_dialog->{user_miniquery} if($show_dialog->{user_miniquery});
|
||||
$response_out->{$bike}->{co2saving} = $show_dialog->{co2saving} if($show_dialog->{co2saving});
|
||||
}
|
||||
$response_out->{$bike}->{bike} = "$bike";
|
||||
$response_out->{$bike}->{authed} = "$authed";
|
||||
$response_out->{$bike}->{station} = "SX$resp->{site}->{id}" || "";
|
||||
|
|
|
@ -625,10 +625,10 @@ sub collect_post(){
|
|||
}elsif($key =~ /^(c_id|ca_id|ct_id|owner|barcode|int\d+)$/ && $value){
|
||||
$cp_where .= " and cp.$key $op $value";
|
||||
}
|
||||
}
|
||||
#}
|
||||
#selects also push event=RENTAL_END station_lock_state bikes to view feedback and miniquery
|
||||
elsif($key eq "int10" && $value eq "('3','2')" && $fetch->{show_dialog}){
|
||||
$cp_where .= " and (cp.$key $op $value OR cp.int28 = 3)";#select only if no dialog saved
|
||||
#elsif($key eq "int10" && $value eq "('3','2')" && $fetch->{show_dialog}){
|
||||
# $cp_where .= " and (cp.$key $op $value OR cp.int28 = 3)";#select only if no dialog saved
|
||||
}elsif($key =~ /^(c_id|ca_id|ct_id|owner|barcode|int\d+)$/ && $value){
|
||||
$cp_where .= " and cp.$key $op $value";
|
||||
}elsif($fetch->{catch} && $key eq "template_id" && $value){
|
||||
|
|
|
@ -474,7 +474,7 @@ td {
|
|||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ EOF
|
|||
my $co2diff = $pri->co2calc($cttpos);
|
||||
my $sprit_price = $pri->sprit2calc($cttpos);
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
|
||||
$cttpos->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{int26} KM";
|
||||
print $q->td({-class=>'content1_cms'},"$co2saving");
|
||||
|
|
|
@ -253,7 +253,7 @@ EOF
|
|||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ sub tpl(){
|
|||
#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_wue"; my $bike="WUE5525";
|
||||
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";
|
||||
|
|
|
@ -425,7 +425,7 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
|
|||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price !~ /-/);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue