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:
GotthardG
2024-12-20 13:20:45 +01:00
parent 6ff9cbe327
commit 27d2717a05
4 changed files with 139 additions and 77 deletions

View File

@ -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

View File

@ -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()