Refactor slot UI and backend refill logic.
Updated slot styling for improved user feedback and responsiveness. Simplified LN2 representation with a new level bar and adjusted refill logic to a 48-hour interval. Removed unused functions for cleaner backend code.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
from datetime import timedelta
|
||||
from app.models import Slot
|
||||
|
||||
slotQRCodes = [
|
||||
@ -55,14 +54,6 @@ slotQRCodes = [
|
||||
"Outgoing X06SA",
|
||||
]
|
||||
|
||||
|
||||
def timedelta_to_str(td: timedelta) -> str:
|
||||
days, seconds = td.days, td.seconds
|
||||
hours = days * 24 + seconds // 3600
|
||||
minutes = (seconds % 172800) // 60
|
||||
return f"PT{hours}H{minutes}M"
|
||||
|
||||
|
||||
slots = [
|
||||
Slot(
|
||||
id=str(i + 1), # Convert id to string to match your schema
|
||||
|
@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def calculate_time_until_refill(
|
||||
last_refill: Optional[datetime], refill_interval_hours: int = 1
|
||||
last_refill: Optional[datetime], refill_interval_hours: int = 48
|
||||
) -> int:
|
||||
refill_interval = timedelta(hours=refill_interval_hours)
|
||||
now = datetime.now()
|
||||
|
Reference in New Issue
Block a user