fixed nce property
This commit is contained in:
parent
16c715c774
commit
6fcbb12693
@ -38,8 +38,8 @@ class Vehicle:
|
||||
@property
|
||||
def nce(self):
|
||||
nce = self._nce_happened
|
||||
if nce:
|
||||
if NCE_KM >= self._driven_kms:
|
||||
if not nce:
|
||||
if self._driven_kms >= NCE_KM:
|
||||
nce = True
|
||||
self._nce_happened = nce
|
||||
self.velocity = 0
|
||||
@ -106,6 +106,6 @@ class Vehicle:
|
||||
if __name__ == "__main__":
|
||||
v1 = Vehicle(vin='SB164ABN1PE082986')
|
||||
v1.start_driving()
|
||||
print(v1.gps_location, v1.driven_kms)
|
||||
while True:
|
||||
print(v1.gps_location, v1.driven_kms, v1.nce)
|
||||
time.sleep(1)
|
||||
print(v1.gps_location, v1.driven_kms)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user