Commit often...
This commit is contained in:
@@ -110,6 +110,7 @@ class CRUDPPR:
|
||||
db: Session,
|
||||
ppr_id: int,
|
||||
status: PPRStatus,
|
||||
timestamp: Optional[datetime] = None,
|
||||
user: str = "system",
|
||||
user_ip: str = "127.0.0.1"
|
||||
) -> Optional[PPRRecord]:
|
||||
@@ -120,11 +121,12 @@ class CRUDPPR:
|
||||
old_status = db_obj.status
|
||||
db_obj.status = status
|
||||
|
||||
# Set timestamps based on status
|
||||
# Set timestamps based on status - use provided timestamp or current time
|
||||
current_time = timestamp if timestamp is not None else datetime.utcnow()
|
||||
if status == PPRStatus.LANDED:
|
||||
db_obj.landed_dt = datetime.utcnow()
|
||||
db_obj.landed_dt = current_time
|
||||
elif status == PPRStatus.DEPARTED:
|
||||
db_obj.departed_dt = datetime.utcnow()
|
||||
db_obj.departed_dt = current_time
|
||||
|
||||
db.add(db_obj)
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user