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