mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 23:26:29 +02:00
Tarif refactoring+
This commit is contained in:
parent
292b9754ee
commit
b2e5d72c51
15 changed files with 216 additions and 135 deletions
|
@ -1163,6 +1163,7 @@ sub booking_update(){
|
|||
if($record_pos->{int24}){
|
||||
$update_pos->{owner_end} = "$owner";
|
||||
$update_pos->{end_time} = "now()";
|
||||
#return after booking_update
|
||||
my $pricing = $pri->sharee_pricing($record_pos,"calc_price");
|
||||
$update_pos->{int03} = "$pricing->{computed_hours}" if(looks_like_number($pricing->{computed_hours}));
|
||||
|
||||
|
@ -1213,6 +1214,7 @@ sub booking_update(){
|
|||
$update_pos->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
|
||||
#end-Station prefix
|
||||
$update_cc->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
|
||||
#return after booking_update
|
||||
my $pricing = $pri->sharee_pricing($record_pos,"calc_price");
|
||||
$update_pos->{int03} = "$pricing->{computed_hours}" if(looks_like_number($pricing->{computed_hours}));
|
||||
$rows = $dbt->update_record($dbh,$update_pos,$record_pos);
|
||||
|
@ -1240,6 +1242,7 @@ sub booking_update(){
|
|||
$update_pos->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
|
||||
#end-Station prefix
|
||||
$update_cc->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
|
||||
#return after booking_update
|
||||
my $pricing = $pri->sharee_pricing($record_pos,"calc_price");
|
||||
$update_pos->{int03} = "$pricing->{computed_hours}" if(looks_like_number($pricing->{computed_hours}));
|
||||
$rows = $dbt->update_record($dbh,$update_pos,$record_pos);
|
||||
|
@ -1478,12 +1481,22 @@ sub booking_update(){
|
|||
|
||||
#fetch tracking distance on Ilockit cloud by summary trip if(tracking && deviceId && available)
|
||||
if($booking->{int25} == 1 && $booking->{int10} == 1){
|
||||
$bw->log("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id}",$booking->{c_id},"");
|
||||
system(`$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id}`) if($booking->{int13});#if ilockit clouid
|
||||
sleep 2;#hopefully get distance in 2 sec.
|
||||
$booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
$bw->log("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id}",$booking->{c_id},"");
|
||||
#if ilockit clouid
|
||||
if($booking->{int13}){
|
||||
system("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id}");
|
||||
$booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
#try it again with 20sec sleep
|
||||
if(!$booking->{int26}){
|
||||
$bw->log("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id} 20",$booking->{c_id},"");
|
||||
system("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id} 20 &");
|
||||
$booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
}
|
||||
}
|
||||
|
||||
my $co2saving = "";
|
||||
$booking->{int26} = 10 if(!$booking->{int26} && ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 11765 || $auth->{c_id} == 1843));#10 km test
|
||||
#$booking->{int26} = 10 if(!$booking->{int26} && ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 11765 || $auth->{c_id} == 1843));#10 km test
|
||||
if($booking->{int26}){
|
||||
$co2saving = "Einsparung: ";
|
||||
my $co2diff = $pri->co2calc($booking);
|
||||
|
@ -1491,7 +1504,7 @@ sub booking_update(){
|
|||
$co2saving .= "$co2diff kg CO2 und ";
|
||||
$co2saving .= "$sprit_price EUR ";
|
||||
$booking->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei einer Strecke von $booking->{int26} KM (Demo)";
|
||||
$co2saving .= "bei einer Strecke von $booking->{int26} KM";
|
||||
$booking_values->{co2saving} = $co2saving;
|
||||
}
|
||||
}
|
||||
|
@ -1624,6 +1637,7 @@ sub user_bikes_occupied(){
|
|||
|
||||
|
||||
#rentals
|
||||
#called by user_bikes_occupied (bikes_occupied object)
|
||||
sub rentals(){
|
||||
my $self = shift;
|
||||
my $record = shift;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue