Kaynağa Gözat

creator

main
Madiwka3 1 yıl önce
ebeveyn
işleme
f582405340
1 değiştirilmiş dosya ile 7 ekleme ve 3 silme
  1. +7
    -3
      app/db/repository/fuelingtask.py

+ 7
- 3
app/db/repository/fuelingtask.py Dosyayı Görüntüle

@@ -43,6 +43,7 @@ def create_fueling_task(
driverobj["AssignedVehicle"] = driver.vehicle.__dict__
resobj = fueling_task_object.__dict__
resobj["Driver"] = driverobj
resobj["Creator"] = current_user
ia = fueling_task_object.ImageAfter
ib = fueling_task_object.ImageBefore
if ia is not None:
@@ -103,15 +104,18 @@ def get_all_fueling_tasks(db: Session):
x = {"FuelingTasks": result}
return x


def get_fuel_tasks_by_creator(creator_id: int, db: Session):
print(f"Retrieving all fueling tasks created by user ID: {creator_id}")
fueling_tasks = db.query(FuelingTask).filter(FuelingTask.CreatedById == creator_id).all()
fueling_tasks = (
db.query(FuelingTask).filter(FuelingTask.CreatedById == creator_id).all()
)
result = []

for task in fueling_tasks:
res = task.__dict__
res["ImageBefore"] = None
res["ImageAfter"] = None
res["ImageBefore"] = None
res["ImageAfter"] = None
res["Creator"] = task.CreatedById
driver = get_user_by_id(task.DriverId, role="Driver", db=db)
driver_obj = driver.__dict__


Yükleniyor…
İptal
Kaydet