Fix: Running tables view was showing wrong datetime.

This commit is contained in:
Amritanshu Agrawal 2021-04-06 09:33:12 +05:30
parent 00730c1463
commit b9c3b7eda5

View File

@ -1,5 +1,6 @@
import uuid
from datetime import timedelta
from typing import List, Union
import barker.schemas.table as schemas
@ -8,6 +9,7 @@ from fastapi import APIRouter, Depends, HTTPException, Security, status
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Session
from ..core.config import settings
from ..core.security import get_current_active_user as get_user
from ..db.session import SessionLocal
from ..models.food_table import FoodTable
@ -165,7 +167,9 @@ def show_running(db: Session = Depends(get_db), user: UserToken = Depends(get_us
ft["status"] = item.status.status
ft["voucherId"] = item.status.voucher_id
ft["pax"] = item.status.voucher.pax
ft["date"] = item.status.voucher.date.strftime("%d-%b-%Y %H:%M")
ft["date"] = (item.status.voucher.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES)).strftime(
"%d-%b-%Y %H:%M"
)
ft["amount"] = item.status.voucher.amount
if item.status.guest is not None:
ft["guest"] = item.status.guest.customer.name