-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend.py
50 lines (42 loc) · 1.41 KB
/
backend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""tomtomapi=""
weatherapi=""
def noofdelivery
def disttravelled
def salary
def fuelsaved:
def start delivery:
def vehicletype:
#screen2
def deliveries:
def generateroute:
"""
import random
import datetime
# Function to calculate the number of deliveries
def noofdelivery():
# Placeholder: Return a random number of deliveries
return random.randint(20, 100)
# Function to calculate the distance travelled
def disttravelled():
# Placeholder: Return a random distance in kilometers
return f"{random.randint(100, 1000)} km"
# Function to calculate the driver's salary
def salary():
# Placeholder: Calculate salary based on a fixed rate and deliveries
deliveries = noofdelivery()
rate_per_delivery = 50 # Example rate
return f"${deliveries * rate_per_delivery}"
# Function to calculate fuel saved
def fuelsaved():
# Placeholder: Return a random amount of fuel saved
return f"{random.uniform(10, 100):.2f} liters"
# Function to start delivery
def startdelivery():
# Placeholder: Simulate a delivery status
current_time = datetime.datetime.now()
return f"Delivery started at {current_time.strftime('%Y-%m-%d %H:%M:%S')}"
# Function to select or identify vehicle type
def vehicletype():
# Placeholder: Return a random vehicle type
vehicle_types = ["Electric Van", "Hybrid Truck", "Diesel Truck"]
return random.choice(vehicle_types)