@@ -769,12 +769,12 @@ export class Logic {
769
769
}
770
770
}
771
771
772
- private async generateAIschedule ( vehicle : DBVehicle ) : Promise < { ts : number ; level : number } | null > {
772
+ private async generateAIschedule ( vehicle : DBVehicle , location_uuid : string | null ) : Promise < { ts : number ; level : number } | null > {
773
773
/*
774
774
****** ANALYSE AND THINK ABOUT IT! ******
775
775
*/
776
776
777
- const locationSettings = this . getVehicleLocationSettings ( vehicle , vehicle . location_uuid ) ;
777
+ const locationSettings = this . getVehicleLocationSettings ( vehicle , location_uuid ) ;
778
778
const minimum_charge = locationSettings . directLevel ;
779
779
780
780
const guess : { charge : number ; before : number ; } | null = await this . db . pg . oneOrNone (
@@ -835,7 +835,7 @@ export class Logic {
835
835
` ,
836
836
[
837
837
vehicle . vehicle_uuid ,
838
- vehicle . location_uuid ,
838
+ location_uuid ,
839
839
null /*scheduleMap[ScheduleType.Guide] &&
840
840
scheduleMap[ScheduleType.Guide].time*/ ,
841
841
]
@@ -1097,7 +1097,7 @@ export class Logic {
1097
1097
if ( location_uuid ) {
1098
1098
if ( startLevel < vehicle . maximum_charge ) {
1099
1099
// Generate an AI schedule
1100
- const schedule = stats && ( await this . generateAIschedule ( vehicle ) ) ;
1100
+ const schedule = stats && ( await this . generateAIschedule ( vehicle , location_uuid ) ) ;
1101
1101
// If we have a trip and ai.ts and schedule.ts is more than 12 hours apart, we should still AI charge
1102
1102
if ( ! trip || ! trip . schedule_ts || trip . schedule_ts . getTime ( ) > priceAvailable
1103
1103
|| ( schedule && Math . abs ( trip . schedule_ts . getTime ( ) - schedule . ts ) > 12 * 60 * 60e3 )
0 commit comments