mirror of
https://github.com/ferdzo/iotDashboard.git
synced 2026-04-05 01:06:24 +00:00
Fix code review issues: remove unused imports and fix exception handling
Co-authored-by: ferdzo <6640598+ferdzo@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'iotDashboard.settings')
|
|||||||
# Import Django settings and configure password hasher manually
|
# Import Django settings and configure password hasher manually
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
if not settings.configured:
|
if not settings.configured:
|
||||||
from iotDashboard.settings import *
|
from iotDashboard.settings import SECRET_KEY
|
||||||
settings.configure(
|
settings.configure(
|
||||||
PASSWORD_HASHERS=[
|
PASSWORD_HASHERS=[
|
||||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ PostgreSQL is chosen over Redis because:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
|
||||||
|
|
||||||
|
|
||||||
class DashboardLayout(models.Model):
|
class DashboardLayout(models.Model):
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Shows how weather and air quality affect health metrics.
|
|||||||
|
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Combines weather, air quality, and health data to determine if conditions are su
|
|||||||
Provides time-based recommendations and personalized insights.
|
Provides time-based recommendations and personalized insights.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, time
|
from datetime import datetime, time
|
||||||
|
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ Keep all text concise: summary under 50 words, each item under 20 words.""",
|
|||||||
try:
|
try:
|
||||||
dt = datetime.fromisoformat(current_time.replace('Z', '+00:00'))
|
dt = datetime.fromisoformat(current_time.replace('Z', '+00:00'))
|
||||||
time_str = dt.strftime("%A, %B %d at %I:%M %p")
|
time_str = dt.strftime("%A, %B %d at %I:%M %p")
|
||||||
except:
|
except (ValueError, AttributeError):
|
||||||
time_str = current_time
|
time_str = current_time
|
||||||
context_sections.append(f"Current Time: {time_str}")
|
context_sections.append(f"Current Time: {time_str}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user